diff options
Diffstat (limited to 'brep')
-rw-r--r-- | brep/handler/ci/ci-load.in | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/brep/handler/ci/ci-load.in b/brep/handler/ci/ci-load.in index 3f04ea8..6029b7b 100644 --- a/brep/handler/ci/ci-load.in +++ b/brep/handler/ci/ci-load.in @@ -10,6 +10,11 @@ # brep tenant id to this value and include the resulting URL in the response # message. # +# --cancel-url <url> +# CI task canceling URL base for the response. If specified, the handler will +# append the brep tenant id to this value and include the resulting URL in +# the response message. +# # <loader-path> # Loader program (normally brep-load(1)). # @@ -36,6 +41,7 @@ shopt -s nullglob # Expand no-match globs to nothing rather than themselves. # The handler's own options. # result_url= +cancel_url= while [[ "$#" -gt 0 ]]; do case $1 in --result-url) @@ -43,6 +49,11 @@ while [[ "$#" -gt 0 ]]; do result_url="${1%/}" shift ;; + --cancel-url) + shift + cancel_url="${1%/}" + shift + ;; *) break ;; @@ -114,6 +125,7 @@ spec= service_id= service_type= service_data= +service_load= while IFS=: read -ru "$manifest_parser_ofd" -d '' n v; do case "$n" in @@ -133,6 +145,14 @@ while IFS=: read -ru "$manifest_parser_ofd" -d '' n v; do service-id) service_id="$v" ;; service-type) service_type="$v" ;; service-data) service_data="$v" ;; + + service-action) + if [[ "$v" == "load" ]]; then + service_load=true + elif [[ "$v" != "start" ]]; then + error "unrecognized service action '$v'" + fi + ;; esac done @@ -331,6 +351,12 @@ if [[ -n "$service_id" ]]; then if [[ -n "$service_data" ]]; then loader_options+=(--service-data "$service_data") fi + + # Load the pre-created tenant rather than create a new one. + # + if [[ "$service_load" ]]; then + loader_options+=(--existing-tenant) + fi fi run "$loader" "${loader_options[@]}" "$loadtab" @@ -340,4 +366,11 @@ run "$loader" "${loader_options[@]}" "$loadtab" run rm -r "$data_dir" trace "CI request for '$spec' is queued$message_suffix" -exit_with_manifest 200 "CI request is queued$message_suffix" + +msg="CI request is queued$message_suffix" + +if [[ -n "$cancel_url" ]]; then + msg="$msg"$'\n'"To cancel CI request: $cancel_url=$reference&reason=" +fi + +exit_with_manifest 200 "$msg" |