From ae7b4449fd6771c394316278f448d377c154998d Mon Sep 17 00:00:00 2001 From: ludamad Date: Fri, 8 Sep 2023 17:17:24 -0400 Subject: [PATCH] Revert "fix: commit tags and rebuilds (#2156)" This reverts commit 7669b43253f8c2633e96f483ec12c75478dcf539. --- build-system/scripts/build | 67 +++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/build-system/scripts/build b/build-system/scripts/build index a12cb43de59..1a37abad347 100755 --- a/build-system/scripts/build +++ b/build-system/scripts/build @@ -63,40 +63,6 @@ retry ensure_repo $REPOSITORY $ECR_REGION refresh_lifecycle CONTENT_HASH=$(calculate_content_hash $REPOSITORY) echo "Content hash: $CONTENT_HASH" -# Extract version from commit tag -# Check if there is a commit tag -if [[ -n "$COMMIT_TAG" ]]; then - - # Check if it's a repo-specific tag - if [[ "$COMMIT_TAG" == *"/"* ]]; then - REPO_NAME="${COMMIT_TAG%%/*}" - COMMIT_TAG_VERSION="${COMMIT_TAG#*/}" - echo "Tag was made for: $REPO_NAME" - echo "Version: $COMMIT_TAG_VERSION" - - # Check if REPO_NAME is equal to REPOSITORY - if [ "$REPO_NAME" != "$REPOSITORY" ]; then - echo "REPO_NAME ($REPO_NAME) does not match REPOSITORY ($REPOSITORY). Ignoring..." - COMMIT_TAG_VERSION="" - fi - else - COMMIT_TAG_VERSION=$COMMIT_TAG - fi - - # TODO #2155 dont seem to be able to install npx - # # We are building a tagged commit. Check it's a valid semver. - # VERSION=$(npx semver $COMMIT_TAG_VERSION) - # if [ -z "$VERSION" ]; then - # COMMIT_TAG_VERSION="" - # else - # COMMIT_TAG_VERSION=$VERSION - # fi - # fix: we need to use a different content hash for a commit tag - CONTENT_HASH="$CONTENT_HASH$COMMIT_TAG_VERSION" -else - COMMIT_TAG_VERSION="" -fi - cd $BUILD_DIR # If we have previously successful commit, we can early out if nothing relevant has changed since. @@ -148,6 +114,39 @@ for PARENT in $PARENTS; do retry docker tag $PARENT_IMAGE_URI $ECR_DEPLOY_URL/$PARENT done + +# Extract version from commit tag +# Check if there is a commit tag +if [[ -n "$COMMIT_TAG" ]]; then + + # Check if it's a repo-specific tag + if [[ "$COMMIT_TAG" == *"/"* ]]; then + REPO_NAME="${COMMIT_TAG%%/*}" + COMMIT_TAG_VERSION="${COMMIT_TAG#*/}" + echo "Tag was made for: $REPO_NAME" + echo "Version: $COMMIT_TAG_VERSION" + + # Check if REPO_NAME is equal to REPOSITORY + if [ "$REPO_NAME" != "$REPOSITORY" ]; then + echo "REPO_NAME ($REPO_NAME) does not match REPOSITORY ($REPOSITORY). Ignoring..." + COMMIT_TAG_VERSION="" + fi + else + COMMIT_TAG_VERSION=$COMMIT_TAG + fi + + # We are building a tagged commit. Check it's a valid semver. + VERSION=$(npx semver $COMMIT_TAG_VERSION) + if [ -z "$VERSION" ]; then + COMMIT_TAG_VERSION="" + else + COMMIT_TAG_VERSION=$VERSION + fi +else + COMMIT_TAG_VERSION="" +fi + + # Pull, build and push each named stage to cache. STAGE_CACHE_FROM="" CACHE_FROM=""