From 5343f76bc103b4779ffbacf0b24d8d2cb2e27a0a Mon Sep 17 00:00:00 2001 From: Evgeny L Date: Fri, 26 Apr 2019 16:35:14 +0000 Subject: [PATCH] Use the Airship CLI for lint and Airskiff gates Using Airship CLI script allows us to use pegleg image configured in versions.yaml, which will be updated during regular uplift procedure. Change-Id: I68a6e5477fc72fb52dfc893b6eef69dd64320ded --- tools/airship | 5 +++- .../developer/005-clone-dependencies.sh | 1 - .../developer/030-armada-bootstrap.sh | 11 ++------ .../airskiff/developer/100-deploy-osh.sh | 26 +++++-------------- tools/gate/lint-site.sh | 8 +----- tools/gate/wait-for-shipyard.sh | 2 +- 6 files changed, 15 insertions(+), 38 deletions(-) diff --git a/tools/airship b/tools/airship index 0a8a06d82..5157a859a 100755 --- a/tools/airship +++ b/tools/airship @@ -14,7 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -: ${TERM_OPTS:='-it'} +DEFAULT_TERM_OPTS=' ' +# Set an interactive mode only if there is a TTY available. +test -t 1 && test -t 0 && DEFAULT_TERM_OPTS='-it' +: ${TERM_OPTS:=${DEFAULT_TERM_OPTS}} # Python YAML module required to read versions.yaml dpkg -s python3-yaml &> /dev/null || apt -y install python3-yaml diff --git a/tools/deployment/airskiff/developer/005-clone-dependencies.sh b/tools/deployment/airskiff/developer/005-clone-dependencies.sh index f3ac088e4..af5c31c00 100755 --- a/tools/deployment/airskiff/developer/005-clone-dependencies.sh +++ b/tools/deployment/airskiff/developer/005-clone-dependencies.sh @@ -26,7 +26,6 @@ cd ${INSTALL_PATH} # Clone Airship projects git clone https://opendev.org/airship/armada.git git clone https://opendev.org/airship/deckhand.git -git clone https://opendev.org/airship/pegleg.git git clone https://opendev.org/airship/shipyard.git # Clone dependencies diff --git a/tools/deployment/airskiff/developer/030-armada-bootstrap.sh b/tools/deployment/airskiff/developer/030-armada-bootstrap.sh index cdb1e1764..3e8b86f19 100755 --- a/tools/deployment/airskiff/developer/030-armada-bootstrap.sh +++ b/tools/deployment/airskiff/developer/030-armada-bootstrap.sh @@ -17,19 +17,12 @@ set -xe -CURRENT_DIR="$(pwd)" : "${INSTALL_PATH:="$(pwd)/../"}" - -: "${PL_PATH:="../pegleg"}" - -# NOTE: Image to use for all Pegleg operations -: "${PL_IMAGE:=quay.io/airshipit/pegleg:latest}" - -: "${PEGLEG:="${PL_PATH}/tools/pegleg.sh"}" +: "${PEGLEG:="./tools/airship pegleg"}" : "${PL_SITE:="airskiff"}" # Render documents -IMAGE=${PL_IMAGE} TERM_OPTS=" " ${PEGLEG} site -r . render "${PL_SITE}" -o airskiff.yaml +${PEGLEG} site -r . render "${PL_SITE}" -o airskiff.yaml # Download latest Armada image and deploy Airship components docker run --rm --net host -p 8000:8000 --name armada \ diff --git a/tools/deployment/airskiff/developer/100-deploy-osh.sh b/tools/deployment/airskiff/developer/100-deploy-osh.sh index 13bc1678f..39fb133bb 100755 --- a/tools/deployment/airskiff/developer/100-deploy-osh.sh +++ b/tools/deployment/airskiff/developer/100-deploy-osh.sh @@ -17,16 +17,10 @@ set -xe -# Deploy OpenStack using Airship -CURRENT_DIR="$(pwd)" -: "${PL_PATH:="../pegleg"}" -: "${SY_PATH:="../shipyard"}" - -# NOTE: Image to use for all Pegleg operations -: "${PL_IMAGE:=quay.io/airshipit/pegleg:latest}" - # Lint deployment documents -: "${PEGLEG:="${PL_PATH}/tools/pegleg.sh"}" +: "${AIRSHIP_PATH:="./tools/airship"}" +: "${PEGLEG:="${AIRSHIP_PATH} pegleg"}" +: "${SHIPYARD:="${AIRSHIP_PATH} shipyard"}" : "${PL_SITE:="airskiff"}" # Source OpenStack credentials for Airship utility scripts @@ -35,23 +29,17 @@ CURRENT_DIR="$(pwd)" # NOTE(drewwalters96): Disable Pegleg linting errors P001 and P009; a # a cleartext storage policy is acceptable for non-production use cases # and maintain consistency with other treasuremap sites. -IMAGE=${PL_IMAGE} TERM_OPTS=" " ${PEGLEG} site -r . lint "${PL_SITE}" -x P001 -x P009 +${PEGLEG} site -r . lint "${PL_SITE}" -x P001 -x P009 # Collect deployment documents : "${PL_OUTPUT:="peggles"}" mkdir -p ${PL_OUTPUT} -IMAGE=${PL_IMAGE} TERM_OPTS="-l info" ${PEGLEG} site -r . collect ${PL_SITE} -s ${PL_OUTPUT} -cp -rp "${CURRENT_DIR}"/${PL_OUTPUT} ${SY_PATH} - -# Deploy Airskiff site -cd ${SY_PATH} -: "${SHIPYARD:="./tools/shipyard.sh"}" +TERM_OPTS="-l info" ${PEGLEG} site -r . collect ${PL_SITE} -s ${PL_OUTPUT} +# Start the deployment ${SHIPYARD} create configdocs airskiff-design \ --replace \ - --directory=/target/${PL_OUTPUT} - + --directory=${PL_OUTPUT} ${SHIPYARD} commit configdocs ${SHIPYARD} create action update_software --allow-intermediate-commits -cd "${CURRENT_DIR}" diff --git a/tools/gate/lint-site.sh b/tools/gate/lint-site.sh index bad6bb012..c6f57185e 100755 --- a/tools/gate/lint-site.sh +++ b/tools/gate/lint-site.sh @@ -16,11 +16,5 @@ set -xe -: "${PEGLEG_PATH:=../pegleg}" -: "${PEGLEG_IMG:=quay.io/airshipit/pegleg:b7556bd89e99f2a6539e97d5a4ac6738751b9c55}" - -: "${PEGLEG:=${PEGLEG_PATH}/tools/pegleg.sh}" - # TODO(drewwalters96): make Treasuremap sites P001 and P009 compliant. -IMAGE=${PEGLEG_IMG} TERM_OPTS=" " \ - ${PEGLEG} site -r . lint "$1" -x P001 -x P009 +TERM_OPTS=" " ./tools/airship pegleg site -r . lint "$1" -x P001 -x P009 diff --git a/tools/gate/wait-for-shipyard.sh b/tools/gate/wait-for-shipyard.sh index 776d938d0..c66ea2ae7 100755 --- a/tools/gate/wait-for-shipyard.sh +++ b/tools/gate/wait-for-shipyard.sh @@ -16,7 +16,7 @@ set -e -: "${SHIPYARD:=../shipyard/tools/shipyard.sh}" +: "${SHIPYARD:=./tools/airship shipyard}" # Source OpenStack credentials for Airship utility scripts . tools/deployment/airskiff/common/os-env.sh