2
2
3
3
set -eo pipefail
4
4
5
+ # shellcheck disable=SC2155
6
+ export ROOTDIR=$( git rev-parse --show-toplevel || echo " ." )
7
+
8
+ SKOPEO_BIN=skopeo
9
+ if [ -n " $CI " ]; then
10
+ SKOPEO_BIN=" docker run --rm -v $HOME /.docker/config.json:/tmp/auth.json $( grep skopeo " ${ROOTDIR} /tests/Dockerfile" | grep FROM | cut -d ' ' -f 2) "
11
+ fi
12
+
5
13
# # Setup inputs
6
14
7
15
SOURCE_TAG=${SOURCE_TAG:- stable}
@@ -28,17 +36,20 @@ TARGET_OSS_IMAGE_PREFIX=${TARGET_OSS_IMAGE_PREFIX:-"nginx-ic/nginx-ingress"}
28
36
29
37
SOURCE_PLUS_IMAGE_PREFIX=${SOURCE_PLUS_IMAGE_PREFIX:- " nginx-ic/nginx-plus-ingress" }
30
38
SOURCE_NAP_WAF_IMAGE_PREFIX=${SOURCE_NAP_WAF_IMAGE_PREFIX:- " nginx-ic-nap/nginx-plus-ingress" }
39
+ SOURCE_NAP_WAFV5_IMAGE_PREFIX=${SOURCE_NAP_WAFV5_IMAGE_PREFIX:- " nginx-ic-nap-v5/nginx-plus-ingress" }
31
40
SOURCE_NAP_DOS_IMAGE_PREFIX=${SOURCE_NAP_DOS_IMAGE_PREFIX:- " nginx-ic-dos/nginx-plus-ingress" }
32
41
SOURCE_NAP_WAF_DOS_IMAGE_PREFIX=${SOURCE_NAP_WAF_DOS_IMAGE_PREFIX:- " nginx-ic-dos-nap/nginx-plus-ingress" }
33
42
34
43
TARGET_PLUS_IMAGE_PREFIX=${TARGET_PLUS_IMAGE_PREFIX:- " nginx-ic/nginx-plus-ingress" }
35
44
TARGET_NAP_WAF_IMAGE_PREFIX=${TARGET_NAP_WAF_IMAGE_PREFIX:- " nginx-ic-nap/nginx-plus-ingress" }
45
+ TARGET_NAP_WAFV5_IMAGE_PREFIX=${TARGET_NAP_WAFV5_IMAGE_PREFIX:- " nginx-ic-nap/nginx-plus-ingress" }
36
46
TARGET_NAP_DOS_IMAGE_PREFIX=${TARGET_NAP_DOS_IMAGE_PREFIX:- " nginx-ic-dos/nginx-plus-ingress" }
37
47
TARGET_NAP_WAF_DOS_IMAGE_PREFIX=${TARGET_NAP_WAF_DOS_IMAGE_PREFIX:- " nginx-ic-dos-nap/nginx-plus-ingress" }
38
48
39
49
declare -a OSS_TAG_POSTFIX_LIST=(" " " -ubi" " -alpine" )
40
50
declare -a PLUS_TAG_POSTFIX_LIST=(" " " -ubi" " -alpine" " -alpine-fips" )
41
51
declare -a NAP_WAF_TAG_POSTFIX_LIST=(" " " -ubi" " -alpine-fips" )
52
+ declare -a NAP_WAFV5_TAG_POSTFIX_LIST=(" " " -ubi" " -alpine-fips" )
42
53
declare -a NAP_DOS_TAG_POSTFIX_LIST=(" " " -ubi" )
43
54
declare -a NAP_WAF_DOS_TAG_POSTFIX_LIST=(" " " -ubi" )
44
55
declare -a ADDITIONAL_TAGS=(" latest" " ${ADDITIONAL_TAG} " )
@@ -83,7 +94,7 @@ if $PUBLISH_OSS; then
83
94
new_tag=${TARGET_REGISTRY} /${TARGET_OSS_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
84
95
echo " Pushing image OSS ${new_tag} ..."
85
96
if ! $DRY_RUN ; then
86
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
97
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
87
98
fi
88
99
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
89
100
if [ -z " ${tag} " ]; then
@@ -92,7 +103,7 @@ if $PUBLISH_OSS; then
92
103
additional_tag=${TARGET_REGISTRY} /${TARGET_OSS_IMAGE_PREFIX} :${tag}${postfix}
93
104
echo " Pushing image OSS ${additional_tag} ..."
94
105
if ! $DRY_RUN ; then
95
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
106
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
96
107
fi
97
108
done
98
109
done
@@ -105,12 +116,12 @@ if $PUBLISH_PLUS; then
105
116
image=${SOURCE_REGISTRY} /${SOURCE_PLUS_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
106
117
echo " Processing image ${image} "
107
118
new_tag=${TARGET_REGISTRY} /${TARGET_PLUS_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
108
- if $IS_IMMUTABLE && skopeo --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
119
+ if $IS_IMMUTABLE && ${SKOPEO_BIN} --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
109
120
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
110
121
else
111
122
echo " Pushing image Plus ${new_tag} ..."
112
123
if ! $DRY_RUN ; then
113
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
124
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
114
125
fi
115
126
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
116
127
if [ -z " ${tag} " ]; then
@@ -119,7 +130,7 @@ if $PUBLISH_PLUS; then
119
130
additional_tag=${TARGET_REGISTRY} /${TARGET_PLUS_IMAGE_PREFIX} :${tag}${postfix}
120
131
echo " Pushing image Plus ${additional_tag} ..."
121
132
if ! $DRY_RUN ; then
122
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
133
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
123
134
fi
124
135
done
125
136
fi
@@ -133,12 +144,12 @@ if $PUBLISH_WAF; then
133
144
image=${SOURCE_REGISTRY} /${SOURCE_NAP_WAF_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
134
145
echo " Processing image ${image} "
135
146
new_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAF_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
136
- if $IS_IMMUTABLE && skopeo --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
147
+ if $IS_IMMUTABLE && ${SKOPEO_BIN} --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
137
148
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
138
149
else
139
150
echo " Pushing image NAP WAF ${new_tag} ..."
140
151
if ! $DRY_RUN ; then
141
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
152
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
142
153
fi
143
154
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
144
155
if [ -z " ${tag} " ]; then
@@ -147,7 +158,30 @@ if $PUBLISH_WAF; then
147
158
additional_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAF_IMAGE_PREFIX} :${tag}${postfix}
148
159
echo " Pushing image NAP WAF ${additional_tag} ..."
149
160
if ! $DRY_RUN ; then
150
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
161
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
162
+ fi
163
+ done
164
+ fi
165
+ done
166
+ for postfix in " ${NAP_WAFV5_TAG_POSTFIX_LIST[@]} " ; do
167
+ image=${SOURCE_REGISTRY} /${SOURCE_NAP_WAFV5_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
168
+ echo " Processing image ${image} "
169
+ new_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAFV5_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
170
+ if $IS_IMMUTABLE && ${SKOPEO_BIN} --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
171
+ echo " ECR is immutable & tag ${new_tag} already exists, skipping."
172
+ else
173
+ echo " Pushing image NAP WAFV5 ${new_tag} ..."
174
+ if ! $DRY_RUN ; then
175
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
176
+ fi
177
+ for tag in " ${ADDITIONAL_TAGS[@]} " ; do
178
+ if [ -z " ${tag} " ]; then
179
+ continue
180
+ fi
181
+ additional_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAFV5_IMAGE_PREFIX} :${tag}${postfix}
182
+ echo " Pushing image NAP WAFV5 ${additional_tag} ..."
183
+ if ! $DRY_RUN ; then
184
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
151
185
fi
152
186
done
153
187
fi
@@ -161,12 +195,12 @@ if $PUBLISH_DOS; then
161
195
image=${SOURCE_REGISTRY} /${SOURCE_NAP_DOS_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
162
196
echo " Processing image ${image} "
163
197
new_tag=${TARGET_REGISTRY} /${TARGET_NAP_DOS_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
164
- if $IS_IMMUTABLE && skopeo --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
198
+ if $IS_IMMUTABLE && ${SKOPEO_BIN} --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
165
199
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
166
200
else
167
201
echo " Pushing image NAP DOS ${new_tag} ..."
168
202
if ! $DRY_RUN ; then
169
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
203
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
170
204
fi
171
205
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
172
206
if [ -z " ${tag} " ]; then
@@ -175,7 +209,7 @@ if $PUBLISH_DOS; then
175
209
additional_tag=${TARGET_REGISTRY} /${TARGET_NAP_DOS_IMAGE_PREFIX} :${tag}${postfix}
176
210
echo " Pushing image NAP DOS ${additional_tag} ..."
177
211
if ! $DRY_RUN ; then
178
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
212
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
179
213
fi
180
214
done
181
215
fi
@@ -189,12 +223,12 @@ if $PUBLISH_WAF_DOS; then
189
223
image=${SOURCE_REGISTRY} /${SOURCE_NAP_WAF_DOS_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
190
224
echo " Processing image ${image} "
191
225
new_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAF_DOS_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
192
- if $IS_IMMUTABLE && skopeo --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
226
+ if $IS_IMMUTABLE && ${SKOPEO_BIN} --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
193
227
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
194
228
else
195
229
echo " Pushing image NAP WAF/DOS ${new_tag} ..."
196
230
if ! $DRY_RUN ; then
197
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
231
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
198
232
fi
199
233
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
200
234
if [ -z " ${tag} " ]; then
@@ -203,7 +237,7 @@ if $PUBLISH_WAF_DOS; then
203
237
additional_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAF_DOS_IMAGE_PREFIX} :${tag}${postfix}
204
238
echo " Pushing image NAP WAF/DOS ${additional_tag} ..."
205
239
if ! $DRY_RUN ; then
206
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
240
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
207
241
fi
208
242
done
209
243
fi
0 commit comments