@@ -259,11 +259,12 @@ copy_logs_to_workdir () {
259
259
}
260
260
261
261
# ##############################################################################
262
- # Ensures we have write access to a specified registry
263
- # @param registry - A registry to check the ACLs for
262
+ # Ensures all registries that will be used during both mock and --nomock
263
+ # runs allow write access so we don't fall over later
264
+ # @param registries - A space separated list of registries
264
265
#
265
266
ensure_registry_acls () {
266
- local registry= " $1 "
267
+ local registries=( $1 )
267
268
local emptyfile=" $TMPDIR /empty-file.$$ "
268
269
local gs_path
269
270
local r
@@ -275,30 +276,27 @@ ensure_registry_acls () {
275
276
276
277
# Short of creating a hardcoded map of project-id to registry, translating
277
278
# _ to - seems to be a simple rule to keep this, well, simple.
278
- r=${registry// _/ -}
279
-
280
- # When we are no-mock mode we need to perform an image promotion, so it's
281
- # unnecessary to check for write access to the production container registry.
282
- if (( FLAGS_nomock)) ; then
283
- logecho -n " Skipping container registry ACL check on $GCRIO_PATH_PROD in no-mock mode: "
284
- logecho $OK
285
- return 0
286
- else
287
- artifact_namespace=" ${r/ gcr.io\/ / } "
288
- fi
279
+ for r in ${registries[*]// _/ -} ; do
280
+ # In this context, "google-containers" is still used
281
+ if [[ " $r " == " $GCRIO_PATH_PROD " ]]; then
282
+ artifact_namespace=" google-containers"
283
+ else
284
+ artifact_namespace=" ${r/ gcr.io\/ / } "
285
+ fi
289
286
290
- gs_path=" gs://artifacts.$artifact_namespace .appspot.com/containers"
291
- logecho -n " Checking write access to registry $r : "
292
- if logrun $GSUTIL -q cp $emptyfile $gs_path && \
293
- logrun $GSUTIL -q rm $gs_path /${emptyfile##*/ } ; then
294
- logecho $OK
295
- else
296
- logecho $FAILED
297
- (( retcode++ ))
298
- fi
287
+ gs_path=" gs://artifacts.$artifact_namespace .appspot.com/containers"
288
+ logecho -n " Checking write access to registry $r : "
289
+ if logrun $GSUTIL -q cp $emptyfile $gs_path && \
290
+ logrun $GSUTIL -q rm $gs_path /${emptyfile##*/ } ; then
291
+ logecho $OK
292
+ else
293
+ logecho $FAILED
294
+ (( retcode++ ))
295
+ fi
299
296
300
- # Always reset back to $USER
301
- (( FLAGS_gcb)) || logrun $GCLOUD config set account $GCP_USER
297
+ # Always reset back to $USER
298
+ (( FLAGS_gcb)) || logrun $GCLOUD config set account $GCP_USER
299
+ done
302
300
303
301
logrun rm -f $emptyfile
304
302
@@ -380,7 +378,7 @@ check_prerequisites () {
380
378
381
379
# Verify write access to all container registries that might be used
382
380
# to ensure both mock and --nomock runs will work.
383
- ensure_registry_acls " $GCRIO_PATH " || return 1
381
+ ensure_registry_acls " ${ALL_CONTAINER_REGISTRIES[*]} " || return 1
384
382
385
383
logecho -n " Checking cloud project state: "
386
384
GCLOUD_PROJECT=$( $GCLOUD config get-value project 2> /dev/null)
@@ -1446,13 +1444,8 @@ push_all_artifacts () {
1446
1444
gs://$RELEASE_BUCKET /$BUCKET_TYPE /$version || return 1
1447
1445
fi
1448
1446
1449
- # When we are no-mock mode we need to perform an image promotion, so
1450
- # instead of pushing to the production container registry, we validate
1451
- # that the manifest is populated on the remote registry.
1452
- if ! (( FLAGS_nomock)) ; then
1453
- common::runstep release::docker::release \
1447
+ common::runstep release::docker::release \
1454
1448
$KUBE_DOCKER_REGISTRY $version $BUILD_OUTPUT -$version || return 1
1455
- fi
1456
1449
1457
1450
common::runstep release::docker::validate_remote_manifests \
1458
1451
$KUBE_DOCKER_REGISTRY $version $BUILD_OUTPUT -$version || return 1
0 commit comments