Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scripts/release.sh to push to artifact registry #19250

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Documentation/contributor-guide/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ which don't need to be executed before releasing each version.
4. Authenticate the image registry, refer to [Authentication methods](https://cloud.google.com/container-registry/docs/advanced-authentication).
- `gcloud auth login`
- `gcloud auth configure-docker`
- `gcloud auth configure-docker us-docker.pkg.dev`
5. Install gh, refer to [GitHub's documentation](https://github.com/cli/cli#installation). Ensure that running
`gh auth login` succeeds for the GitHub account you use to contribute to etcd,
and that `gh auth status` has a clean exit and doesn't show any issues.
Expand All @@ -73,6 +74,7 @@ which don't need to be executed before releasing each version.
3. Once permissions are elevated, temporarily relax [branch protections](https://github.com/etcd-io/etcd/settings/branches) to allow pushing changes directly to `release-*` branches in GitHub.
4. Verify you can pass the authentication to the image registries,
- `docker login gcr.io`
- `docker login us-docker.pkg.dev`
- `docker login quay.io`
- If the release person doesn't have access to 1password, one of the owners (@ahrtr, @ivanvc, @jmhbnz, @serathius) needs to share the password with them per [this guide](https://support.1password.com/share-items/). See rough steps below,
- [Sign in](https://team-etcd.1password.com/home) to your account on 1password.com.
Expand Down
1 change: 1 addition & 0 deletions scripts/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if [ -z "${TAG:-}" ]; then
# From https://stackoverflow.com/q/72144329/
DOCKER_BUILDKIT=1 docker build --build-arg="ARCH=${ARCH}" -t "gcr.io/etcd-development/etcd:${VERSION}" "${IMAGEDIR}"
DOCKER_BUILDKIT=1 docker build --build-arg="ARCH=${ARCH}" -t "quay.io/coreos/etcd:${VERSION}" "${IMAGEDIR}"
DOCKER_BUILDKIT=1 docker build --build-arg="ARCH=${ARCH}" -t "us-docker.pkg.dev/etcd-development/etcd/etcd:${VERSION}" "${IMAGEDIR}"
else
docker build -t "${TAG}:${VERSION}" "${IMAGEDIR}"
fi
10 changes: 9 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ main() {
if [ "${DRY_RUN}" == "true" ] || [ "${NO_DOCKER_PUSH}" == 1 ]; then
log_callout "Skipping docker push. --no-docker-push flat is set."
else
read -p "Publish etcd ${RELEASE_VERSION} docker images to quay.io [y/N]? " -r confirm
read -p "Publish etcd ${RELEASE_VERSION} docker images to quay.io, gcr.io & artifact registry [y/N]? " -r confirm
[[ "${confirm,,}" == "y" ]] || exit 1
# shellcheck disable=SC2034
for i in {1..5}; do
Expand All @@ -281,6 +281,8 @@ main() {
maybe_run docker push "quay.io/coreos/etcd:${RELEASE_VERSION}-${TARGET_ARCH}"
log_callout "Pushing container images to gcr.io ${RELEASE_VERSION}-${TARGET_ARCH}"
maybe_run docker push "gcr.io/etcd-development/etcd:${RELEASE_VERSION}-${TARGET_ARCH}"
log_callout "Pushing container images to artifact registry ${RELEASE_VERSION}-${TARGET_ARCH}"
maybe_run docker push "us-docker.pkg.dev/etcd-development/etcd/etcd:${RELEASE_VERSION}-${TARGET_ARCH}"
done

log_callout "Creating manifest-list (multi-image)..."
Expand All @@ -291,13 +293,19 @@ main() {

maybe_run docker manifest create --amend "gcr.io/etcd-development/etcd:${RELEASE_VERSION}" "gcr.io/etcd-development/etcd:${RELEASE_VERSION}-${TARGET_ARCH}"
maybe_run docker manifest annotate "gcr.io/etcd-development/etcd:${RELEASE_VERSION}" "gcr.io/etcd-development/etcd:${RELEASE_VERSION}-${TARGET_ARCH}" --arch "${TARGET_ARCH}"

maybe_run docker manifest create --amend "us-docker.pkg.dev/etcd-development/etcd/etcd:${RELEASE_VERSION}" "us-docker.pkg.dev/etcd-development/etcd/etcd:${RELEASE_VERSION}-${TARGET_ARCH}"
maybe_run docker manifest annotate "us-docker.pkg.dev/etcd-development/etcd/etcd:${RELEASE_VERSION}" "us-docker.pkg.dev/etcd-development/etcd/etcd:${RELEASE_VERSION}-${TARGET_ARCH}" --arch "${TARGET_ARCH}"
done

log_callout "Pushing container manifest list to quay.io ${RELEASE_VERSION}"
maybe_run docker manifest push "quay.io/coreos/etcd:${RELEASE_VERSION}"

log_callout "Pushing container manifest list to gcr.io ${RELEASE_VERSION}"
maybe_run docker manifest push "gcr.io/etcd-development/etcd:${RELEASE_VERSION}"

log_callout "Pushing container manifest list to artifact registry ${RELEASE_VERSION}"
maybe_run docker manifest push "us-docker.pkg.dev/etcd-development/etcd/etcd:${RELEASE_VERSION}"
fi

### Release validation
Expand Down
20 changes: 10 additions & 10 deletions scripts/release_notes.tpl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ mv /tmp/etcd-${ETCD_VER}-darwin-amd64/* /tmp/etcd-download-test && rm -rf mv /tm

###### Docker

etcd uses [`gcr.io/etcd-development/etcd`](https://gcr.io/etcd-development/etcd) as a primary container registry, and [`quay.io/coreos/etcd`](https://quay.io/coreos/etcd) as secondary.
etcd uses [`us-docker.pkg.dev/etcd-development/etcd/etcd`](https://console.cloud.google.com/artifacts/docker/etcd-development/us/etcd) as a primary container registry, and [`quay.io/coreos/etcd`](https://quay.io/coreos/etcd) as secondary.

```sh
ETCD_VER=${RELEASE_VERSION}

rm -rf /tmp/etcd-data.tmp && mkdir -p /tmp/etcd-data.tmp && \
docker rmi gcr.io/etcd-development/etcd:${ETCD_VER} || true && \
docker rmi us-docker.pkg.dev/etcd-development/etcd/etcd:${ETCD_VER} || true && \
docker run \
-p 2379:2379 \
-p 2380:2380 \
--mount type=bind,source=/tmp/etcd-data.tmp,destination=/etcd-data \
--name etcd-gcr-${ETCD_VER} \
gcr.io/etcd-development/etcd:${ETCD_VER} \
--name etcd-${ETCD_VER} \
us-docker.pkg.dev/etcd-development/etcd/etcd:${ETCD_VER} \
/usr/local/bin/etcd \
--name s1 \
--data-dir /etcd-data \
Expand All @@ -82,10 +82,10 @@ rm -rf /tmp/etcd-data.tmp && mkdir -p /tmp/etcd-data.tmp && \
--logger zap \
--log-outputs stderr

docker exec etcd-gcr-${ETCD_VER} /usr/local/bin/etcd --version
docker exec etcd-gcr-${ETCD_VER} /usr/local/bin/etcdctl version
docker exec etcd-gcr-${ETCD_VER} /usr/local/bin/etcdutl version
docker exec etcd-gcr-${ETCD_VER} /usr/local/bin/etcdctl endpoint health
docker exec etcd-gcr-${ETCD_VER} /usr/local/bin/etcdctl put foo bar
docker exec etcd-gcr-${ETCD_VER} /usr/local/bin/etcdctl get foo
docker exec etcd-${ETCD_VER} /usr/local/bin/etcd --version
docker exec etcd-${ETCD_VER} /usr/local/bin/etcdctl version
docker exec etcd-${ETCD_VER} /usr/local/bin/etcdutl version
docker exec etcd-${ETCD_VER} /usr/local/bin/etcdctl endpoint health
docker exec etcd-${ETCD_VER} /usr/local/bin/etcdctl put foo bar
docker exec etcd-${ETCD_VER} /usr/local/bin/etcdctl get foo
```
2 changes: 1 addition & 1 deletion scripts/test_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fi

# Pick defaults based on release workflow
ARCH=$(go env GOARCH)
REPOSITARY=${REPOSITARY:-"gcr.io/etcd-development/etcd"}
REPOSITARY=${REPOSITARY:-"us-docker.pkg.dev/etcd-development/etcd/etcd"}
if [ -n "$VERSION" ]; then
# Expected Format: v3.6.99-amd64
TAG=v"${VERSION}"-"${ARCH}"
Expand Down
Loading