Skip to content

Commit

Permalink
attach EOL manifest to base containers as well (microsoft#8935)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandeepsplaha authored Apr 29, 2024
1 parent 0de3bb8 commit 119c40d
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .pipelines/containerSourceData/scripts/BuildBaseContainers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,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 {
Expand Down Expand Up @@ -270,16 +272,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 {
Expand Down

0 comments on commit 119c40d

Please sign in to comment.