Deployment script enhancements

Added 10 script to install required packages and tools for a new build node
Fixed docker cmd permisson error in 21 script
Fixed medadata path to use the SITE environment variable in 22 script
Added abibility to configure nocheckout option in document pull

Signed-off-by: James Gu <james.gu@att.com>
Change-Id: Iea7c3e2cdac473188007e218f87889f6c1846bda
This commit is contained in:
James Gu 2021-04-06 16:41:15 -07:00
parent f825c605f4
commit da5116921d
5 changed files with 49 additions and 8 deletions

View File

@ -2,3 +2,4 @@
host=review.opendev.org
port=29418
project=airship/airshipctl.git
defaultbranch=v2.0

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# 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 -xe
install_pkg(){
for i in "$@"; do
dpkg -l $i 2> /dev/null | grep ^ii > /dev/null || sudo DEBIAN_FRONTEND=noninteractive -E apt -y install $i
done
}
if [ ! -f /var/lib/apt/periodic/update-success-stamp ] || \
sudo find /var/lib/apt/periodic/update-success-stamp -mtime +1 | grep update-success-stamp; then
sudo -E apt -y update
fi
install_pkg curl docker.io make
./tools/deployment/provider_common/02_install_jq.sh
./tools/deployment/provider_common/03_install_pip.sh
./tools/deployment/provider_common/04_install_yq.sh
./tools/deployment/01_install_kubectl.sh
./tools/install_kustomize.sh

View File

@ -21,13 +21,13 @@ export NO_PROXY=${NO_PROXY:-${no_proxy}}
export PROXY=${PROXY:-${http_proxy}}
echo "Build airshipctl docker images"
make images
sudo -E make images
echo "Copy airshipctl from docker image"
DOCKER_IMAGE_TAG=$(make print-docker-image-tag)
CONTAINER=$(docker create "${DOCKER_IMAGE_TAG}")
sudo docker cp "${CONTAINER}:/usr/local/bin/airshipctl" "/usr/local/bin/airshipctl"
sudo docker rm "${CONTAINER}"
DOCKER_IMAGE_TAG=$(sudo -E make print-docker-image-tag)
CONTAINER=$(sudo -E docker create "${DOCKER_IMAGE_TAG}")
sudo -E docker cp "${CONTAINER}:/usr/local/bin/airshipctl" "/usr/local/bin/airshipctl"
sudo -E docker rm "${CONTAINER}"
if ! airshipctl version | grep -q 'airshipctl'; then
echo "Unable to verify airshipctl command. Please verify if the airshipctl is installed in /usr/local/bin/"

View File

@ -30,7 +30,8 @@ export REMOTE_PROXY=false
export AIRSHIP_CONFIG_ISO_SERVE_HOST=${HOST:-"localhost"}
export AIRSHIP_CONFIG_ISO_PORT=${SERVE_PORT}
export AIRSHIP_CONFIG_ISO_NAME=${ISO_NAME:-"ephemeral.iso"}
export AIRSHIP_CONFIG_METADATA_PATH=${AIRSHIP_CONFIG_METADATA_PATH:-"manifests/site/test-site/metadata.yaml"}
export SITE=${SITE:-"test-site"}
export AIRSHIP_CONFIG_METADATA_PATH=${AIRSHIP_CONFIG_METADATA_PATH:-"manifests/site/${SITE}/metadata.yaml"}
export SYSTEM_ACTION_RETRIES=30
export SYSTEM_REBOOT_DELAY=30
export AIRSHIP_CONFIG_PHASE_REPO_BRANCH=${BRANCH:-"master"}
@ -38,7 +39,6 @@ export AIRSHIP_CONFIG_PHASE_REPO_BRANCH=${BRANCH:-"master"}
export AIRSHIP_CONFIG_PHASE_REPO_URL=${AIRSHIP_CONFIG_PHASE_REPO_URL:-"https://review.opendev.org/airship/airshipctl"}
export AIRSHIP_CONFIG_PHASE_REPO_NAME=${AIRSHIP_CONFIG_PHASE_REPO_NAME:-"airshipctl"}
export AIRSHIP_CONFIG_MANIFEST_DIRECTORY=${AIRSHIP_CONFIG_MANIFEST_DIRECTORY:-"/tmp/airship"}
export SITE=${SITE:-"test-site"}
export EXTERNAL_KUBECONFIG=${EXTERNAL_KUBECONFIG:-""}
# Remove the contents of the .airship folder, preserving the kustomize plugin directory

View File

@ -14,5 +14,11 @@
set -xe
NO_CHECKOUT=${NO_CHECKOUT:-"true"}
echo "Pull site documents using airshipctl"
airshipctl document pull -n --debug
if [ ${NO_CHECKOUT} == "true" ]; then
airshipctl document pull -n --debug
else
airshipctl document pull --debug
fi