diff options
Diffstat (limited to 'brep/handler/ci')
-rw-r--r-- | brep/handler/ci/ci-load.in | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/brep/handler/ci/ci-load.in b/brep/handler/ci/ci-load.in index d568341..b3c05f0 100644 --- a/brep/handler/ci/ci-load.in +++ b/brep/handler/ci/ci-load.in @@ -108,6 +108,14 @@ declare -A packages # spec= +# Third party service information which, if specified, needs to be associated +# with the being created tenant. +# +service_id= +service_type= +service_data= +service_load= + while IFS=: read -ru "$manifest_parser_ofd" -d '' n v; do case "$n" in repository) repository="$v" ;; @@ -122,6 +130,18 @@ while IFS=: read -ru "$manifest_parser_ofd" -d '' n v; do fi spec="$spec$v" ;; + + 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 @@ -141,6 +161,12 @@ if [[ -n "$simulate" && "$simulate" != "success" ]]; then exit_with_manifest 400 "unrecognized simulation outcome '$simulate'" fi +# Use the generated reference if the tenant service id is not specified. +# +if [[ -n "$service_type" && -z "$service_id" ]]; then + service_id="$reference" +fi + message_suffix= if [[ -n "$result_url" ]]; then message_suffix=": $result_url/@$reference" # Append the tenant id. @@ -277,7 +303,7 @@ run mv "$cache_dir/packages.manifest" "$cache_dir/packages.manifest.orig" # manifest_serializer_start "$cache_dir/packages.manifest" -for ((i=0; i <= "${#packages_manifest_names[@]}"; ++i)); do +for ((i=0; i != "${#packages_manifest_names[@]}"; ++i)); do manifest_serialize "${packages_manifest_names[$i]}" \ "${packages_manifest_values[$i]}" done @@ -306,6 +332,22 @@ if [[ -n "$interactive" ]]; then loader_options+=(--interactive "$interactive") fi +# Pass the tenant service information, if specified, to the loader. +# +if [[ -n "$service_id" ]]; then + loader_options+=(--service-id "$service_id" --service-type "$service_type") + + 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" # Remove the no longer needed CI request data directory. |