diff --git a/tools/multi_nodes_gate/airship_gate/bin/drydock.sh b/tools/multi_nodes_gate/airship_gate/bin/drydock.sh new file mode 100755 index 00000000..273d7efd --- /dev/null +++ b/tools/multi_nodes_gate/airship_gate/bin/drydock.sh @@ -0,0 +1,25 @@ + +#!/usr/bin/env bash +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +SCRIPT_DIR=$(realpath $(dirname $0)) +WORKSPACE=$(realpath ${SCRIPT_DIR}/../../..) +GATE_UTILS=${WORKSPACE}/multi_nodes_gate/airship_gate/lib/all.sh + +source ${GATE_UTILS} + +drydock_cmd $@ diff --git a/tools/multi_nodes_gate/airship_gate/bin/shipyard.sh b/tools/multi_nodes_gate/airship_gate/bin/shipyard.sh new file mode 100755 index 00000000..63e89174 --- /dev/null +++ b/tools/multi_nodes_gate/airship_gate/bin/shipyard.sh @@ -0,0 +1,25 @@ + +#!/usr/bin/env bash +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +SCRIPT_DIR=$(realpath $(dirname $0)) +WORKSPACE=$(realpath ${SCRIPT_DIR}/../../..) +GATE_UTILS=${WORKSPACE}/multi_nodes_gate/airship_gate/lib/all.sh + +source ${GATE_UTILS} + +shipyard_cmd $@ diff --git a/tools/multi_nodes_gate/airship_gate/lib/airship.sh b/tools/multi_nodes_gate/airship_gate/lib/airship.sh index e4ee1d3d..9ed44ced 100644 --- a/tools/multi_nodes_gate/airship_gate/lib/airship.sh +++ b/tools/multi_nodes_gate/airship_gate/lib/airship.sh @@ -1,9 +1,32 @@ #!/bin/bash +shipard_cmd_stdout() { + ssh_cmd "${GENESIS_NAME}" docker run -t --network host -v "${GENESIS_WORK_DIR}:/work" -e OS_AUTH_URL=http://keystone.ucp.svc.cluster.local:80/v3 -e OS_USERNAME=shipyard -e OS_USER_DOMAIN_NAME=default -e OS_PASSWORD="${SHIPYARD_PASSWORD}" -e OS_PROJECT_DOMAIN_NAME=default -e OS_PROJECT_NAME=service --entrypoint /usr/local/bin/shipyard "${IMAGE_SHIPYARD_CLI}" $* 2>&1 +} + shipyard_cmd() { - set -o pipefail - ssh_cmd "${GENESIS_NAME}" docker run -t --network host -v "${GENESIS_WORK_DIR}:/work" -e OS_AUTH_URL=http://keystone.ucp.svc.cluster.local:80/v3 -e OS_USERNAME=shipyard -e OS_USER_DOMAIN_NAME=default -e OS_PASSWORD="${SHIPYARD_PASSWORD}" -e OS_PROJECT_DOMAIN_NAME=default -e OS_PROJECT_NAME=service "${IMAGE_SHIPYARD_CLI}" $* 2>&1 | tee -a "${LOG_FILE}" - set +o pipefail + if [[ ! -z "${LOG_FILE}" ]] + then + set -o pipefail + shipard_cmd_stdout $* | tee -a "${LOG_FILE}" + set +o pipefail + else + shipard_cmd_stdout $* + fi +} + +drydock_cmd_stdout() { + ssh_cmd "${GENESIS_NAME}" docker run -t --network host -v "${GENESIS_WORK_DIR}:/work" -e DD_URL=http://drydock-api.ucp.svc.cluster.local:9000 -e OS_AUTH_URL=http://keystone.ucp.svc.cluster.local:80/v3 -e OS_USERNAME=shipyard -e OS_USER_DOMAIN_NAME=default -e OS_PASSWORD="${SHIPYARD_PASSWORD}" -e OS_PROJECT_DOMAIN_NAME=default -e OS_PROJECT_NAME=service --entrypoint /usr/local/bin/drydock "${IMAGE_DRYDOCK_CLI}" $* 2>&1 +} +drydock_cmd() { + if [[ ! -z "${LOG_FILE}" ]] + then + set -o pipefail + drydock_cmd_stdout $* | tee -a "${LOG_FILE}" + set +o pipefail + else + drydock_cmd_stdout $* + fi } # Create a shipyard action diff --git a/tools/multi_nodes_gate/airship_gate/lib/config.sh b/tools/multi_nodes_gate/airship_gate/lib/config.sh index ed301c0a..ec165b13 100644 --- a/tools/multi_nodes_gate/airship_gate/lib/config.sh +++ b/tools/multi_nodes_gate/airship_gate/lib/config.sh @@ -10,6 +10,7 @@ export IMAGE_PROMENADE_CLI=${IMAGE_PROMENADE_CLI:-quay.io/airshipit/promenade:ma export IMAGE_PEGLEG_CLI=${IMAGE_PEGLEG_CLI:-quay.io/airshipit/pegleg:ac6297eae6c51ab2f13a96978abaaa10cb46e3d6} export IMAGE_SHIPYARD_CLI=${IMAGE_SHIPYARD_CLI:-quay.io/airshipit/shipyard:master} export IMAGE_COREDNS=${IMAGE_COREDNS:-docker.io/coredns/coredns:1.2.2} +export IMAGE_DRYDOCK_CLI=${IMAGE_DRYDOCK_CLI:-quay.io/airshipit/drydock:master} export PROMENADE_DEBUG=${PROMENADE_DEBUG:-0} export SHIPYARD_PASSWORD=${SHIPYARD_OS_PASSWORD:-password18} export REGISTRY_DATA_DIR=${REGISTRY_DATA_DIR:-/mnt/registry}