From 8ddb0a41d247a8030909c98378eb74aa38fe36c8 Mon Sep 17 00:00:00 2001 From: Christophe Haen Date: Wed, 28 Aug 2024 14:32:19 +0200 Subject: [PATCH] feat: add --ci-values --- demo/ci_values.yaml | 4 ++++ run_demo.sh | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 demo/ci_values.yaml diff --git a/demo/ci_values.yaml b/demo/ci_values.yaml new file mode 100644 index 0000000..37b924c --- /dev/null +++ b/demo/ci_values.yaml @@ -0,0 +1,4 @@ +# Extra settings that are added only for the CI jobs +diracx: + settings: + DIRACX_DEV_CRASH_ON_MISSED_ACCESS_POLICY: "true" diff --git a/run_demo.sh b/run_demo.sh index cb10603..f2a0935 100755 --- a/run_demo.sh +++ b/run_demo.sh @@ -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" @@ -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 @@ -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|-\?) @@ -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 @@ -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=() @@ -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"