Skip to content

Commit b3668fe

Browse files
committed
Add tag.sh
1 parent 9341354 commit b3668fe

File tree

2 files changed

+57
-46
lines changed

2 files changed

+57
-46
lines changed

host/release.vsts-ci.yml

+3-46
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,14 @@ variables:
55

66
steps:
77
- bash: |
8-
# login
98
echo $pswd | docker login -u $(dockerId) --password-stdin $(dockerId).azurecr.io
109
displayName: login
1110
continueOnError: false
1211
env:
1312
pswd: $(dockerPassword)
1413

1514
- bash: |
16-
# pull
17-
set -e
18-
19-
images=( base dotnet node python powershell )
20-
for i in "${images[@]}"
21-
do
22-
# Pull
23-
docker pull $(dockerId).azurecr.io/public/azure-functions/$i:$(ReleaseVersion)
24-
if [ "$i" != "base" ]; then
25-
docker pull $(dockerId).azurecr.io/public/azure-functions/$i:$(ReleaseVersion)-appservice
26-
fi
27-
28-
# tag
29-
docker tag $(dockerId).azurecr.io/public/azure-functions/$i:$(ReleaseVersion) $(dockerId).azurecr.io/public/azure-functions/$i:2.0
30-
docker tag $(dockerId).azurecr.io/public/azure-functions/$i:$(ReleaseVersion) $(dockerId).azurecr.io/public/azure-functions/$i:latest
31-
docker tag $(dockerId).azurecr.io/public/azure-functions/$i:$(ReleaseVersion) $(dockerId).azurecr.io/public/azure-functions/$i:2.0-iot-edge
32-
33-
if [ "$i" != "base" ]; then
34-
docker tag $(dockerId).azurecr.io/public/azure-functions/$i:$(ReleaseVersion)-appservice $(dockerId).azurecr.io/public/azure-functions/$i:2.0-appservice
35-
fi
36-
37-
# Push
38-
docker push $(dockerId).azurecr.io/public/azure-functions/$i:2.0
39-
docker push $(dockerId).azurecr.io/public/azure-functions/$i:latest
40-
docker push $(dockerId).azurecr.io/public/azure-functions/$i:2.0-iot-edge
41-
42-
if [ "$i" != "base" ]; then
43-
docker push $(dockerId).azurecr.io/public/azure-functions/$i:2.0-appservice
44-
fi
45-
46-
done
47-
48-
images=( dotnet powershell java )
49-
for i in "${images[@]}"
50-
do
51-
# Pull
52-
docker pull $(dockerId).azurecr.io/public/azure-functions/$i:$(ReleaseVersion)-alpine
53-
54-
# tag
55-
docker tag $(dockerId).azurecr.io/public/azure-functions/$i:$(ReleaseVersion)-alpine $(dockerId).azurecr.io/public/azure-functions/$i:2.0-alpine
56-
57-
# Push
58-
docker push $(dockerId).azurecr.io/public/azure-functions/$i:2.0-alpine
59-
done
60-
displayName: pull images
15+
export ReleaseVersion=$(ReleaseVersion)
16+
./tag.sh
17+
displayName: tag and push images
6118
continueOnError: false

tag.sh

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#! /bin/bash
2+
3+
set -e
4+
5+
ACR=azurefunctions.azurecr.io
6+
ACR_NAMESPACE=public/azure-functions
7+
8+
function pull_tag_push {
9+
local image_to_pull=$1
10+
local new_image_name=$2
11+
12+
docker pull $image_to_pull
13+
docker tag $image_to_pull $new_image_name
14+
docker push $new_image_name
15+
}
16+
17+
images=( base dotnet node python powershell )
18+
for i in "${images[@]}"
19+
do
20+
current_image=$ACR/$ACR_NAMESPACE/$i:$ReleaseVersion
21+
current_base=$ACR/$ACR_NAMESPACE/$i
22+
23+
pull_tag_push $current_image $current_base:2.0
24+
pull_tag_push $current_image $current_base:latest
25+
pull_tag_push $current_image $current_base:2.0-iot-edge
26+
27+
if [ "$i" != "base" ]; then
28+
pull_tag_push $current_image-appservice $current_base:2.0-appservice
29+
fi
30+
31+
if [ "$i" == "python" ]; then
32+
pull_tag_push $current_image $current_base:2.0-python3.6
33+
pull_tag_push $current_image-appservice $current_base:2.0-python3.6-appservice
34+
elif [ "$i" == "node" ]; then
35+
pull_tag_push $current_image $current_base:2.0-node8
36+
pull_tag_push $current_image-appservice $current_base:2.0-node8-appservice
37+
elif [ "$i" == "powershell" ]; then
38+
pull_tag_push $current_image $current_base:2.0-pwsh6
39+
pull_tag_push $current_image-appservice $current_base:2.0-pwsh6-appservice
40+
fi
41+
done
42+
43+
images=( dotnet powershell java )
44+
for i in "${images[@]}"
45+
do
46+
current_image=$ACR/$ACR_NAMESPACE/$i:$ReleaseVersion-alpine
47+
current_base=$ACR/$ACR_NAMESPACE/$i
48+
49+
pull_tag_push $current_image $current_base:2.0-alpine
50+
51+
if [ "$i" == "powershell" ]; then
52+
pull_tag_push $current_image $current_base:2.0-pwsh6
53+
fi
54+
done

0 commit comments

Comments
 (0)