Skip to content

Add back variants after Prerelease Root Spec modifications #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/actions/get-spack-root-spec/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ outputs:
The spack version from the root spec in the spack manifest file.
For example, 'release'.
value: ${{ steps.spec.outputs.version }}
root-spec-variants:
description: |
The variants from the root spec in the spack manifest file.
For example: '~deterministic'.
value: ${{ steps.spec.outputs.variants }}
yq-root-spec:
description: |
The yq filter for the root spec of the spack manifest file.
Expand Down Expand Up @@ -60,26 +65,29 @@ runs:
id: spec
shell: bash
run: |
# Example: access-om2@git.2025.01.0=release ~variant
# Example: access-om2@git.2025.01.0=release ~variant +debug some=value
full=$(yq '${{ steps.yq.outputs.filter }}' ${{ inputs.spack-manifest-path }})

# Example of captured groups from the above:
# name: anything before `@`. Ex: access-om2
# ref: anything after `@` or `@git.`; but before `=` (for =VERSION syntax) or ` `/`+`/`~` (for variants). Ex: 2025.01.0
# version: anything after a `=`, but before ` `/`+`/`~` (for variants). Ex: release

groups_regex='(?<name>.+)@(?:git\\.)?(?<ref>[^=+~ ]+)(?:=(?<version>[^~+ ]+))?.*'
# variants: anything at the end that contains ` `/`+`/`~` Ex. ~variant +debug some=value

groups_regex='(?<name>.+)@(?:git\\.)?(?<ref>[^=+~ ]+)(?:=(?<version>[^~+ ]+))?(?<variants>[~+ ].+)?'

groups=$(yq '${{ steps.yq.outputs.filter }} | capture("'"$groups_regex"'")' ${{ inputs.spack-manifest-path }})

# Pull values from groups above
name=$(yq '.name' <<< "$groups")
ref=$(yq '.ref' <<< "$groups")
version=$(yq '.version' <<< "$groups")
variants=$(yq '.variants' <<< "$groups")

echo "Split '$full' into name: '$name', ref: '$ref', version: '$version'"
echo "Split '$full' into name: '$name', ref: '$ref', version: '$version', variants: '$variants'"

echo "full=$full" >> $GITHUB_OUTPUT
echo "name=$name" >> $GITHUB_OUTPUT
echo "ref=$ref" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
echo "variants=$variants" >> $GITHUB_OUTPUT
3 changes: 2 additions & 1 deletion .github/workflows/deploy-2-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ jobs:
# is being used to test something else.
env:
SPACK_YAML_MODULEFILE_PROJECTION_YQ: .spack.modules.default.tcl.projections.${{ steps.manifest.outputs.root-spec-name }}
OPTIONAL_VARIANTS: ${{ steps.manifest.outputs.root-spec-variants != 'null' && steps.manifest.outputs.root-spec-variants || '' }}
run: |
if [[ "${{ inputs.expected-root-spec-name }}" == "${{ steps.manifest.outputs.root-spec-name }}" ]]; then
yq -i '${{ steps.manifest.outputs.yq-root-spec }} = "${{ inputs.expected-root-spec-name }}"' spack.yaml
yq -i '${{ steps.manifest.outputs.yq-root-spec }} = "${{ inputs.expected-root-spec-name }} ${{ env.OPTIONAL_VARIANTS }}"' spack.yaml
fi

yq -i '${{ env.SPACK_YAML_MODULEFILE_PROJECTION_YQ }} = "{name}/${{ inputs.version }}"' spack.yaml
Expand Down