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}
@@ -31,22 +39,19 @@ SOURCE_NAP_WAF_IMAGE_PREFIX=${SOURCE_NAP_WAF_IMAGE_PREFIX:-"nginx-ic-nap/nginx-p
31
39
SOURCE_NAP_WAFV5_IMAGE_PREFIX=${SOURCE_NAP_WAFV5_IMAGE_PREFIX:- " nginx-ic-nap-v5/nginx-plus-ingress" }
32
40
SOURCE_NAP_DOS_IMAGE_PREFIX=${SOURCE_NAP_DOS_IMAGE_PREFIX:- " nginx-ic-dos/nginx-plus-ingress" }
33
41
SOURCE_NAP_WAF_DOS_IMAGE_PREFIX=${SOURCE_NAP_WAF_DOS_IMAGE_PREFIX:- " nginx-ic-dos-nap/nginx-plus-ingress" }
34
- SOURCE_NAP_WAFV5_DOS_IMAGE_PREFIX=${SOURCE_NAP_WAFV5_DOS_IMAGE_PREFIX:- " nginx-ic-dos-nap-v5/nginx-plus-ingress" }
35
42
36
43
TARGET_PLUS_IMAGE_PREFIX=${TARGET_PLUS_IMAGE_PREFIX:- " nginx-ic/nginx-plus-ingress" }
37
44
TARGET_NAP_WAF_IMAGE_PREFIX=${TARGET_NAP_WAF_IMAGE_PREFIX:- " nginx-ic-nap/nginx-plus-ingress" }
38
45
TARGET_NAP_WAFV5_IMAGE_PREFIX=${TARGET_NAP_WAFV5_IMAGE_PREFIX:- " nginx-ic-nap/nginx-plus-ingress" }
39
46
TARGET_NAP_DOS_IMAGE_PREFIX=${TARGET_NAP_DOS_IMAGE_PREFIX:- " nginx-ic-dos/nginx-plus-ingress" }
40
47
TARGET_NAP_WAF_DOS_IMAGE_PREFIX=${TARGET_NAP_WAF_DOS_IMAGE_PREFIX:- " nginx-ic-dos-nap/nginx-plus-ingress" }
41
- TARGET_NAP_WAFV5_DOS_IMAGE_PREFIX=${TARGET_NAP_WAFV5_DOS_IMAGE_PREFIX:- " nginx-ic-dos-nap-v5/nginx-plus-ingress" }
42
48
43
49
declare -a OSS_TAG_POSTFIX_LIST=(" " " -ubi" " -alpine" )
44
50
declare -a PLUS_TAG_POSTFIX_LIST=(" " " -ubi" " -alpine" " -alpine-fips" )
45
51
declare -a NAP_WAF_TAG_POSTFIX_LIST=(" " " -ubi" " -alpine-fips" )
46
- declare -a NAP_WAFV5_TAG_POSTFIX_LIST=()
52
+ declare -a NAP_WAFV5_TAG_POSTFIX_LIST=(" " " -ubi " " -alpine-fips " )
47
53
declare -a NAP_DOS_TAG_POSTFIX_LIST=(" " " -ubi" )
48
54
declare -a NAP_WAF_DOS_TAG_POSTFIX_LIST=(" " " -ubi" )
49
- declare -a NAP_WAFV5_DOS_TAG_POSTFIX_LIST=()
50
55
declare -a ADDITIONAL_TAGS=(" latest" " ${ADDITIONAL_TAG} " )
51
56
52
57
CONFIG_PATH=${CONFIG_PATH:- ~/ .nic-release/ config}
@@ -89,7 +94,7 @@ if $PUBLISH_OSS; then
89
94
new_tag=${TARGET_REGISTRY} /${TARGET_OSS_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
90
95
echo " Pushing image OSS ${new_tag} ..."
91
96
if ! $DRY_RUN ; then
92
- 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}
93
98
fi
94
99
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
95
100
if [ -z " ${tag} " ]; then
@@ -98,7 +103,7 @@ if $PUBLISH_OSS; then
98
103
additional_tag=${TARGET_REGISTRY} /${TARGET_OSS_IMAGE_PREFIX} :${tag}${postfix}
99
104
echo " Pushing image OSS ${additional_tag} ..."
100
105
if ! $DRY_RUN ; then
101
- 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}
102
107
fi
103
108
done
104
109
done
@@ -111,12 +116,12 @@ if $PUBLISH_PLUS; then
111
116
image=${SOURCE_REGISTRY} /${SOURCE_PLUS_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
112
117
echo " Processing image ${image} "
113
118
new_tag=${TARGET_REGISTRY} /${TARGET_PLUS_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
114
- 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
115
120
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
116
121
else
117
122
echo " Pushing image Plus ${new_tag} ..."
118
123
if ! $DRY_RUN ; then
119
- 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}
120
125
fi
121
126
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
122
127
if [ -z " ${tag} " ]; then
@@ -125,7 +130,7 @@ if $PUBLISH_PLUS; then
125
130
additional_tag=${TARGET_REGISTRY} /${TARGET_PLUS_IMAGE_PREFIX} :${tag}${postfix}
126
131
echo " Pushing image Plus ${additional_tag} ..."
127
132
if ! $DRY_RUN ; then
128
- 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}
129
134
fi
130
135
done
131
136
fi
@@ -139,12 +144,12 @@ if $PUBLISH_WAF; then
139
144
image=${SOURCE_REGISTRY} /${SOURCE_NAP_WAF_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
140
145
echo " Processing image ${image} "
141
146
new_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAF_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
142
- 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
143
148
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
144
149
else
145
150
echo " Pushing image NAP WAF ${new_tag} ..."
146
151
if ! $DRY_RUN ; then
147
- 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}
148
153
fi
149
154
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
150
155
if [ -z " ${tag} " ]; then
@@ -153,7 +158,7 @@ if $PUBLISH_WAF; then
153
158
additional_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAF_IMAGE_PREFIX} :${tag}${postfix}
154
159
echo " Pushing image NAP WAF ${additional_tag} ..."
155
160
if ! $DRY_RUN ; then
156
- 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}
157
162
fi
158
163
done
159
164
fi
@@ -162,12 +167,12 @@ if $PUBLISH_WAF; then
162
167
image=${SOURCE_REGISTRY} /${SOURCE_NAP_WAFV5_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
163
168
echo " Processing image ${image} "
164
169
new_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAFV5_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
165
- if $IS_IMMUTABLE && skopeo --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
170
+ if $IS_IMMUTABLE && ${SKOPEO_BIN} --override-os linux --override-arch amd64 inspect docker://${new_tag} > /dev/null 2>&1 ; then
166
171
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
167
172
else
168
173
echo " Pushing image NAP WAFV5 ${new_tag} ..."
169
174
if ! $DRY_RUN ; then
170
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
175
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${new_tag}
171
176
fi
172
177
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
173
178
if [ -z " ${tag} " ]; then
@@ -176,7 +181,7 @@ if $PUBLISH_WAF; then
176
181
additional_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAFV5_IMAGE_PREFIX} :${tag}${postfix}
177
182
echo " Pushing image NAP WAFV5 ${additional_tag} ..."
178
183
if ! $DRY_RUN ; then
179
- skopeo copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
184
+ ${SKOPEO_BIN} copy --retry-times 5 ${ARCH_OPTS} ${SOURCE_OPTS} ${TARGET_OPTS} docker://${image} docker://${additional_tag}
180
185
fi
181
186
done
182
187
fi
@@ -190,12 +195,12 @@ if $PUBLISH_DOS; then
190
195
image=${SOURCE_REGISTRY} /${SOURCE_NAP_DOS_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
191
196
echo " Processing image ${image} "
192
197
new_tag=${TARGET_REGISTRY} /${TARGET_NAP_DOS_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
193
- 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
194
199
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
195
200
else
196
201
echo " Pushing image NAP DOS ${new_tag} ..."
197
202
if ! $DRY_RUN ; then
198
- 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}
199
204
fi
200
205
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
201
206
if [ -z " ${tag} " ]; then
@@ -204,7 +209,7 @@ if $PUBLISH_DOS; then
204
209
additional_tag=${TARGET_REGISTRY} /${TARGET_NAP_DOS_IMAGE_PREFIX} :${tag}${postfix}
205
210
echo " Pushing image NAP DOS ${additional_tag} ..."
206
211
if ! $DRY_RUN ; then
207
- 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}
208
213
fi
209
214
done
210
215
fi
@@ -218,12 +223,12 @@ if $PUBLISH_WAF_DOS; then
218
223
image=${SOURCE_REGISTRY} /${SOURCE_NAP_WAF_DOS_IMAGE_PREFIX} :${SOURCE_TAG}${postfix}
219
224
echo " Processing image ${image} "
220
225
new_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAF_DOS_IMAGE_PREFIX} :${TARGET_TAG}${postfix}
221
- 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
222
227
echo " ECR is immutable & tag ${new_tag} already exists, skipping."
223
228
else
224
229
echo " Pushing image NAP WAF/DOS ${new_tag} ..."
225
230
if ! $DRY_RUN ; then
226
- 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}
227
232
fi
228
233
for tag in " ${ADDITIONAL_TAGS[@]} " ; do
229
234
if [ -z " ${tag} " ]; then
@@ -232,7 +237,7 @@ if $PUBLISH_WAF_DOS; then
232
237
additional_tag=${TARGET_REGISTRY} /${TARGET_NAP_WAF_DOS_IMAGE_PREFIX} :${tag}${postfix}
233
238
echo " Pushing image NAP WAF/DOS ${additional_tag} ..."
234
239
if ! $DRY_RUN ; then
235
- 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}
236
241
fi
237
242
done
238
243
fi
0 commit comments