Skip to content

Commit

Permalink
feat: add --ci-values
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Aug 28, 2024
1 parent e94ff41 commit 8ddb0a4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions demo/ci_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Extra settings that are added only for the CI jobs
diracx:
settings:
DIRACX_DEV_CRASH_ON_MISSED_ACCESS_POLICY: "true"
23 changes: 22 additions & 1 deletion run_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function element_not_in_array() {
return $found
}

usage="${0##*/} [-h|--help] [--exit-when-done] [--offline] [--enable-coverage] [--no-mount-containerd] [--set-value key=value] [--] [source directories]"
usage="${0##*/} [-h|--help] [--exit-when-done] [--offline] [--enable-coverage] [--no-mount-containerd] [--set-value key=value] [--ci-values=values.yaml] [--] [source directories]"
usage+="\n\n"
usage+=" -h|--help: Print this help message and exit\n"
usage+=" --exit-when-done: Exit after the demo has been started (it will be left running in the background)\n"
Expand All @@ -113,6 +113,7 @@ usage+=" --enable-open-telemetry: lauches OpenTelemetry collection.\n"
usage+=" WARNING: experimental and resource hungry.\n"
usage+=" --set-value: Set a value in the Helm values file. This can be used to override the default values.\n"
usage+=" For example, to enable coverage reporting pass: --set-value developer.enableCoverage=true\n"
usage+=" --ci-values: Path to a values.yaml file which contains diracx dev settings only enabled for CI\n"
usage+=" source directories: A list of directories containing Python packages to mount in the demo cluster.\n"

# Parse command-line switches
Expand All @@ -123,6 +124,8 @@ declare -a helm_arguments=()
enable_coverage=0
editable_python=1
open_telemetry=0
ci_values_file=""

while [ -n "${1:-}" ]; do case $1 in
# Print a brief usage summary and exit
-h|--help|-\?)
Expand Down Expand Up @@ -194,6 +197,20 @@ while [ -n "${1:-}" ]; do case $1 in
shift
continue ;;

--ci-values)
shift
if [[ -z "${1:-}" ]]; then
printf "%b Error: --ci-values requires an argument\n" ${SKULL_EMOJI}
exit 1
fi
ci_values_file=$(realpath "${1}")
if [[ ! -f "${ci_values_file}" ]]; then
printf "%b Error: --ci-values does not point to a file\n" ${SKULL_EMOJI}
exit 1;
fi
shift
continue ;;

# Double-dash: Terminate option parsing
--)
shift
Expand All @@ -211,6 +228,7 @@ while [ -n "${1:-}" ]; do case $1 in
esac; shift
done


# Remaining arguments are positional parameters that are used to specify which
# source directories to mount in the demo cluster
declare -a pkg_dirs=()
Expand Down Expand Up @@ -469,6 +487,9 @@ printf "%b Waiting for ingress controller to be created...\n" ${UNICORN_EMOJI}
# Install the DiracX chart
printf "%b Installing DiracX...\n" ${UNICORN_EMOJI}
helm_arguments+=("--values" "${demo_dir}/values.yaml")
if [[ -n "${ci_values_file}" ]]; then
helm_arguments+=("--values" "${ci_values_file}")
fi
if ! "${demo_dir}/helm" install --debug diracx-demo "${script_dir}/diracx" "${helm_arguments[@]}"; then
printf "%b Error using helm DiracX\n" ${WARN_EMOJI}
echo "Failed to run \"helm install\"" >> "${demo_dir}/.failed"
Expand Down

0 comments on commit 8ddb0a4

Please sign in to comment.