From 6c0cac7fa6be52c40e2eefad66fd8891b416d0ba Mon Sep 17 00:00:00 2001 From: Tommy Gatti Date: Tue, 25 Aug 2026 14:09:00 +1000 Subject: [PATCH 1/4] ci.yml: Remove inputs.*-spack-packages-ref, conditionally update on-image repos if not specified --- .github/workflows/ci.yml | 93 +++++++++++++++------------------------- 1 file changed, 35 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f77b58..dbc1ac0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,20 +66,6 @@ on: description: | The branch, tag, or commit SHA of the access-nri/spack-config repository to use. For example: main, 2025.03.0, 7ey2uy2. - builtin-spack-packages-ref: - required: false - type: string - # default: ref from spack-config's repos.yaml, or 'develop' otherwise - description: | - The branch, tag, or commit SHA of the spack/spack-packages repository to use. - For example: main, 2025.03.0, 7ey2uy2. - access-spack-packages-ref: - required: false - type: string - default: api-v2 - description: | - The branch, tag, or commit SHA of the access-nri/spack-packages repository to use. - For example: main, 2025.03.0, 7ey2uy2. spack-ref: required: false type: string @@ -204,8 +190,8 @@ jobs: spack-manifest-repository-sha: ${{ steps.checkout.outputs.commit }} spack-sha: ${{ steps.spack-update.outputs.sha }} spack-config-sha: ${{ steps.spack-config-update.outputs.sha }} - builtin-spack-packages-sha: ${{ steps.builtin-spack-packages-update.outputs.sha }} - access-spack-packages-sha: ${{ steps.access-spack-packages-update.outputs.sha }} + builtin-spack-packages-sha: ${{ steps.install.outputs.builtin-spack-packages-sha }} + access-spack-packages-sha: ${{ steps.install.outputs.access-spack-packages-sha }} caller-sha: ${{ steps.checkout-caller.outputs.commit }} artifact-pattern: ${{ steps.init.outputs.artifact-pattern }} artifact-url: ${{ steps.upload.outputs.artifact-url }} @@ -324,44 +310,6 @@ jobs: spack mirror add --scope=access.nri.ci.user --autopush --unsigned runner_set_buildcache /opt/runner_set_buildcache spack mirror list - - name: Spack - Get builtin ref from spack-config - if: inputs.builtin-spack-packages-ref == '' - id: get-default-builtin - # If inputs.builtin-spack-packages-ref is not provided, get the builtin-spack-packages-ref - # from spack-config's repos.yaml or use "develop" (the default branch) if not specified there either. - run: | - . ${{ steps.env.outputs.SPACK_ROOT }}/share/spack/setup-env.sh - # Accept both the overridden .builtin: and regular .builtin key. See ACCESS-NRI/spack-config#105 for more info. - ref=$(spack config get repos | yq '.repos | .builtin // ."builtin:" | .branch // .tag // .commit // "develop"') - echo "Default builtin-spack-packages-ref is $ref" - echo "ref=$ref" >> $GITHUB_OUTPUT - - - name: Spack - Get spack-packages repo locations - id: spack-packages-locations - run: | - . ${{ steps.env.outputs.SPACK_ROOT }}/share/spack/setup-env.sh - - echo "builtin=$(spack location --repo builtin)" >> $GITHUB_OUTPUT - echo "access-spack-packages=$(spack location --repo access.nri)" >> $GITHUB_OUTPUT - - - name: Update - access-spack-package version - id: access-spack-packages-update - uses: ./build-ci/.github/actions/spack-checkout-updated-ref - with: - spack-packages-repository-name: access_spack_packages - spack-packages-repository-path: ${{ steps.spack-packages-locations.outputs.access-spack-packages }} - ref: ${{ inputs.access-spack-packages-ref }} - spack-instance-root-path: ${{ steps.env.outputs.SPACK_ROOT }} - - - name: Update - builtin spack-package version - id: builtin-spack-packages-update - uses: ./build-ci/.github/actions/spack-checkout-updated-ref - with: - spack-packages-repository-name: builtin - spack-packages-repository-path: ${{ steps.spack-packages-locations.outputs.builtin }} - ref: ${{ inputs.builtin-spack-packages-ref || steps.get-default-builtin.outputs.ref }} - spack-instance-root-path: ${{ steps.env.outputs.SPACK_ROOT }} - - name: Spack - OCI Buildcache Init if: inputs.spack-oci-buildcache-url != '' run: | @@ -458,6 +406,33 @@ jobs: echo "spack-manifest-path=$templated_manifest_path" >> $GITHUB_OUTPUT + - name: Update - Determine spack.repos explicitly specified + id: repos-specified + working-directory: manifest + # We will only sync the on-image repos if they aren't already specified in the manifest + run: | + access_spack_packages_exists=$(yq '[.spack.repos[] | select(.git == "https://github.com/ACCESS-NRI/access-spack-packages.git")] | length > 0' ${{ steps.jinja-templated.outputs.spack-manifest-path }}) + builtin_spack_packages_exists=$(yq '[.spack.repos[] | select(.git == "https://github.com/ACCESS-NRI/upstream-spack-packages.git")] | length > 0' ${{ steps.jinja-templated.outputs.spack-manifest-path }}) + + echo "access-spack-packages spack.repos section: $access_spack_packages_exists" + echo "builtin spack.repos section: $builtin_spack_packages_exists" + + echo "access-spack-packages=$access_spack_packages_exists" >> $GITHUB_OUTPUT + echo "builtin-spack-packages=$builtin_spack_packages_exists" >> $GITHUB_OUTPUT + + # TODO: Remove these manual pulls once we have spack repo update --force - see https://github.com/ACCESS-NRI/spack/issues/22 + - name: Update - Sync existing access-spack-packages repo + if: steps.repos-specified.outputs.access-spack-packages != 'true' + run: | + . ${{ steps.env.outputs.SPACK_ROOT }}/share/spack/setup-env.sh + spack repo update access_spack_packages || git -C $(spack location --repo access.nri) pull --rebase --force + + - name: Update - Sync existing builtin repo + if: steps.repos-specified.outputs.builtin-spack-packages != 'true' + run: | + . ${{ steps.env.outputs.SPACK_ROOT }}/share/spack/setup-env.sh + spack repo update builtin || git -C $(spack location --repo builtin) pull --rebase --force + - name: Manifest - Install id: install working-directory: manifest @@ -488,6 +463,10 @@ jobs: spack --debug install --fail-fast --deprecated + # Output builtin and access-spack-packages-shas + echo "access-spack-packages-sha=$(git -C $(spack location --repo access.nri) HEAD)" >> $GITHUB_OUTPUT + echo "builtin-spack-packages-sha=$(git -C $(spack location --repo builtin) HEAD)" >> $GITHUB_OUTPUT + - name: Manifest - Push to Buildcache env: # For pulling and pushing OCI buildcache @@ -575,8 +554,6 @@ jobs: "spack_compiler_manifest_path": "${{ inputs.spack-compiler-manifest-path }}", "ref": "${{ inputs.ref }}", "spack_config_ref": "${{ inputs.spack-config-ref }}", - "builtin_spack_packages_ref": "${{ inputs.builtin-spack-packages-ref }}", - "access_spack_packages_ref": "${{ inputs.access-spack-packages-ref }}", "spack_ref": "${{ inputs.spack-ref }}", "pytest_test_markers": "${{ inputs.pytest-test-markers }}", "allow_ssh_into_spack_install": "${{ inputs.allow-ssh-into-spack-install }}", @@ -589,8 +566,8 @@ jobs: "spack_manifest_repository_sha": "${{ steps.checkout.outputs.commit }}", "spack_sha": "${{ steps.spack-update.outputs.sha }}", "spack_config_sha": "${{ steps.spack-config-update.outputs.sha }}", - "builtin_spack_packages_sha": "${{ steps.builtin-spack-packages-update.outputs.sha }}", - "access_spack_packages_sha": "${{ steps.access-spack-packages-update.outputs.sha }}", + "builtin_spack_packages_sha": "${{ steps.install.outputs.builtin-spack-packages-sha }}", + "access_spack_packages_sha": "${{ steps.install.outputs.access-spack-packages-sha }}", "caller_sha": "${{ steps.checkout-caller.outputs.commit }}", "container_id": "${{ steps.init.outputs.container-id }}", "short_container_id": "${{ steps.init.outputs.short-container-id }}", From f10fb3136dfd347dcb294f3a91585bae34f5fa37 Mon Sep 17 00:00:00 2001 From: Tommy Gatti Date: Wed, 26 Aug 2026 11:11:11 +1000 Subject: [PATCH 2/4] Delete spack-checkout-updated-ref action --- .../spack-checkout-updated-ref/README.md | 47 ----------- .../spack-checkout-updated-ref/action.yml | 79 ------------------- 2 files changed, 126 deletions(-) delete mode 100644 .github/actions/spack-checkout-updated-ref/README.md delete mode 100644 .github/actions/spack-checkout-updated-ref/action.yml diff --git a/.github/actions/spack-checkout-updated-ref/README.md b/.github/actions/spack-checkout-updated-ref/README.md deleted file mode 100644 index a16199d..0000000 --- a/.github/actions/spack-checkout-updated-ref/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Update Existing Repo and Checkout Ref - -Action that updates an existing repository, and checks out the updated ref. - -## Inputs - -| Name | Type | Description | Required | Default | Example | -| ---- | ---- | ----------- | -------- | ------- | ------- | -| `spack-packages-repository-name` | `string` | The name of the repository used by spack to update and checkout the ref (given in the spack config file `repos.yaml`) | `true` | N/A | `"builtin"` | -| `spack-packages-repository-path` | `string` (path) | The path to the repository to update and check out the ref | `true` | N/A | `"/root/.spack/package_repos/fncqgg4/repos/spack_repo/builtin"` | -| `ref` | `string` (git branch, tag or sha) | The git ref to check out | `true` | N/A | `"main"` or `"v1"` or `"f8r73g3"` | -| `spack-instance-root-path` | `string` (path) | The path to the spack instance root, used to setup the spack environment | `true` | N/A | `"/opt/spack"` | -An example [`repos.yaml` file](https://github.com/ACCESS-NRI/spack-config/blob/main/common-api-v2/repos.yaml) as referenced above. -## Outputs - -| Name | Type | Description | Example | -| ---- | ---- | ----------- | ------- | -| `sha` | `string` (sha) | The SHA of the checked out ref | `"5a1cdc4e4617fcd6ba1cccf1cd0432b5631983be"` | -| `updated` | `string` (boolean) | Whether there was actually an update to the ref | `"true"` or `"false"` | - -## Examples - -### Simple - -```yaml -# ... -jobs: - update-repo: - runs-on: ubuntu-latest - env: - SPACK_ROOT: /opt/spack - steps: - - id: repo - run: | - . ${{ env.SPACK_ROOT }}/share/spack/setup-env.sh - echo "path=$(spack location --repo builtin)" >> $GITHUB_OUTPUT - - - id: update - uses: ./.github/actions/spack-checkout-updated-ref - with: - spack-packages-repository-name: builtin - spack-packages-repository-path: ${{ steps.repo.outputs.path }} - ref: develop - spack-instance-root-path: ${{ env.SPACK_ROOT }} - - - run: echo "The builtin spack-packages repo was updated to ${{ steps.update.outputs.sha }}" -``` diff --git a/.github/actions/spack-checkout-updated-ref/action.yml b/.github/actions/spack-checkout-updated-ref/action.yml deleted file mode 100644 index b738e2d..0000000 --- a/.github/actions/spack-checkout-updated-ref/action.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Checkout Ref Via Spack -description: Updates and checks out a given ref for an existing spack-packages repository via spack -inputs: - spack-packages-repository-name: - description: | - The spack name of the repository to update and check out the ref. - This is the repos.NAME key in spacks repos.yaml config file - eg. builtin - required: true - spack-packages-repository-path: - description: The path to the repository to update and check out the ref - required: true - ref: - description: The git ref to check out - required: true - spack-instance-root-path: - description: The path to the spack instance root, used to setup the spack environment - required: true -outputs: - sha: - description: 'The SHA of the checked out ref' - value: ${{ steps.ref-sha.outputs.sha }} - updated: - description: 'Whether the repository was updated' - value: ${{ steps.post-update.outputs.updated }} -runs: - using: composite - steps: - - name: Get initial SHA - id: initial - shell: bash - run: | - sha=$(git -C ${{ inputs.spack-packages-repository-path }} rev-parse HEAD^{}) - echo "${{ inputs.spack-packages-repository-name }} Initial SHA: $sha" - - echo "sha=$sha" >> $GITHUB_OUTPUT - - - name: Fetch latest for repo - shell: bash - # We don't fetch blobs (repo content) as spack repo update can handle that if required. - # NOTE: This won't be required if there is a spack repo update --force option in the future. - run: git -C ${{ inputs.spack-packages-repository-path }} fetch --force --tags --filter=blob:none - - - name: Get SHA for ref - id: ref-sha - uses: access-nri/actions/.github/actions/get-git-ref-info@main - with: - repository-path: ${{ inputs.spack-packages-repository-path }} - ref: ${{ inputs.ref }} - - - name: Update ref via Spack - shell: bash - id: update - continue-on-error: true - # We need to explicitly set the repo in the user scope as without that step, it will only add - # the commit section to the repos.yaml (not the existing git or destination section) as the upstream - # repos.REPO:: section ignores lower precedence scopes (where those other sections are set) - run: | - . ${{ inputs.spack-instance-root-path }}/share/spack/setup-env.sh - spack repo set --scope=access.nri.ci.user ${{ inputs.spack-packages-repository-name }} - spack repo update --scope=access.nri.ci.user ${{ inputs.spack-packages-repository-name }} --commit ${{ steps.ref-sha.outputs.sha }} - spack config blame repos - - - name: Force Update ref via Git if Failure - if: steps.update.outcome == 'failure' - shell: bash - # FIXME: If there is ever a spack repo update --force option, use that for the above command and delete this step - run: git -C ${{ inputs.spack-packages-repository-path }} checkout --force ${{ steps.ref-sha.outputs.sha }} - - - name: Check if updated - id: post-update - shell: bash - run: | - if [ "${{ steps.initial.outputs.sha }}" != "${{ steps.ref-sha.outputs.sha }}" ]; then - echo "Repository was updated from ${{ steps.initial.outputs.sha }} to ${{ inputs.ref }} (${{ steps.ref-sha.outputs.sha }})" - echo "updated=true" >> $GITHUB_OUTPUT - else - echo "Repository was not updated, stayed at ${{ inputs.ref }} (${{ steps.initial.outputs.sha }})" - echo "updated=false" >> $GITHUB_OUTPUT - fi From 6b33740828c618c18c54b36203a638523353aa52 Mon Sep 17 00:00:00 2001 From: Tommy Gatti Date: Tue, 25 Aug 2026 14:12:23 +1000 Subject: [PATCH 3/4] README.md: Remove references to inputs.*-spack-packages-ref --- .github/workflows/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index a6c1694..90cd9fb 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -22,8 +22,6 @@ This workflow handles building and running short CI tests on a given spack manif | `spack-manifest-data-pairs` | `string` | An optional, multi-line string of space-separated key-value pairs to fill in `inputs.spack-manifest-path`. This is useful for filling in template values created dynamically by earlier jobs needed by this workflow. This doesn't include `{{ ref }}`, which is filled in automatically. | `false` | N/A | `"package mom5`(newline)`compiler intel"` | | `ref` | `string` (Git ref) | The branch, tag, or commit SHA of the caller model component repository | `false` | `github.event.pull_request.head.sha` for PRs, `github.sha` otherwise | `"c0fef23fc1e69d3a31ec18fd8b7102acdf95f651"`, `"main"`, `"2025.01.000"` | | `spack-config-ref` | `string` (Git ref) | The branch, tag, or commit SHA of the access-nri/spack-config repository to use | `false` | Ref in `spack-config`s `repos.yaml`, or `develop` if not specified | `"02125b01eb7c778c8d0ae0a02a260de474782e81"`, `"main"`, `"2025.01.000"` | -| `builtin-spack-packages-ref` | `string` (Git ref) | The branch, tag, or commit SHA of the `spack/spack-packages` repository to use | `false` | `"main"` | `"f7314790111ec43cf9cff60421c155b922c349ad"`, `"main"`, `"2025.01.000"` | -| `access-spack-packages-ref` | `string` (Git ref) | The branch, tag, or commit SHA of the `access-nri/access-spack-packages` repository to use | `false` | `"main"` | `"e4ba85db0be4a9b9493cf7581623f9997b9404a5"`, `"main"`, `"2025.01.000"` | | `allow-ssh-into-spack-install` | `boolean` | Enable the actor of the workflow to SSH into the container where the spack packages have been installed. This is useful for gathering post-install information before the container is destroyed. This will also make the workflow wait until the actor SSHs into the container, or it times out, before continuing | `false` | `false` | `true`, `false` | | `container-image-version` | `string` (Docker version ref) | The version of the container image to use for the runner. Can be either a `:TAG` or a `@sha256:SHA`. | `false` | `":rocky"` | `':8.9'` (tag), `'@sha256:1234...'` (SHA) | | `spack-oci-buildcache-url` | `string` (OCI URL) | The URL to an oci-backed buildcache, available in spack >= v1.0. OCI-backed buildcaches are the only option for GitHub-hosted CI, and can be used as a backup for self-hosted CI's runner buildcache | `false` | N/A | `"oci://ghcr.io/ACCESS-NRI/build-ci-buildcache"`, `"oci://ghcr.io/ORG/IMAGE"` | @@ -91,8 +89,6 @@ jobs: spack-manifest-data-path: .github/build/data/data.json spack-compiler-manifest-path: .github/build/compiler/intel.spack.yaml spack-ref: releases/v0.22 - builtin-spack-packages-ref: 2025.07.0 - access-spack-packages-ref: 2025.05.000 spack-config-ref: 2025.10.001 allow-ssh-into-spack-install: true run-self-hosted: false From f212a89439ac4a99b9047a6268a603b89afb1d7d Mon Sep 17 00:00:00 2001 From: Tommy Gatti Date: Wed, 26 Aug 2026 13:50:09 +1000 Subject: [PATCH 4/4] ci.yml: Remove check for update for on-image repos --- .github/workflows/ci.yml | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbc1ac0..8e416dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -406,33 +406,6 @@ jobs: echo "spack-manifest-path=$templated_manifest_path" >> $GITHUB_OUTPUT - - name: Update - Determine spack.repos explicitly specified - id: repos-specified - working-directory: manifest - # We will only sync the on-image repos if they aren't already specified in the manifest - run: | - access_spack_packages_exists=$(yq '[.spack.repos[] | select(.git == "https://github.com/ACCESS-NRI/access-spack-packages.git")] | length > 0' ${{ steps.jinja-templated.outputs.spack-manifest-path }}) - builtin_spack_packages_exists=$(yq '[.spack.repos[] | select(.git == "https://github.com/ACCESS-NRI/upstream-spack-packages.git")] | length > 0' ${{ steps.jinja-templated.outputs.spack-manifest-path }}) - - echo "access-spack-packages spack.repos section: $access_spack_packages_exists" - echo "builtin spack.repos section: $builtin_spack_packages_exists" - - echo "access-spack-packages=$access_spack_packages_exists" >> $GITHUB_OUTPUT - echo "builtin-spack-packages=$builtin_spack_packages_exists" >> $GITHUB_OUTPUT - - # TODO: Remove these manual pulls once we have spack repo update --force - see https://github.com/ACCESS-NRI/spack/issues/22 - - name: Update - Sync existing access-spack-packages repo - if: steps.repos-specified.outputs.access-spack-packages != 'true' - run: | - . ${{ steps.env.outputs.SPACK_ROOT }}/share/spack/setup-env.sh - spack repo update access_spack_packages || git -C $(spack location --repo access.nri) pull --rebase --force - - - name: Update - Sync existing builtin repo - if: steps.repos-specified.outputs.builtin-spack-packages != 'true' - run: | - . ${{ steps.env.outputs.SPACK_ROOT }}/share/spack/setup-env.sh - spack repo update builtin || git -C $(spack location --repo builtin) pull --rebase --force - - name: Manifest - Install id: install working-directory: manifest