Skip to content

Commit f98ad20

Browse files
authored
devops: mark Docker images as EOL (#1505)
1 parent 8fb21af commit f98ad20

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

utils/docker/.gitignore

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

utils/docker/publish_docker.sh

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

6182
publish_docker_images_with_arch_suffix() {

0 commit comments

Comments
 (0)