forked from Azure/azure-functions-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-pipelines.sh
More file actions
executable file
·61 lines (49 loc) · 2.38 KB
/
Copy pathverify-pipelines.sh
File metadata and controls
executable file
·61 lines (49 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/bash
DIR=$(dirname $0)
IFS=$'\n'
check_sovereign() {
sharedimages=($(comm -12 <(printf '%s\n' "${stage[@]}"|sort -u) <(printf '%s\n' "${pub[@]}"|sort -u)))
sovereign=($(((grep "docker push".*appservice ${TARGET}/publish-appservice-stage-sovereign-clouds.yml) | awk -F'-appservice' '{print $1}') | awk -F 'TARGET_REGISTRY' '{print $2}') )
diffsovereign=($(comm -3 <(printf '%s\n' "${sharedimages[@]}"|sort -u) <(printf '%s\n' "${sovereign[@]}"|sort -u)))
if [ -z "$diffsovereign" ]; then
echo -e "Sovereign pipeline verified for ${TARGET}/. Proceed with release.\n"
exit 0
else
echo -e "Sovereign pipeline is invalid. Other than the /base image all pipelines should publish the same -appservice images. The following differences exist for -appservice images in the sovereign pipeline: "
echo -e ${diffsovereign[@]}
exit 1
fi
}
if [ "$1" != "2.0" ] && [ "$1" != "3" ] && [ "$1" != "4" ]; then
echo -e "MajorVersion must be 2.0, 3, or 4 Got '$1'\n"
print_usage
exit 1
fi
if [ "$1" == "2.0" ]; then
echo -e "MajorVersion 2.0 is not supported by this script. Continuing with NoOp"
exit 0
fi
if [ "$1" == "3" ]; then
echo -e "MajorVersion 3 detected. Verifying pipelines in host/3.0/"
TARGET="./3.0"
else
echo -e "MajorVersion 4 detected. Verifying pipelines in host/4/"
TARGET="./4"
fi
stage=($(((grep "docker push".*appservice ${TARGET}/publish-appservice-stage.yml) | awk -F'-appservice' '{print $1}') | awk -F 'TARGET_REGISTRY' '{print $2}') )
pub=($((((grep "docker push".*appservice ${TARGET}/publish.yml)| grep -v quickstart) | awk -F'-appservice' '{print $1}') | awk -F 'TARGET_REGISTRY' '{print $2}') )
difference=($(comm -3 <(printf '%s\n' "${stage[@]}"|sort -u) <(printf '%s\n' "${pub[@]}"|sort -u)))
if [ -z "$difference" ]; then
echo -e "No differences between Stage and Publish pipelines. Verifying sovereign cloud pipeline.\n"
check_sovereign
exit 0
fi
if [ ${#difference[@]} == 1 ] && [[ $difference =~ "base" ]]; then
echo -e "Stage pipeline excludes base image. This is a known difference. Rollout Safe. Verifying sovereign cloud pipeline."
check_sovereign
exit 0
else
echo -e "Publish and stage pipelines inconsistent. Other than the /base image all pipelines should publish the same -appservice images. The following differences exist for -appservice images between the pipelines: "
echo -e ${difference[@]}
exit 1
fi