Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 5 additions & 2 deletions .github/workflows/deploy-2-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ jobs:
run: |
echo "spack=$(jq --compact-output --raw-output '.spack' ./config/versions.json)" >> $GITHUB_OUTPUT
echo "packages=$(jq --compact-output --raw-output '."access-spack-packages"' ./config/versions.json)" >> $GITHUB_OUTPUT
echo "custom-scopes=$(jq --compact-output --raw-output '."custom-scopes" // [] | join(" ")' ./config/versions.json)" >> $GITHUB_OUTPUT
echo "custom-scopes-space-separated=$(jq --compact-output --raw-output '."custom-scopes" // [] | join(" ")' ./config/versions.json)" >> $GITHUB_OUTPUT
echo "custom-scopes-comma-separated=$(jq --compact-output --raw-output '."custom-scopes" // [] | join(",")' ./config/versions.json)" >> $GITHUB_OUTPUT


- name: Get ${{ inputs.deployment-target }} ${{ inputs.deployment-type }} Remote Paths
id: path
Expand Down Expand Up @@ -181,7 +183,7 @@ jobs:
- name: Deploy to ${{ inputs.deployment-target }} ${{ inputs.deployment-type }}
id: deploy
env:
SCOPES: ${{ steps.versions.outputs.custom-scopes }}
SCOPES: ${{ steps.versions.outputs.custom-scopes-space-separated }}
SCOPES_PATH: ${{ steps.path.outputs.spack-config }}/custom/cd
# ssh into deployment environment, create and activate the env, install the spack manifest.
run: |
Expand Down Expand Up @@ -243,6 +245,7 @@ jobs:
--environment ${{ steps.path.outputs.spack-environment }} \
--deployment-name ${{ inputs.expected-root-spec-name }} \
--packages ${{ steps.config-packages.outputs.packages-for-provenance }} \
--config-scopes ${{ steps.versions.outputs.custom-scopes-comma-separated }} \
--output ${{ steps.path.outputs.spack-environment }}
EOT

Expand Down
31 changes: 31 additions & 0 deletions scripts/release_provenance/get_data_from_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@

import spack.environment
import spack.cmd
import spack.config
import spack.paths
import spack.spec
import spack.repo
import spack.main


def main():
args = parse_args(sys.argv[1:])
packages: List[str] = args.packages.split(",")
config_scopes: List[str] = args.config_scopes.split(",") if args.config_scopes else []
output_path = Path(args.output)

# Custom scopes added via spack --config-scope for install need to be added back here
# so we can find those packages!
add_custom_spack_config_scopes(config_scopes)

# Activate the spack environment so we can get relevant specs for this deployment
spack_env = activate_spack_environment(args.environment)

Expand Down Expand Up @@ -50,6 +58,22 @@ def main():
with open(output_path / "build-db-pkgs.json", 'w') as f:
json.dump(packages_metadata, f)

def add_custom_spack_config_scopes(config_scopes: List[str]) -> None:
"""
Adds paths to custom spack config scopes to the command_line scope so we can find binaries for
certain environments that use custom installation directories.

:param config_scopes: Names of custom scopes from spack-configs custom/cd directory.
:type config_scopes: List[str]
"""
spack_config_custom_scopes_path: Path = Path(spack.paths.spack_root).parent / "spack-config" / "custom" / "cd"
Comment thread
aidanheerdegen marked this conversation as resolved.

config_scope_paths: List[str] = [str(spack_config_custom_scopes_path / s) for s in config_scopes]

print(f"Found custom scopes: {config_scope_paths}")
Comment thread
aidanheerdegen marked this conversation as resolved.
Outdated

spack.main.add_command_line_scopes(spack.config.CONFIG, config_scope_paths)

def activate_spack_environment(spack_env_path: str) -> spack.environment.Environment:
spack_env = spack.environment.Environment(spack_env_path)

Expand Down Expand Up @@ -144,6 +168,13 @@ def parse_args(args: List[str]) -> argparse.Namespace:
help="Comma-separated list of packages to extract build metadata for",
)

parser.add_argument(
"--config-scopes",
type=str,
required=False,
help="Comma-separated list of custom spack config scopes defined in spack-configs custom/cd directory"
)

## Args dealing with outputs
parser.add_argument(
"--output",
Expand Down