diff --git a/.ci/sync-all.sh b/.ci/sync-all.sh index ef026c7..9db65d5 100755 --- a/.ci/sync-all.sh +++ b/.ci/sync-all.sh @@ -5,13 +5,14 @@ set -ef [ -z "${CI_DEBUG}" ] || set -xv -: "${IMAGE_NAME:?}" "${EXT_IMAGE_NAME:?}" +: "${IMAGE_NAME:?}" + +[ -n "${EXTRA_TAGS}" ] || exit 0 . .ci/envsh.common . .ci/envsh.registry image_src="docker://${IMAGE_NAME}" -image_dst="docker://${EXT_IMAGE_NAME}" oci_dir="${PWD}/oci-layers" image_interim="oci:${oci_dir}:$(basename "${IMAGE_NAME}"):${IMAGE_TAG}" @@ -33,20 +34,12 @@ while : ; do img_copy "${image_src}:${IMAGE_TAG}" "${image_interim}" || r=$? [ "$r" = 0 ] || break - echo " -> ${image_dst}:${IMAGE_TAG}" - img_copy "${image_interim}" "${image_dst}:${IMAGE_TAG}" || r=$? - [ "$r" = 0 ] || break - for tag in ${EXTRA_TAGS} ; do [ -n "${tag}" ] || continue echo " -> ${image_src}:${tag}" img_copy "${image_interim}" "${image_src}:${tag}" || r=$? [ "$r" = 0 ] || break - - echo " -> ${image_dst}:${tag}" - img_copy "${image_interim}" "${image_dst}:${tag}" || r=$? - [ "$r" = 0 ] || break done break diff --git a/.ci/sync-latest.sh b/.ci/sync-latest.sh index bd986f9..91f991b 100755 --- a/.ci/sync-latest.sh +++ b/.ci/sync-latest.sh @@ -5,12 +5,11 @@ set -ef [ -z "${CI_DEBUG}" ] || set -xv -: "${IMAGE_NAME:?}" "${EXT_IMAGE_NAME:?}" "${LATEST_TAG:?}" +: "${IMAGE_NAME:?}" "${LATEST_TAG:?}" . .ci/envsh.registry image_src="docker://${IMAGE_NAME}" -image_dst="docker://${EXT_IMAGE_NAME}" oci_dir="${PWD}/oci-layers" image_interim="oci:${oci_dir}:$(basename "${IMAGE_NAME}"):${LATEST_TAG}" @@ -36,10 +35,6 @@ while : ; do img_copy "${image_interim}" "${image_src}:latest" || r=$? [ "$r" = 0 ] || break - echo " -> ${image_dst}:latest" - img_copy "${image_interim}" "${image_dst}:latest" || r=$? - [ "$r" = 0 ] || break - break done diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 2492e47..fe1e078 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -3,12 +3,11 @@ when: evaluate: 'LATEST_TAG == ""' variables: - - &image_name 'quay.krd.sh/krd/rngpotd' - - &ext_image_name 'docker.io/rockdrilla/rngpotd' - - &buildah_image 'quay.krd.sh/quay_io/containers/buildah:v1.37.3' - - &skopeo_image 'quay.krd.sh/quay_io/containers/skopeo:v1.16.1' - - &go_image 'quay.krd.sh/golang:1.23.2-bookworm' - - &base_image 'quay.krd.sh/gcr_io/distroless/static-debian12:nonroot' + - &image_name 'docker.io/rockdrilla/rngpotd' + - &buildah_image 'quay.io/containers/buildah:v1.37.3' + - &skopeo_image 'quay.io/containers/skopeo:v1.16.1' + - &go_image 'docker.io/library/golang:1.23.2-bookworm' + - &base_image 'gcr.io/distroless/static-debian12:nonroot' ## value list depends on base image ## ref: https://github.com/GoogleContainerTools/distroless#debian-12 - &target_platforms 'linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x' @@ -23,16 +22,15 @@ steps: environment: GOMAXPROCS: "4" MALLOC_ARENA_MAX: "4" - secrets: [ REGISTRY_AUTH ] + ## + REGISTRY_AUTH: + from_secret: REGISTRY_AUTH commands: - - .ci/registry-login.sh quay.krd.sh docker.io + - .ci/registry-login.sh docker.io - name: build-all image: *go_image environment: - GOPROXY: "${GOPROXY},direct" - GOSUMDB: "${GOSUMDB}" - GOPRIVATE: "${GOPRIVATE}" GOMAXPROCS: "4" MALLOC_ARENA_MAX: "4" ## @@ -62,7 +60,6 @@ steps: MALLOC_ARENA_MAX: "4" ## IMAGE_NAME: *image_name - EXT_IMAGE_NAME: *ext_image_name commands: - .ci/sync-all.sh diff --git a/.woodpecker/.latest.yml b/.woodpecker/.latest.yml index 7c380ce..140c875 100644 --- a/.woodpecker/.latest.yml +++ b/.woodpecker/.latest.yml @@ -3,9 +3,8 @@ when: evaluate: 'LATEST_TAG != ""' variables: - - &image_name 'quay.krd.sh/krd/rngpotd' - - &ext_image_name 'docker.io/rockdrilla/rngpotd' - - &skopeo_image 'quay.krd.sh/quay_io/containers/skopeo:v1.16.1' + - &image_name 'docker.io/rockdrilla/rngpotd' + - &skopeo_image 'quay.io/containers/skopeo:v1.16.1' ## NB: ${variable} expressions are subject to pre-processing. ## ref: https://woodpecker-ci.org/docs/usage/environment @@ -17,9 +16,11 @@ steps: environment: GOMAXPROCS: "4" MALLOC_ARENA_MAX: "4" - secrets: [ REGISTRY_AUTH ] + ## + REGISTRY_AUTH: + from_secret: REGISTRY_AUTH commands: - - .ci/registry-login.sh quay.krd.sh docker.io + - .ci/registry-login.sh docker.io - name: image-sync-latest image: *skopeo_image @@ -28,7 +29,6 @@ steps: MALLOC_ARENA_MAX: "4" ## IMAGE_NAME: *image_name - EXT_IMAGE_NAME: *ext_image_name commands: - .ci/sync-latest.sh diff --git a/Dockerfile b/Dockerfile index 7a0bb70..2128aa5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ COPY . . ENV GOMAXPROCS=4 \ MALLOC_ARENA_MAX=4 -RUN go env | grep -F -e GOPROXY -e GOSUMDB ; \ +RUN go env | grep -F -e GOPROXY -e GOSUMDB -e GOPRIVATE ; \ make OUTDIR=/go/bin ; \ make ci-clean