mirror of
https://github.com/containers/skopeo.git
synced 2025-09-02 23:26:29 +00:00
Merge pull request #1104 from cevich/split_quay_envars
Support namespaced logins for quay.io
This commit is contained in:
@@ -4,6 +4,15 @@
|
|||||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
GOARCH ?= $(shell go env GOARCH)
|
GOARCH ?= $(shell go env GOARCH)
|
||||||
|
|
||||||
|
# Dereference variable $(1), return value if non-empty, otherwise raise an error.
|
||||||
|
err_if_empty = $(if $(strip $($(1))),$(strip $($(1))),$(error Required $(1) variable is undefined or empty))
|
||||||
|
|
||||||
|
# Requires two arguments: Names of the username and the password env. vars.
|
||||||
|
define quay_login
|
||||||
|
@echo "$(call err_if_empty,$(2))" | \
|
||||||
|
docker login quay.io -u "$(call err_if_empty,$(1))" --password-stdin
|
||||||
|
endef
|
||||||
|
|
||||||
# Build container image of skopeo upstream based on host architecture
|
# Build container image of skopeo upstream based on host architecture
|
||||||
build-image/upstream:
|
build-image/upstream:
|
||||||
docker build -t "${UPSTREAM_IMAGE}-${GOARCH}" contrib/skopeoimage/upstream
|
docker build -t "${UPSTREAM_IMAGE}-${GOARCH}" contrib/skopeoimage/upstream
|
||||||
@@ -14,27 +23,29 @@ build-image/stable:
|
|||||||
|
|
||||||
# Push container image of skopeo upstream (based on host architecture) to image repository
|
# Push container image of skopeo upstream (based on host architecture) to image repository
|
||||||
push-image/upstream:
|
push-image/upstream:
|
||||||
echo "${QUAY_PASSWORD}" | docker login quay.io -u "${QUAY_USERNAME}" --password-stdin
|
$(call quay_login,SKOPEO_QUAY_USERNAME,SKOPEO_QUAY_PASSWORD)
|
||||||
docker push "${UPSTREAM_IMAGE}-${GOARCH}"
|
docker push "${UPSTREAM_IMAGE}-${GOARCH}"
|
||||||
|
|
||||||
# Push container image of skopeo stable (based on host architecture) to image default and extra repositories
|
# Push container image of skopeo stable (based on host architecture) to image default and extra repositories
|
||||||
push-image/stable:
|
push-image/stable:
|
||||||
echo "${QUAY_PASSWORD}" | docker login quay.io -u "${QUAY_USERNAME}" --password-stdin
|
$(call quay_login,SKOPEO_QUAY_USERNAME,SKOPEO_QUAY_PASSWORD)
|
||||||
docker push "${STABLE_IMAGE}-${GOARCH}"
|
docker push "${STABLE_IMAGE}-${GOARCH}"
|
||||||
docker tag "${STABLE_IMAGE}-${GOARCH}" "${EXTRA_STABLE_IMAGE}-${GOARCH}"
|
docker tag "${STABLE_IMAGE}-${GOARCH}" "${EXTRA_STABLE_IMAGE}-${GOARCH}"
|
||||||
|
$(call quay_login,CONTAINERS_QUAY_USERNAME,CONTAINERS_QUAY_PASSWORD)
|
||||||
docker push "${EXTRA_STABLE_IMAGE}-${GOARCH}"
|
docker push "${EXTRA_STABLE_IMAGE}-${GOARCH}"
|
||||||
|
|
||||||
# Create and push multiarch image manifest of skopeo upstream
|
# Create and push multiarch image manifest of skopeo upstream
|
||||||
push-manifest-multiarch/upstream:
|
push-manifest-multiarch/upstream:
|
||||||
echo "${QUAY_PASSWORD}" | docker login quay.io -u "${QUAY_USERNAME}" --password-stdin
|
|
||||||
docker manifest create "${UPSTREAM_IMAGE}" $(foreach arch,${MULTIARCH_MANIFEST_ARCHITECTURES}, ${UPSTREAM_IMAGE}-${arch})
|
docker manifest create "${UPSTREAM_IMAGE}" $(foreach arch,${MULTIARCH_MANIFEST_ARCHITECTURES}, ${UPSTREAM_IMAGE}-${arch})
|
||||||
|
$(call quay_login,SKOPEO_QUAY_USERNAME,SKOPEO_QUAY_PASSWORD)
|
||||||
docker manifest push --purge "${UPSTREAM_IMAGE}"
|
docker manifest push --purge "${UPSTREAM_IMAGE}"
|
||||||
|
|
||||||
# Create and push multiarch image manifest of skopeo stable
|
# Create and push multiarch image manifest of skopeo stable
|
||||||
push-manifest-multiarch/stable:
|
push-manifest-multiarch/stable:
|
||||||
echo "${QUAY_PASSWORD}" | docker login quay.io -u "${QUAY_USERNAME}" --password-stdin
|
|
||||||
docker manifest create "${STABLE_IMAGE}" $(foreach arch,${MULTIARCH_MANIFEST_ARCHITECTURES}, ${STABLE_IMAGE}-${arch})
|
docker manifest create "${STABLE_IMAGE}" $(foreach arch,${MULTIARCH_MANIFEST_ARCHITECTURES}, ${STABLE_IMAGE}-${arch})
|
||||||
|
$(call quay_login,SKOPEO_QUAY_USERNAME,SKOPEO_QUAY_PASSWORD)
|
||||||
docker manifest push --purge "${STABLE_IMAGE}"
|
docker manifest push --purge "${STABLE_IMAGE}"
|
||||||
# Push to extra repository
|
# Push to extra repository
|
||||||
docker manifest create "${EXTRA_STABLE_IMAGE}" $(foreach arch,${MULTIARCH_MANIFEST_ARCHITECTURES}, ${EXTRA_STABLE_IMAGE}-${arch})
|
docker manifest create "${EXTRA_STABLE_IMAGE}" $(foreach arch,${MULTIARCH_MANIFEST_ARCHITECTURES}, ${EXTRA_STABLE_IMAGE}-${arch})
|
||||||
|
$(call quay_login,CONTAINERS_QUAY_USERNAME,CONTAINERS_QUAY_PASSWORD)
|
||||||
docker manifest push --purge "${EXTRA_STABLE_IMAGE}"
|
docker manifest push --purge "${EXTRA_STABLE_IMAGE}"
|
||||||
|
Reference in New Issue
Block a user