Skip to content

Commit

Permalink
release.sh: build and push new experimental buildkit branch (#4117)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
alexcb authored May 22, 2024
1 parent c1b7d13 commit 8793b4e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions earthly-next
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d4e630c482bde6e4f6da3d2257ee6e8d9955f180
18 changes: 18 additions & 0 deletions release/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 \
Expand Down
30 changes: 28 additions & 2 deletions release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8793b4e

Please sign in to comment.