From 30475ad2ed0fbb23c118cf521d7531406cdeb1db Mon Sep 17 00:00:00 2001 From: Zac Yang Date: Tue, 8 Oct 2024 17:42:58 -0400 Subject: [PATCH 1/4] fixed determine-test-metadata to use current branch as default branch --- .github/workflows/forge-stable.yaml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/forge-stable.yaml b/.github/workflows/forge-stable.yaml index 82d9aef76eaf5..1734f77d3dfbf 100644 --- a/.github/workflows/forge-stable.yaml +++ b/.github/workflows/forge-stable.yaml @@ -68,26 +68,19 @@ jobs: elif [[ "${{ github.event_name }}" == "push" ]]; then echo "Branch: ${{ github.ref_name }}" echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT - else - echo "Using GIT_SHA" - # on workflow_dispatch, this will simply use the inputs.GIT_SHA given (or the default) - # on pull_request, this will default to null and the following "checkout" step will use the PR's base branch + # on workflow_dispatch, this will simply use the inputs.GIT_SHA given (or the default) + elif [ -n "${{ inputs.GIT_SHA }}" ]; then echo "BRANCH=${{ inputs.GIT_SHA }}" >> $GITHUB_OUTPUT + # if GIT_SHA not provided, use the branch where workflow runs on + else + echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT fi - # Use the branch hash instead of the full branch name to stay under kubernetes namespace length limit - name: Hash the branch id: hash-branch run: | - # If BRANCH is empty, default to "main" - if [ -z "${{ steps.determine-test-branch.outputs.BRANCH }}" ]; then - BRANCH="main" - else - BRANCH="${{ steps.determine-test-branch.outputs.BRANCH }}" - fi - # Hashing the branch name - echo "BRANCH_HASH=$(echo -n "$BRANCH" | sha256sum | cut -c1-10)" >> $GITHUB_OUTPUT + echo "BRANCH_HASH=$(echo -n "${{ steps.determine-test-branch.outputs.BRANCH }}" | sha256sum | cut -c1-10)" >> $GITHUB_OUTPUT - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: @@ -105,13 +98,13 @@ jobs: AWS_DOCKER_ARTIFACT_REPO: ${{ secrets.AWS_DOCKER_ARTIFACT_REPO }} GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} - - uses: aptos-labs/aptos-core/.github/actions/get-latest-docker-image-tag@main + - uses: aptos-labs/aptos-core/.github/actions/determine-or-use-target-branch-and-get-last-released-image@main id: get-docker-image-tag with: branch: ${{ steps.determine-test-branch.outputs.BRANCH }} variants: "failpoints performance" - - uses: ./.github/actions/determine-or-use-target-branch-and-get-last-released-image + - uses: aptos-labs/aptos-core/.github/actions/determine-or-use-target-branch-and-get-last-released-image@main id: get-last-released-image-tag-for-compat-test with: base-branch: ${{ steps.determine-test-branch.outputs.BRANCH }} From e9802f7c0eb7756170aeedd736f4924d120b0a5c Mon Sep 17 00:00:00 2001 From: Zac Yang Date: Tue, 8 Oct 2024 17:47:34 -0400 Subject: [PATCH 2/4] fixed determine-test-metadata to use current branch as default branch --- .github/workflows/forge-stable.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/forge-stable.yaml b/.github/workflows/forge-stable.yaml index 1734f77d3dfbf..f0d4c832460b9 100644 --- a/.github/workflows/forge-stable.yaml +++ b/.github/workflows/forge-stable.yaml @@ -98,7 +98,7 @@ jobs: AWS_DOCKER_ARTIFACT_REPO: ${{ secrets.AWS_DOCKER_ARTIFACT_REPO }} GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} - - uses: aptos-labs/aptos-core/.github/actions/determine-or-use-target-branch-and-get-last-released-image@main + - uses: aptos-labs/aptos-core/.github/actions/get-latest-docker-image-tag@main id: get-docker-image-tag with: branch: ${{ steps.determine-test-branch.outputs.BRANCH }} From 5fa1447ab59662afaa31cd336c2f792881752934 Mon Sep 17 00:00:00 2001 From: Zac Yang Date: Tue, 8 Oct 2024 17:52:50 -0400 Subject: [PATCH 3/4] fixed determine-test-metadata to use current branch as default branch --- .github/workflows/forge-stable.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/forge-stable.yaml b/.github/workflows/forge-stable.yaml index f0d4c832460b9..716b89660f5a0 100644 --- a/.github/workflows/forge-stable.yaml +++ b/.github/workflows/forge-stable.yaml @@ -73,7 +73,7 @@ jobs: echo "BRANCH=${{ inputs.GIT_SHA }}" >> $GITHUB_OUTPUT # if GIT_SHA not provided, use the branch where workflow runs on else - echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT + echo "BRANCH=${{ github.head_ref }}" >> $GITHUB_OUTPUT fi # Use the branch hash instead of the full branch name to stay under kubernetes namespace length limit - name: Hash the branch From 1c66510a8a2d342479891d938501bad2707a35e0 Mon Sep 17 00:00:00 2001 From: Zac Yang Date: Wed, 9 Oct 2024 13:25:40 -0400 Subject: [PATCH 4/4] refined --- .github/workflows/forge-stable.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/forge-stable.yaml b/.github/workflows/forge-stable.yaml index 716b89660f5a0..897b752d50948 100644 --- a/.github/workflows/forge-stable.yaml +++ b/.github/workflows/forge-stable.yaml @@ -69,7 +69,7 @@ jobs: echo "Branch: ${{ github.ref_name }}" echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT # on workflow_dispatch, this will simply use the inputs.GIT_SHA given (or the default) - elif [ -n "${{ inputs.GIT_SHA }}" ]; then + elif [[ -n "${{ inputs.GIT_SHA }}" ]]; then echo "BRANCH=${{ inputs.GIT_SHA }}" >> $GITHUB_OUTPUT # if GIT_SHA not provided, use the branch where workflow runs on else