Skip to content

Commit 39cab19

Browse files
authored
Add back variants after Prerelease Root Spec modifications (#261)
* Export optional variants from get-spack-root-spec action * Instead of just replacing the entire root spec with the root spec name, include the variants as well * Append variants if non-null
1 parent a295acf commit 39cab19

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.github/actions/get-spack-root-spec/action.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ outputs:
2828
The spack version from the root spec in the spack manifest file.
2929
For example, 'release'.
3030
value: ${{ steps.spec.outputs.version }}
31+
root-spec-variants:
32+
description: |
33+
The variants from the root spec in the spack manifest file.
34+
For example: '~deterministic'.
35+
value: ${{ steps.spec.outputs.variants }}
3136
yq-root-spec:
3237
description: |
3338
The yq filter for the root spec of the spack manifest file.
@@ -60,26 +65,29 @@ runs:
6065
id: spec
6166
shell: bash
6267
run: |
63-
# Example: access-om2@git.2025.01.0=release ~variant
68+
# Example: access-om2@git.2025.01.0=release ~variant +debug some=value
6469
full=$(yq '${{ steps.yq.outputs.filter }}' ${{ inputs.spack-manifest-path }})
6570
6671
# Example of captured groups from the above:
6772
# name: anything before `@`. Ex: access-om2
6873
# ref: anything after `@` or `@git.`; but before `=` (for =VERSION syntax) or ` `/`+`/`~` (for variants). Ex: 2025.01.0
6974
# version: anything after a `=`, but before ` `/`+`/`~` (for variants). Ex: release
70-
71-
groups_regex='(?<name>.+)@(?:git\\.)?(?<ref>[^=+~ ]+)(?:=(?<version>[^~+ ]+))?.*'
75+
# variants: anything at the end that contains ` `/`+`/`~` Ex. ~variant +debug some=value
76+
77+
groups_regex='(?<name>.+)@(?:git\\.)?(?<ref>[^=+~ ]+)(?:=(?<version>[^~+ ]+))?(?<variants>[~+ ].+)?'
7278
7379
groups=$(yq '${{ steps.yq.outputs.filter }} | capture("'"$groups_regex"'")' ${{ inputs.spack-manifest-path }})
7480
7581
# Pull values from groups above
7682
name=$(yq '.name' <<< "$groups")
7783
ref=$(yq '.ref' <<< "$groups")
7884
version=$(yq '.version' <<< "$groups")
85+
variants=$(yq '.variants' <<< "$groups")
7986
80-
echo "Split '$full' into name: '$name', ref: '$ref', version: '$version'"
87+
echo "Split '$full' into name: '$name', ref: '$ref', version: '$version', variants: '$variants'"
8188
8289
echo "full=$full" >> $GITHUB_OUTPUT
8390
echo "name=$name" >> $GITHUB_OUTPUT
8491
echo "ref=$ref" >> $GITHUB_OUTPUT
8592
echo "version=$version" >> $GITHUB_OUTPUT
93+
echo "variants=$variants" >> $GITHUB_OUTPUT

.github/workflows/deploy-2-start.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ jobs:
106106
# is being used to test something else.
107107
env:
108108
SPACK_YAML_MODULEFILE_PROJECTION_YQ: .spack.modules.default.tcl.projections.${{ steps.manifest.outputs.root-spec-name }}
109+
OPTIONAL_VARIANTS: ${{ steps.manifest.outputs.root-spec-variants != 'null' && steps.manifest.outputs.root-spec-variants || '' }}
109110
run: |
110111
if [[ "${{ inputs.expected-root-spec-name }}" == "${{ steps.manifest.outputs.root-spec-name }}" ]]; then
111-
yq -i '${{ steps.manifest.outputs.yq-root-spec }} = "${{ inputs.expected-root-spec-name }}"' spack.yaml
112+
yq -i '${{ steps.manifest.outputs.yq-root-spec }} = "${{ inputs.expected-root-spec-name }} ${{ env.OPTIONAL_VARIANTS }}"' spack.yaml
112113
fi
113114
114115
yq -i '${{ env.SPACK_YAML_MODULEFILE_PROJECTION_YQ }} = "{name}/${{ inputs.version }}"' spack.yaml

0 commit comments

Comments
 (0)