diff --git a/Dockerfile-release b/Dockerfile-release.amd64 similarity index 100% rename from Dockerfile-release rename to Dockerfile-release.amd64 diff --git a/scripts/build-binary b/scripts/build-binary index 5bc31cc49..bfd80408b 100755 --- a/scripts/build-binary +++ b/scripts/build-binary @@ -84,7 +84,7 @@ function main { export GOARCH=${TARGET_ARCH} pushd etcd >/dev/null - GO_LDFLAGS="-s" ./build + GO_LDFLAGS="-s" ./build.sh popd >/dev/null TARGET="etcd-${VER}-${GOOS}-${GOARCH}" diff --git a/scripts/build-docker b/scripts/build-docker index e32aedd9c..bc5fd7a10 100755 --- a/scripts/build-docker +++ b/scripts/build-docker @@ -7,9 +7,9 @@ if [ "$#" -ne 1 ]; then exit 1 fi -VERSION=${1} ARCH=$(go env GOARCH) -DOCKERFILE="Dockerfile-release" +VERSION="${1}-${ARCH}" +DOCKERFILE="Dockerfile-release.${ARCH}" if [ -z "${BINARYDIR}" ]; then RELEASE="etcd-${1}"-$(go env GOOS)-$(go env GOARCH) @@ -23,11 +23,6 @@ if [ -z "${BINARYDIR}" ]; then tar -zvxf "${TARFILE}" fi -if [ "${ARCH}" != "amd64" ]; then - DOCKERFILE+=".${ARCH}" - VERSION+="-${ARCH}" -fi - BINARYDIR=${BINARYDIR:-.} BUILDDIR=${BUILDDIR:-.} diff --git a/scripts/release b/scripts/release index 35084c810..c36e0f48f 100755 --- a/scripts/release +++ b/scripts/release @@ -35,6 +35,9 @@ main() { BRANCH=${BRANCH:-"release-${MINOR_VERSION}"} REPOSITORY=${REPOSITORY:-"https://github.com/etcd-io/etcd"} + # Required to enable 'docker manifest ...' + export DOCKER_CLI_EXPERIMENTAL=enabled + if ! command -v docker >/dev/null; then echo "cannot find docker" exit 1 @@ -191,20 +194,29 @@ main() { done gcloud docker -- login -u _json_key -p "$(cat /etc/gcp-key-etcd-development.json)" https://gcr.io - echo "Pushing container images to quay.io ${RELEASE_VERSION}" - docker push "quay.io/coreos/etcd:${RELEASE_VERSION}" + # NB: `docker manifest create` insists on at least one manifest. + # We overwrite it later with --amend anyway. + docker manifest create "quay.io/coreos/etcd:${RELEASE_VERSION}" "quay.io/coreos/etcd:${RELEASE_VERSION}-amd64" + docker manifest create "gcr.io/etcd-development/etcd:${RELEASE_VERSION}" "gcr.io/etcd-development/etcd:${RELEASE_VERSION}-amd64" - echo "Pushing container images to gcr.io ${RELEASE_VERSION}" - gcloud docker -- push "gcr.io/etcd-development/etcd:${RELEASE_VERSION}" + for TARGET_ARCH in "amd64" "arm64" "ppc64le" "s390x"; do + echo "Pushing container images to quay.io ${RELEASE_VERSION}-${TARGET_ARCH}" + docker push "quay.io/coreos/etcd:${RELEASE_VERSION}-${TARGET_ARCH}" + docker manifest create --amend "quay.io/coreos/etcd:${RELEASE_VERSION}" "quay.io/coreos/etcd:${RELEASE_VERSION}-${TARGET_ARCH}" + docker manifest annotate "quay.io/coreos/etcd:${RELEASE_VERSION}" "quay.io/coreos/etcd:${RELEASE_VERSION}-${TARGET_ARCH}" --arch "${TARGET_ARCH}" - for TARGET_ARCH in "-arm64" "-ppc64le" "-s390x"; do - echo "Pushing container images to quay.io ${RELEASE_VERSION}${TARGET_ARCH}" - docker push "quay.io/coreos/etcd:${RELEASE_VERSION}${TARGET_ARCH}" - - echo "Pushing container images to gcr.io ${RELEASE_VERSION}${TARGET_ARCH}" - gcloud docker -- push "gcr.io/etcd-development/etcd:${RELEASE_VERSION}${TARGET_ARCH}" + echo "Pushing container images to gcr.io ${RELEASE_VERSION}-${TARGET_ARCH}" + gcloud docker -- push "gcr.io/etcd-development/etcd:${RELEASE_VERSION}-${TARGET_ARCH}" + docker manifest create --amend "gcr.io/etcd-development/etcd:${RELEASE_VERSION}" "gcr.io/etcd-development/etcd:${RELEASE_VERSION}-${TARGET_ARCH}" + docker manifest annotate "gcr.io/etcd-development/etcd:${RELEASE_VERSION}" "gcr.io/etcd-development/etcd:${RELEASE_VERSION}-${TARGET_ARCH}" --arch "${TARGET_ARCH}" done + echo "Pushing container manifest list to quay.io ${RELEASE_VERSION}" + docker manifest push "quay.io/coreos/etcd:${RELEASE_VERSION}" + + echo "Pushing container manifest list to gcr.io ${RELEASE_VERSION}" + gcloud docker -- manifest push "gcr.io/etcd-development/etcd:${RELEASE_VERSION}" + echo "Setting permissions using gsutil..." gsutil -m acl ch -u allUsers:R -r gs://artifacts.etcd-development.appspot.com fi