From 87dc9c49e85f2a1909f0a2afe6d46ac0c763dd0d Mon Sep 17 00:00:00 2001 From: Metin Cakircali Date: Wed, 8 Oct 2025 13:33:09 +0200 Subject: [PATCH 1/8] cd-module: add option ref name --- .github/workflows/cd-module.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd-module.yml b/.github/workflows/cd-module.yml index e7697b6e..91a5dd16 100644 --- a/.github/workflows/cd-module.yml +++ b/.github/workflows/cd-module.yml @@ -15,6 +15,12 @@ on: description: Value `true` will skip version checks, use for testing or in nightly builds. type: boolean required: false + ref_name: + type: string + description: Git branch or tag name to checkout. + default: ${{ github.ref_name }} + required: true + jobs: setup: runs-on: ubuntu-latest @@ -23,6 +29,7 @@ jobs: steps: - uses: actions/checkout@v4 with: + ref: ${{ inputs.ref_name }} fetch-depth: "0" - name: Test tag name pattern @@ -33,7 +40,7 @@ jobs: import sys tag_pattern = r"${{ vars.TAG_REGEX_FOR_DEPLOYMENT }}" - ref = "${{ github.ref_name }}" + ref = "${{ inputs.ref_name }}" if not tag_pattern: sys.exit(0) @@ -45,7 +52,7 @@ jobs: - name: Test branch name pattern if: ${{ ! inputs.skip_checks && vars.BRANCH_REGEX_FOR_DEPLOYMENT != '' }} run: | - git branch --all --list --format "%(refname:lstrip=-1)" --contains "${{ github.ref_name }}" | grep -E "${{ vars.BRANCH_REGEX_FOR_DEPLOYMENT }}" + git branch --all --list --format "%(refname:lstrip=-1)" --contains "${{ inputs.ref_name }}" | grep -E "${{ vars.BRANCH_REGEX_FOR_DEPLOYMENT }}" - name: Setup Matrix id: matrix @@ -153,5 +160,5 @@ jobs: github_user: ${{ secrets.BUILD_PACKAGE_HPC_GITHUB_USER }} github_token: ${{ secrets.GH_REPO_READ_TOKEN }} troika_user: ${{ secrets.HPC_CI_SSH_USER }} - repository: ${{ github.repository }}@${{ github.event.pull_request.head.sha || github.sha }} + repository: ${{ github.repository }}@${{ inputs.ref_name }} build_config: ${{ inputs.config_path }} From 1c4adda6c310d3035e388267bf6a221e5c868434 Mon Sep 17 00:00:00 2001 From: Metin Cakircali Date: Wed, 8 Oct 2025 14:39:05 +0200 Subject: [PATCH 2/8] cd-module: make ref_name not required --- .github/workflows/cd-module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-module.yml b/.github/workflows/cd-module.yml index 91a5dd16..43b9cca2 100644 --- a/.github/workflows/cd-module.yml +++ b/.github/workflows/cd-module.yml @@ -19,7 +19,7 @@ on: type: string description: Git branch or tag name to checkout. default: ${{ github.ref_name }} - required: true + required: false jobs: setup: From fffab4ab166fddb2c1672bfeddc54f0118c4304f Mon Sep 17 00:00:00 2001 From: Metin Cakircali Date: Fri, 10 Oct 2025 12:58:28 +0200 Subject: [PATCH 3/8] cd-module: add Jakub's suggestions --- .github/workflows/cd-module.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd-module.yml b/.github/workflows/cd-module.yml index 43b9cca2..2948a49a 100644 --- a/.github/workflows/cd-module.yml +++ b/.github/workflows/cd-module.yml @@ -31,7 +31,9 @@ jobs: with: ref: ${{ inputs.ref_name }} fetch-depth: "0" - + - name: Get checked out SHA + id: checked_out_sha + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Test tag name pattern if: ${{ ! inputs.skip_checks }} shell: python @@ -125,7 +127,7 @@ jobs: owner_repo = "${{ github.repository }}" owner, repo = owner_repo.split("/") - ref = "${{ github.sha }}" + ref = os.getenv("CHECKED_OUT_SHA") token = "${{ github.token }}" url = f"https://raw.githubusercontent.com/{owner}/{repo}/{ref}/{input_config_path}" response = requests.get(url, headers={"Authorization": f"token {token}"}) @@ -160,5 +162,5 @@ jobs: github_user: ${{ secrets.BUILD_PACKAGE_HPC_GITHUB_USER }} github_token: ${{ secrets.GH_REPO_READ_TOKEN }} troika_user: ${{ secrets.HPC_CI_SSH_USER }} - repository: ${{ github.repository }}@${{ inputs.ref_name }} + repository: ${{ github.repository }}@${{ needs.setup.outputs.checked_out_sha }} build_config: ${{ inputs.config_path }} From 4a7d15eb4ffbcdf5e187be2df814c2483568d358 Mon Sep 17 00:00:00 2001 From: Metin Cakircali Date: Fri, 10 Oct 2025 12:59:57 +0200 Subject: [PATCH 4/8] cd-module: dev runner --- .github/workflows/cd-module.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd-module.yml b/.github/workflows/cd-module.yml index 2948a49a..14898e3c 100644 --- a/.github/workflows/cd-module.yml +++ b/.github/workflows/cd-module.yml @@ -153,12 +153,13 @@ jobs: strategy: fail-fast: false matrix: ${{ fromJson(needs.setup.outputs.matrix) }} - runs-on: [self-hosted, linux, hpc] + runs-on: [self-hosted, linux, hpc-dev] env: GITHUB_TOKEN: ${{ secrets.GH_REPO_READ_TOKEN }} steps: - uses: ecmwf/reusable-workflows/ci-hpc@v2 with: + dev-runner: true github_user: ${{ secrets.BUILD_PACKAGE_HPC_GITHUB_USER }} github_token: ${{ secrets.GH_REPO_READ_TOKEN }} troika_user: ${{ secrets.HPC_CI_SSH_USER }} From 261b60cca5a5532baf1cd741c2ff4f6c5d59483b Mon Sep 17 00:00:00 2001 From: Metin Cakircali Date: Fri, 10 Oct 2025 13:15:28 +0200 Subject: [PATCH 5/8] cd-module: revert ref as sha --- .github/workflows/cd-module.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd-module.yml b/.github/workflows/cd-module.yml index 14898e3c..2ef5b1b1 100644 --- a/.github/workflows/cd-module.yml +++ b/.github/workflows/cd-module.yml @@ -127,7 +127,7 @@ jobs: owner_repo = "${{ github.repository }}" owner, repo = owner_repo.split("/") - ref = os.getenv("CHECKED_OUT_SHA") + ref = "${{ github.sha }}" token = "${{ github.token }}" url = f"https://raw.githubusercontent.com/{owner}/{repo}/{ref}/{input_config_path}" response = requests.get(url, headers={"Authorization": f"token {token}"}) @@ -159,6 +159,7 @@ jobs: steps: - uses: ecmwf/reusable-workflows/ci-hpc@v2 with: + # todo: remove before merge dev-runner: true github_user: ${{ secrets.BUILD_PACKAGE_HPC_GITHUB_USER }} github_token: ${{ secrets.GH_REPO_READ_TOKEN }} From d5999b092363c959bf84963308a4ac5a3a576446 Mon Sep 17 00:00:00 2001 From: Metin Cakircali Date: Fri, 10 Oct 2025 13:22:22 +0200 Subject: [PATCH 6/8] cd-module: remove dev runner --- .github/workflows/cd-module.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cd-module.yml b/.github/workflows/cd-module.yml index 2ef5b1b1..b2ee9980 100644 --- a/.github/workflows/cd-module.yml +++ b/.github/workflows/cd-module.yml @@ -159,8 +159,6 @@ jobs: steps: - uses: ecmwf/reusable-workflows/ci-hpc@v2 with: - # todo: remove before merge - dev-runner: true github_user: ${{ secrets.BUILD_PACKAGE_HPC_GITHUB_USER }} github_token: ${{ secrets.GH_REPO_READ_TOKEN }} troika_user: ${{ secrets.HPC_CI_SSH_USER }} From c816cfedb0314af68c533f50acfbb65ef2b42b94 Mon Sep 17 00:00:00 2001 From: Metin Cakircali Date: Fri, 10 Oct 2025 13:27:31 +0200 Subject: [PATCH 7/8] cd-module: revert Jakub's sha --- .github/workflows/cd-module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-module.yml b/.github/workflows/cd-module.yml index b2ee9980..04fb1d72 100644 --- a/.github/workflows/cd-module.yml +++ b/.github/workflows/cd-module.yml @@ -162,5 +162,5 @@ jobs: github_user: ${{ secrets.BUILD_PACKAGE_HPC_GITHUB_USER }} github_token: ${{ secrets.GH_REPO_READ_TOKEN }} troika_user: ${{ secrets.HPC_CI_SSH_USER }} - repository: ${{ github.repository }}@${{ needs.setup.outputs.checked_out_sha }} + repository: ${{ github.repository }}@${{ inputs.ref_name }} build_config: ${{ inputs.config_path }} From bdfc636397c190ff2612c46b66cd1d509bb8d60c Mon Sep 17 00:00:00 2001 From: Metin Cakircali Date: Fri, 10 Oct 2025 14:18:00 +0200 Subject: [PATCH 8/8] cd-module: add Jakub's suggestion --- .github/workflows/cd-module.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd-module.yml b/.github/workflows/cd-module.yml index 04fb1d72..541db4d8 100644 --- a/.github/workflows/cd-module.yml +++ b/.github/workflows/cd-module.yml @@ -60,6 +60,7 @@ jobs: id: matrix shell: python env: + CHECKED_OUT_SHA: ${{ steps.checked_out_sha.outputs.sha }} MATRIX: | name: - gnu-12.2.0 @@ -127,7 +128,7 @@ jobs: owner_repo = "${{ github.repository }}" owner, repo = owner_repo.split("/") - ref = "${{ github.sha }}" + ref = os.getenv("CHECKED_OUT_SHA") token = "${{ github.token }}" url = f"https://raw.githubusercontent.com/{owner}/{repo}/{ref}/{input_config_path}" response = requests.get(url, headers={"Authorization": f"token {token}"})