diff --git a/.ci/sync-all.sh b/.ci/sync-all.sh index 37e5554..c63c2ca 100755 --- a/.ci/sync-all.sh +++ b/.ci/sync-all.sh @@ -10,8 +10,25 @@ set -ef . .ci/envsh.common . .ci/envsh.registry +r=0 + +image_src="docker://${IMAGE_NAME}" +image_dst="docker://${EXT_IMAGE_NAME}" + +oci_dir="$PWD/oci-layers" +image_interim="oci:${oci_dir}:$(basename "${IMAGE_NAME}")" + for tag in ${IMAGE_TAG} ${EXTRA_TAGS} ; do [ -n "${tag}" ] || continue - skopeo copy --all "docker://${IMAGE_NAME}:${tag}" "docker://${EXT_IMAGE_NAME}:${tag}" + rm -rf "${oci_dir}" ; mkdir "${oci_dir}" + + skopeo copy --all "${image_src}:${tag}" "${image_interim}:${tag}" || r=$? + [ "$r" = 0 ] || break + + skopeo copy --all "${image_interim}:${tag}" "${image_dst}:${tag}" || r=$? + [ "$r" = 0 ] || break done + +rm -rf "${oci_dir}" +exit "$r" diff --git a/.woodpecker/.sync.yml b/.woodpecker/.sync.yml deleted file mode 100644 index 291d660..0000000 --- a/.woodpecker/.sync.yml +++ /dev/null @@ -1,36 +0,0 @@ -when: - - event: [ manual ] - evaluate: 'CI_DEBUG == "sync"' - -variables: - - &image_name 'quay.krd.sh/krd/woodpecker-sonatype-nexus' - - &ext_image_name 'docker.io/rockdrilla/woodpecker-sonatype-nexus' - - &skopeo_image 'quay.krd.sh/quay_io/containers/skopeo:v1.15.0' - -## kind of fixup (remove in near future) -## ref: https://github.com/woodpecker-ci/plugin-git/releases -clone: - git: - image: quay.krd.sh/docker_io/woodpeckerci/plugin-git:2.5.0 - -## NB: ${variable} expressions are subject to pre-processing. -## ref: https://woodpecker-ci.org/docs/usage/environment - -steps: - - - name: image-sync - image: *skopeo_image - environment: - GOMAXPROCS: "4" - MALLOC_ARENA_MAX: "4" - ## - IMAGE_NAME: *image_name - EXT_IMAGE_NAME: *ext_image_name - secrets: [ REGISTRY_AUTH ] - commands: - - .ci/registry-login.sh quay.krd.sh docker.io - - .ci/sync-all.sh - -## personal tweaks :) -labels: - network: dmz