Repository navigation
Add common CI script helpers #28
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
Open
rbberger
wants to merge
13
commits into
main
Choose a base branch
from
common-ci-scripts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
06add20
Remove the "git detached head advice"
AndresYague c385559
No advice detached (#24)
rbberger d775dfd
cmake: respect CMAKE_BUILD_PARALLEL_LEVEL when set
rbberger 71fe133
cmake: respect CMAKE_BUILD_PARALLEL_LEVEL when set (#26)
rbberger f5ddcb9
cdash: remove hard-coded CTEST_USE_LAUNCHERS
rbberger 3058a6f
cdash: remove hard-coded CTEST_USE_LAUNCHERS (#27)
rbberger 27b90d1
spack workflow: add common ci script helpers
rbberger b31d78f
add configurable alloc line
rbberger 83d9b79
deployment: add kessel_alloc and interactive node handoff helpers
rbberger cce04d9
add --persist command-line helper for alloc scripts
rbberger 776352a
Merge remote-tracking branch 'origin/releases/v0.3' into common-ci-sc…
rbberger fd7b2f4
add helper to list all environments in deployment
rbberger 9f5afc0
WIP
rbberger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/bin/bash | ||
| # © 2026. Triad National Security, LLC. All rights reserved. | ||
| # This program was produced under U.S. Government contract 89233218CNA000001 | ||
| # for Los Alamos National Laboratory (LANL), which is operated by Triad | ||
| # National Security, LLC for the U.S. Department of Energy/National Nuclear | ||
| # Security Administration. All rights in the program are reserved by Triad | ||
| # National Security, LLC, and the U.S. Department of Energy/National Nuclear | ||
| # Security Administration. The Government is granted for itself and others | ||
| # acting on its behalf a nonexclusive, paid-up, irrevocable worldwide license | ||
| # in this material to reproduce, prepare derivative works, distribute copies to | ||
| # the public, perform publicly and display publicly, and to permit others to do | ||
| # so. | ||
| # | ||
| # Wrapper handed to salloc/flux alloc as $SHELL by kessel_alloc. It runs inside | ||
| # the allocation to activate the workflow deployment (creating a writable copy | ||
| # only if one doesn't already exist) using KESSEL_DEPLOYMENT inherited from the | ||
| # allocating shell, then hands off to a login bash. | ||
|
|
||
| source "$KESSEL_DEPLOYMENT/kessel/lib/kessel/workflows/base/spack/deployment/use.sh" | ||
| kessel_activate_deployment || exit $? | ||
|
|
||
| export SHELL=/bin/bash | ||
| export -f kessel | ||
|
|
||
| KESSEL_VERSION=$(cat "$KESSEL_WORKFLOW_DEPLOYMENT/.kessel_version" 2>/dev/null) | ||
|
|
||
| BOLD='\033[1m' | ||
| RESET='\033[0m' | ||
|
|
||
| echo | ||
| echo -e "${BOLD}Spack deployment and Kessel${KESSEL_VERSION:+ ($KESSEL_VERSION)} are now available${RESET}" | ||
| echo | ||
| echo "Common commands:" | ||
| echo | ||
| echo -e "${BOLD}spack env list${RESET} show available environments" | ||
| echo -e "${BOLD}kessel run${RESET} run workflow with $KESSEL_SPACK_ENV Spack environment" | ||
| echo -e "${BOLD}kessel status${RESET} show current workflow state" | ||
| echo -e "${BOLD}kessel build-env${RESET} enter build and run environment (requires completed configure step)" | ||
| echo | ||
|
|
||
| exec /bin/bash -l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| # © 2026. Triad National Security, LLC. All rights reserved. | ||
| # This program was produced under U.S. Government contract 89233218CNA000001 | ||
| # for Los Alamos National Laboratory (LANL), which is operated by Triad | ||
| # National Security, LLC for the U.S. Department of Energy/National Nuclear | ||
| # Security Administration. All rights in the program are reserved by Triad | ||
| # National Security, LLC, and the U.S. Department of Energy/National Nuclear | ||
| # Security Administration. The Government is granted for itself and others | ||
| # acting on its behalf a nonexclusive, paid-up, irrevocable worldwide license | ||
| # in this material to reproduce, prepare derivative works, distribute copies to | ||
| # the public, perform publicly and display publicly, and to permit others to do | ||
| # so. | ||
| # | ||
| # Helpers for using an existing Spack deployment: detect the current system, | ||
| # activate the (possibly cloned) deployment, and allocate an interactive node. | ||
| # Intended to work on sh, zsh, and bash. | ||
|
|
||
| # Detect the current cluster (KESSEL_SYSTEM) and its scheduler | ||
| # (KESSEL_SYSTEM_SCHEDULER). | ||
| kessel_detect_system() { | ||
| if command -v sacctmgr >/dev/null 2>&1 && command -v jq >/dev/null 2>&1; then | ||
| KESSEL_SYSTEM=$(sacctmgr list --json clusters | jq -r '.clusters[0].name') | ||
| KESSEL_SYSTEM_SCHEDULER="slurm" | ||
| elif command -v flux >/dev/null 2>&1; then | ||
| KESSEL_SYSTEM=$(hostname | sed 's/[0-9]//g') | ||
| KESSEL_SYSTEM_SCHEDULER="flux" | ||
| fi | ||
| export KESSEL_SYSTEM KESSEL_SYSTEM_SCHEDULER | ||
| } | ||
|
|
||
| # Parse a "--persist PATH" option out of the arguments, exporting | ||
| # KESSEL_WORKFLOW_DEPLOYMENT=PATH so the deployment is created (if needed) at a | ||
| # persistent, writable location instead of the default per-user temp copy. When | ||
| # --persist is not given, any externally-set KESSEL_WORKFLOW_DEPLOYMENT is left | ||
| # untouched. The remaining arguments are placed, shell-quoted, in | ||
| # KESSEL_ARGS_REST for the caller to re-apply, e.g.: | ||
| # | ||
| # kessel_parse_persist "$@" || return $? | ||
| # eval "set -- $KESSEL_ARGS_REST" | ||
| kessel_parse_persist() { | ||
| KESSEL_ARGS_REST="" | ||
| while [ "$#" -gt 0 ]; do | ||
| case "$1" in | ||
| --persist) | ||
| if [ "$#" -lt 2 ]; then | ||
| echo "ERROR: --persist requires a PATH argument!" >&2 | ||
| return 2 | ||
| fi | ||
| export KESSEL_WORKFLOW_DEPLOYMENT="$2" | ||
| shift 2 | ||
| ;; | ||
| --persist=*) | ||
| export KESSEL_WORKFLOW_DEPLOYMENT="${1#--persist=}" | ||
| shift | ||
| ;; | ||
| *) | ||
| # Single-quote each remaining arg (escaping embedded quotes) so | ||
| # constraint strings survive the eval unscathed. | ||
| _kessel_q=$(printf '%s' "$1" | sed "s/'/'\\\\''/g") | ||
| KESSEL_ARGS_REST="${KESSEL_ARGS_REST:+$KESSEL_ARGS_REST }'$_kessel_q'" | ||
| shift | ||
| ;; | ||
| esac | ||
| done | ||
| unset _kessel_q | ||
| } | ||
|
|
||
| # Activate the writable workflow deployment (KESSEL_WORKFLOW_DEPLOYMENT), | ||
| # cloning it from the cluster deployment (KESSEL_DEPLOYMENT) if needed. Defaults | ||
| # to a per-user temp copy; pass "--persist PATH" (see kessel_parse_persist) or | ||
| # set KESSEL_WORKFLOW_DEPLOYMENT to a path to persist it, or to "upstream" to use | ||
| # the (read-only) cluster deployment directly. | ||
| kessel_activate_deployment() { | ||
| _KESSEL_WORKFLOW_DEPLOYMENT="$KESSEL_WORKFLOW_DEPLOYMENT" | ||
| export KESSEL_WORKFLOW_DEPLOYMENT=${KESSEL_WORKFLOW_DEPLOYMENT:-${TMPDIR:-/tmp}/$USER-ci-envs} | ||
|
|
||
| if [ "$KESSEL_WORKFLOW_DEPLOYMENT" = "upstream" ] && [ -d "$KESSEL_DEPLOYMENT" ]; then | ||
| source "$KESSEL_DEPLOYMENT/activate.sh" | ||
| else | ||
| if [ -d "$KESSEL_DEPLOYMENT" ] && [ ! -d "$KESSEL_WORKFLOW_DEPLOYMENT" ]; then | ||
| source "$KESSEL_DEPLOYMENT/activate.sh" | ||
| echo "Creating writable deployment copy at $KESSEL_WORKFLOW_DEPLOYMENT" | ||
| clone-deployment "$KESSEL_WORKFLOW_DEPLOYMENT" > /dev/null | ||
| fi | ||
| if [ ! -d "$KESSEL_WORKFLOW_DEPLOYMENT" ]; then | ||
| echo "ERROR: $KESSEL_WORKFLOW_DEPLOYMENT does not exist!" >&2 | ||
| return 1 | ||
| elif [ -z "$_KESSEL_WORKFLOW_DEPLOYMENT" ] && [ ! -O "$KESSEL_WORKFLOW_DEPLOYMENT" ]; then | ||
| echo "ERROR: $KESSEL_WORKFLOW_DEPLOYMENT not owned by $USER!" >&2 | ||
| return 1 | ||
| else | ||
| source "$KESSEL_WORKFLOW_DEPLOYMENT/activate.sh" | ||
| fi | ||
| fi | ||
|
|
||
| unset _KESSEL_WORKFLOW_DEPLOYMENT | ||
| } | ||
|
|
||
| # Allocate an interactive compute node and drop into the deployment on it. All | ||
| # arguments are forwarded to the scheduler as already-split allocation | ||
| # parameters. Requires kessel_detect_system to have set KESSEL_SYSTEM_SCHEDULER. | ||
| kessel_alloc() { | ||
| _kessel_alloc_init="$KESSEL_DEPLOYMENT/kessel/lib/kessel/workflows/base/spack/deployment/alloc-init.sh" | ||
| case "$KESSEL_SYSTEM_SCHEDULER" in | ||
| slurm) | ||
| echo "salloc $*" >&2 | ||
| export SHELL="$_kessel_alloc_init" | ||
| salloc "$@" | ||
| ;; | ||
| flux) | ||
| echo "flux alloc $* $_kessel_alloc_init" >&2 | ||
| flux alloc "$@" "$_kessel_alloc_init" | ||
| ;; | ||
| *) | ||
| echo "ERROR: unknown scheduler '$KESSEL_SYSTEM_SCHEDULER'!" >&2 | ||
| unset _kessel_alloc_init | ||
| return 1 | ||
| ;; | ||
| esac | ||
| unset _kessel_alloc_init | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,36 @@ | ||
| # Pick the KESSEL_DEPLOYMENT for this cluster, then source the shared helpers | ||
| # that ship inside the deployment's kessel. | ||
| # Intended to work on sh, zsh, and bash. | ||
| DEPLOYMENT_VERSION="2025-10-21" | ||
| SCRIPT_PATH=${BASH_SOURCE[0]:-${(%):-%x}} | ||
| PARENT_DIR="$( cd "$( dirname "${SCRIPT_PATH}" )" &>/dev/null && pwd )" | ||
|
|
||
| export FLECSI_CHECKOUT=$(realpath $PARENT_DIR/..) | ||
| export PROJECT_CHECKOUT=$(realpath $PARENT_DIR/..) | ||
|
|
||
| # Just enough detection to choose the deployment path; kessel_detect_system does | ||
| # the rest. | ||
| if command -v jq >/dev/null 2>&1 && command -v sacctmgr >/dev/null 2>&1; then | ||
| SYSTEM_NAME=$(sacctmgr list --json clusters | jq -r '.clusters[0].name') | ||
| KESSEL_SYSTEM=$(sacctmgr list --json clusters | jq -r '.clusters[0].name') | ||
| elif command -v flux >/dev/null 2>&1; then | ||
| SYSTEM_NAME=$(hostname | sed 's/[0-9]//g') | ||
| KESSEL_SYSTEM=$(hostname | sed 's/[0-9]//g') | ||
| fi | ||
|
|
||
| # During a regular CI run the workflow deployment is always a temporary copy of | ||
| # the cluster deployment to allow customization. This can be overwritten by | ||
| # setting KESSEL_WORKFLOW_DEPLOYMENT to another persistent location. | ||
| export KESSEL_WORKFLOW_DEPLOYMENT="${KESSEL_WORKFLOW_DEPLOYMENT:-${TMPDIR:-/tmp}/$USER-ci-envs}" | ||
|
|
||
| if [ "$SYSTEM_NAME" = "darwin" ]; then | ||
| if [ "$KESSEL_SYSTEM" = "darwin" ]; then | ||
| export KESSEL_DEPLOYMENT=${KESSEL_DEPLOYMENT:-/usr/projects/YOUR_PROJECT/deployments/${DEPLOYMENT_VERSION}} | ||
| else | ||
| echo "ERROR: Unknown system!" >&2 | ||
| return 1 | ||
| fi | ||
|
|
||
| if [ -d "${KESSEL_DEPLOYMENT}" ] && [ ! -d "${KESSEL_WORKFLOW_DEPLOYMENT}" ]; then | ||
| source "${KESSEL_DEPLOYMENT}/activate.sh" | ||
| clone-deployment "${KESSEL_WORKFLOW_DEPLOYMENT}" | ||
| # Source the shared helpers (kessel_detect_system, kessel_activate_deployment). | ||
| _KESSEL_DEPLOYMENT_USE="$KESSEL_DEPLOYMENT/kessel/lib/kessel/workflows/base/spack/deployment/use.sh" | ||
| if [ ! -r "$_KESSEL_DEPLOYMENT_USE" ]; then | ||
| echo "ERROR: $_KESSEL_DEPLOYMENT_USE not found (deployment missing or too old)!" >&2 | ||
| return 1 | ||
| fi | ||
| source "$_KESSEL_DEPLOYMENT_USE" | ||
| unset _KESSEL_DEPLOYMENT_USE | ||
|
|
||
| source "${KESSEL_WORKFLOW_DEPLOYMENT}/activate.sh" | ||
| kessel_parse_persist "$@" || return $? | ||
| kessel_detect_system | ||
| kessel_activate_deployment |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.