From 8793b4eeeaa4d61601c2e67aa96663477b2e9d35 Mon Sep 17 00:00:00 2001 From: Alex Couture-Beil Date: Wed, 22 May 2024 13:21:12 -0700 Subject: [PATCH] release.sh: build and push new experimental buildkit branch (#4117) This builds and pushes the new experimental buildkit branch (earthly-next) to the a new earthly/buildkitd tag with the `-ticktock` codename suffix. --------- Signed-off-by: Alex Couture-Beil --- .github/workflows/ci-staging-deploy.yml | 1 + earthly-next | 1 + release/Earthfile | 18 +++++++++++++++ release/release.sh | 30 +++++++++++++++++++++++-- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 earthly-next diff --git a/.github/workflows/ci-staging-deploy.yml b/.github/workflows/ci-staging-deploy.yml index 452f6d56..0142ff47 100644 --- a/.github/workflows/ci-staging-deploy.yml +++ b/.github/workflows/ci-staging-deploy.yml @@ -72,6 +72,7 @@ jobs: export SHA_DEC="$(echo "ibase=16; $(git rev-parse --short HEAD | tr '[:lower:]' '[:upper:]')" | bc)" export RELEASE_TAG="v0.$(date +%s).$SHA_DEC" export SKIP_CHANGELOG_DATE_TEST=true + export EARTHLY_STAGING=true export S3_BUCKET="staging-pkg" export earthly="./build/linux/amd64/earthly" echo "attempting staging-release version: $RELEASE_TAG" diff --git a/earthly-next b/earthly-next new file mode 100644 index 00000000..881ef16c --- /dev/null +++ b/earthly-next @@ -0,0 +1 @@ +d4e630c482bde6e4f6da3d2257ee6e8d9955f180 diff --git a/release/Earthfile b/release/Earthfile index b8f3e21c..ba70f4aa 100644 --- a/release/Earthfile +++ b/release/Earthfile @@ -34,6 +34,16 @@ release-dockerhub: --PUSH_PRERELEASE_TAG="$PUSH_PRERELEASE_TAG" perform-release-dockerhub: + ARG --required RELEASE_TAG + ARG PUSH_LATEST_TAG="false" + ARG PUSH_PRERELEASE_TAG="false" + ARG DOCKERHUB_USER="earthly" + ARG DOCKERHUB_IMG="earthly" + ARG DOCKERHUB_BUILDKIT_IMG="buildkitd" + BUILD +perform-release-earthly-dockerhub + BUILD +perform-release-buildkitd-dockerhub + +perform-release-earthly-dockerhub: ARG --required RELEASE_TAG ARG PUSH_LATEST_TAG="false" ARG PUSH_PRERELEASE_TAG="false" @@ -49,6 +59,14 @@ perform-release-dockerhub: --DOCKERHUB_IMG="$DOCKERHUB_IMG" \ --PUSH_LATEST_TAG="$PUSH_LATEST_TAG" \ --PUSH_PRERELEASE_TAG="$PUSH_PRERELEASE_TAG" + +perform-release-buildkitd-dockerhub: + ARG --required RELEASE_TAG + ARG PUSH_LATEST_TAG="false" + ARG PUSH_PRERELEASE_TAG="false" + ARG DOCKERHUB_USER="earthly" + ARG DOCKERHUB_IMG="earthly" + ARG DOCKERHUB_BUILDKIT_IMG="buildkitd" BUILD \ --platform=linux/amd64 \ --platform=linux/arm64 \ diff --git a/release/release.sh b/release/release.sh index 0bbe4799..a6e3e8f8 100755 --- a/release/release.sh +++ b/release/release.sh @@ -71,6 +71,7 @@ export GITHUB_SECRET_PATH=$GITHUB_SECRET_PATH export PRERELEASE=${PRERELEASE:-true} export SKIP_CHANGELOG_DATE_TEST=${SKIP_CHANGELOG_DATE_TEST:-false} export S3_BUCKET=${S3_BUCKET:-production-pkg} +export EARTHLY_STAGING=${EARTHLY_STAGING:-false} if [ "$PRERELEASE" != "false" ] && [ "$PRERELEASE" != "true" ]; then @@ -133,14 +134,39 @@ if [ "$PRERELEASE" = "true" ] || [ "$PRODUCTION_RELEASE" != "true" ]; then PUSH_LATEST_TAG="false" fi -"$earthly" --push --build-arg DOCKERHUB_USER --build-arg DOCKERHUB_IMG --build-arg DOCKERHUB_BUILDKIT_IMG --build-arg RELEASE_TAG +release-dockerhub --PUSH_PRERELEASE_TAG="$PRERELEASE" --PUSH_LATEST_TAG="$PUSH_LATEST_TAG" -"$earthly" --push --build-arg GITHUB_USER --build-arg EARTHLY_REPO --build-arg BREW_REPO --build-arg DOCKERHUB_USER --build-arg DOCKERHUB_BUILDKIT_IMG --build-arg RELEASE_TAG --build-arg SKIP_CHANGELOG_DATE_TEST --build-arg PRERELEASE $GITHUB_SECRET_PATH_BUILD_ARG +release-github +GITHUB_PRERELEASE="$PRERELEASE" +if [ "$EARTHLY_STAGING" = "true" ]; then + # special case to ensure https://github.com/earthly/earthly-staging/releases/latest/download/earthly-linux-amd64 is kept up to date + GITHUB_PRERELEASE="true" + + # make sure we aren't accidentally doing a regular release + if [ "$PUSH_LATEST_TAG" = "true" ]; then + echo "something is wrong; PUSH_LATEST_TAG should be false" + exit 1 + fi +fi + +earthlynext="$(cat ../earthly-next)" +if [[ ! "$earthlynext" =~ ^[a-zA-Z0-9]{40}$ ]]; then + echo "../earthly-next does not contain a valid git commit hash; got $earthlynext" + exit 1 +fi +echo "earthlynext is $earthlynext" + +"$earthly" --push --build-arg DOCKERHUB_USER --build-arg DOCKERHUB_IMG --build-arg DOCKERHUB_BUILDKIT_IMG +release-dockerhub --PUSH_PRERELEASE_TAG="$PRERELEASE" --PUSH_LATEST_TAG="$PUSH_LATEST_TAG" --RELEASE_TAG="$RELEASE_TAG" +"$earthly" --push --build-arg DOCKERHUB_USER --build-arg DOCKERHUB_IMG --build-arg DOCKERHUB_BUILDKIT_IMG +perform-release-buildkitd-dockerhub --PUSH_PRERELEASE_TAG="$PRERELEASE" --PUSH_LATEST_TAG="false" --RELEASE_TAG="$RELEASE_TAG-ticktock" --BUILDKIT_PROJECT=github.com/earthly/buildkit:$earthlynext +"$earthly" --push --build-arg GITHUB_USER --build-arg EARTHLY_REPO --build-arg BREW_REPO --build-arg DOCKERHUB_USER --build-arg DOCKERHUB_BUILDKIT_IMG --build-arg RELEASE_TAG --build-arg SKIP_CHANGELOG_DATE_TEST $GITHUB_SECRET_PATH_BUILD_ARG +release-github --PRERELEASE="$GITHUB_PRERELEASE" if [ "$PRERELEASE" != "false" ]; then echo "exiting due to PRERELEASE=$PRERELEASE" exit 0 fi +if [ "$EARTHLY_STAGING" = "true" ]; then + echo "exiting due to EARTHLY_STAGING=$EARTHLY_STAGING" + exit 0 +fi + echo "homebrew release with gu=$GITHUB_USER; er=$EARTHLY_REPO; br=$BREW_REPO; du=$DOCKERHUB_USER; rt=$RELEASE_TAG" "$earthly" --push --build-arg GITHUB_USER --build-arg EARTHLY_REPO --build-arg BREW_REPO --build-arg DOCKERHUB_USER --build-arg RELEASE_TAG $GITHUB_SECRET_PATH_BUILD_ARG +release-homebrew