From ac15441cbde1b0c856cecbf74036d463eda6047d Mon Sep 17 00:00:00 2001 From: Mandeep Plaha <99760213+mandeepsplaha@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:24:52 -0700 Subject: [PATCH] attach EOL manifest to base containers as well (#8934) --- .../scripts/BuildBaseContainers.sh | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.pipelines/containerSourceData/scripts/BuildBaseContainers.sh b/.pipelines/containerSourceData/scripts/BuildBaseContainers.sh index 37ddeb85eb..ac06aa4059 100755 --- a/.pipelines/containerSourceData/scripts/BuildBaseContainers.sh +++ b/.pipelines/containerSourceData/scripts/BuildBaseContainers.sh @@ -206,6 +206,8 @@ function initialization { ROOT_FOLDER="$(git rev-parse --show-toplevel)" EULA_FILE_PATH="$ROOT_FOLDER/.pipelines/container_artifacts/data" + END_OF_LIFE_1_YEAR=$(date -d "+1 year" "+%Y-%m-%dT%H:%M:%SZ") + echo "END_OF_LIFE_1_YEAR -> $END_OF_LIFE_1_YEAR" } function build_builder_image { @@ -306,16 +308,31 @@ function docker_build_marinara { save_container_image "$MARINARA" "$MARINARA_IMAGE_NAME" } +function oras_attach { + local image_name=$1 + oras attach \ + --artifact-type "application/vnd.microsoft.artifact.lifecycle" \ + --annotation "vnd.microsoft.artifact.lifecycle.end-of-life.date=$END_OF_LIFE_1_YEAR" \ + "$image_name" +} + function publish_to_acr { local image=$1 if [[ ! "$PUBLISH_TO_ACR" =~ [Tt]rue ]]; then echo "+++ Skip publishing to ACR" return fi + + echo "+++ az login into Azure ACR $ACR" + local oras_access_token + oras_access_token=$(az acr login --name "$ACR" --expose-token --output tsv --query accessToken) + oras login "$ACR.azurecr.io" \ + --username "00000000-0000-0000-0000-000000000000" \ + --password "$oras_access_token" + echo "+++ Publish container $image" - echo "login into ACR: $ACR" - az acr login --name "$ACR" docker image push "$image" + oras_attach "$image" } function save_container_image {