Skip to content

Commit 8d3a5eb

Browse files
authored
devops: mark Docker images as EOL (microsoft#2347)
1 parent 665af8d commit 8d3a5eb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

utils/docker/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oras/

utils/docker/publish_docker.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,27 @@ tag_and_push() {
5151
echo "-- tagging: $target"
5252
docker tag $source $target
5353
docker push $target
54+
attach_eol_manifest $target
55+
}
56+
57+
attach_eol_manifest() {
58+
local image="$1"
59+
local today=$(date -u +'%Y-%m-%d')
60+
install_oras_if_needed
61+
# oras is re-using Docker credentials, so we don't need to login.
62+
# Following the advice in https://portal.microsofticm.com/imp/v3/incidents/incident/476783820/summary
63+
./oras/oras attach --artifact-type application/vnd.microsoft.artifact.lifecycle --annotation "vnd.microsoft.artifact.lifecycle.end-of-life.date=$today" $image
64+
}
65+
66+
install_oras_if_needed() {
67+
if [[ -x oras/oras ]]; then
68+
return
69+
fi
70+
local version="1.1.0"
71+
curl -sLO "https://github.com/oras-project/oras/releases/download/v${version}/oras_${version}_linux_amd64.tar.gz"
72+
mkdir -p oras
73+
tar -zxf oras_${version}_linux_amd64.tar.gz -C oras
74+
rm oras_${version}_linux_amd64.tar.gz
5475
}
5576

5677
publish_docker_images_with_arch_suffix() {

0 commit comments

Comments
 (0)