-
Notifications
You must be signed in to change notification settings - Fork 25
/
release_helper.sh
executable file
·126 lines (100 loc) · 3.34 KB
/
release_helper.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
# Set and uncomment these lines to run script
# git_branch=release-1.29.x
# version=1.29.0
# Disable any cloud resource upserts - docker push, gcs upload, etc
dryrun="true"
# Below are unlikely to require changing
bom="output/build_bom/${git_branch}-${version}.yml"
versions_file=versions.yml
bucket=halconfig
registry=us-docker.pkg.dev/spinnaker-community/docker
services=(
"clouddriver"
"deck"
"echo"
"fiat"
"front50"
"gate"
"igor"
"kayenta"
"monitoring_daemon"
"orca"
"rosco"
)
build_bom() {
echo "NOT IMPLEMENTED"
}
build_changelog() {
echo "NOT IMPLEMENTED"
}
upload_bom() {
if [ "${dryrun}" == "true" ]; then
echo "WARNING: not uploading BOM ${version}.yml"
echo gsutil cp "${bom}" "gs://${bucket}/bom/${version}.yml"
return
fi
gsutil cp "${bom}" "gs://${bucket}/bom/${version}.yml"
}
update_versions() {
# add 000 to date to match spinrel code: `lastUpdate = Instant.now().truncatedTo(ChronoUnit.MILLIS)`
echo "lastUpdate: $(date +%s)000"
echo "INCOMPLETE: not updating versions.yml"
}
upload_versions() {
if [ "${dryrun}" == "true" ]; then
echo "WARNING: not uploading versions.yml"
echo gsutil cp "${versions_file}" "gs://${bucket}/versions.yml"
return
fi
gsutil cp "${versions_file}" "gs://${bucket}/versions.yml"
}
generate_version_mappings() {
echo "generating version mapping"
mkdir -p ./input
# convert to json first as can't get yq expression to work
yq -o json <"${bom}" |
# build mapping of service=version to source for tagging
jq -r '.services | keys[] as $key | "\($key)=\(.[$key].version)"' |
# ignore monitoring-third-party
grep -v 'monitoring-third-party' |
sed 's/monitoring-daemon/monitoring_daemon/' \
>./input/mappings.sh
}
tag_containers() {
# shellcheck disable=SC1091
source ./input/mappings.sh
for service in "${services[@]}"; do
tag="${!service}"
if [ "${service}" == "monitoring_daemon" ]; then
# in order to source mappings.sh we had renamed monitoring-daemon to monitoring_daemon
# here we switch it back as the container name is monitoring-daemon
service="monitoring-daemon"
fi
echo -e "\nTagging ${service} containers at '${tag}' and 'spinnaker-${version}'"
echo regctl image copy "${registry}/${service}:${tag}-unvalidated" "${registry}/${service}:${tag}"
echo regctl image copy "${registry}/${service}:${tag}-unvalidated" "${registry}/${service}:spinnaker-${version}"
echo regctl image copy "${registry}/${service}:${tag}-unvalidated-ubuntu" "${registry}/${service}:${tag}-ubuntu"
echo regctl image copy "${registry}/${service}:${tag}-unvalidated-ubuntu" "${registry}/${service}:spinnaker-${version}-ubuntu"
if [ "${dryrun}" == "true" ]; then
echo "WARNING: not pushing containers for ${service}"
continue
fi
regctl image copy "${registry}/${service}:${tag}-unvalidated" "${registry}/${service}:${tag}"
regctl image copy "${registry}/${service}:${tag}-unvalidated" "${registry}/${service}:spinnaker-${version}"
regctl image copy "${registry}/${service}:${tag}-unvalidated-ubuntu" "${registry}/${service}:${tag}-ubuntu"
regctl image copy "${registry}/${service}:${tag}-unvalidated-ubuntu" "${registry}/${service}:spinnaker-${version}-ubuntu"
echo -e "\n"
done
}
main() {
build_bom
build_changelog
generate_version_mappings
tag_containers
upload_bom
update_versions
upload_versions
}
main