diff --git a/tools/deployment/multi-tenant/25_deploy_ephemeral_node.sh b/tools/deployment/multi-tenant/25_deploy_ephemeral_node.sh deleted file mode 120000 index ea3301727..000000000 --- a/tools/deployment/multi-tenant/25_deploy_ephemeral_node.sh +++ /dev/null @@ -1 +0,0 @@ -../common/25_deploy_ephemeral_node.sh \ No newline at end of file diff --git a/tools/deployment/multi-tenant/25_deploy_ephemeral_node.sh b/tools/deployment/multi-tenant/25_deploy_ephemeral_node.sh new file mode 100755 index 000000000..cbd8435d4 --- /dev/null +++ b/tools/deployment/multi-tenant/25_deploy_ephemeral_node.sh @@ -0,0 +1,21 @@ +#!/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 + +: ${AIRSHIPCTL_PROJECT:="../airshipctl"} + +cd ${AIRSHIPCTL_PROJECT} +./tools/deployment/25_deploy_ephemeral_node.sh + diff --git a/tools/deployment/templates/airshipconfig_template b/tools/deployment/templates/airshipconfig_template new file mode 100644 index 000000000..0a5c4311b --- /dev/null +++ b/tools/deployment/templates/airshipconfig_template @@ -0,0 +1,30 @@ +apiVersion: airshipit.org/v1alpha1 +managementConfiguration: + dummy_management_config: + type: ${REMOTE_TYPE} + insecure: ${REMOTE_INSECURE} + useproxy: ${REMOTE_PROXY} + systemActionRetries: ${SYSTEM_ACTION_RETRIES} + systemRebootDelay: ${SYSTEM_REBOOT_DELAY} +contexts: + ephemeral-cluster: + manifest: dummy_manifest + managementConfiguration: dummy_management_config + target-cluster: + manifest: dummy_manifest + managementConfiguration: dummy_management_config +currentContext: ephemeral-cluster +kind: Config +manifests: + dummy_manifest: + phaseRepositoryName: primary + repositories: + primary: + checkout: + branch: ${AIRSHIP_CONFIG_PHASE_REPO_BRANCH} + force: false + remoteRef: "" + tag: "" + url: ${AIRSHIP_CONFIG_PHASE_REPO_URL} + metadataPath: ${AIRSHIP_CONFIG_METADATA_PATH} + targetPath: ${AIRSHIP_CONFIG_MANIFEST_DIRECTORY} diff --git a/tools/gate/00_setup.sh b/tools/gate/00_setup.sh index 403d5456e..54b4125a7 100755 --- a/tools/gate/00_setup.sh +++ b/tools/gate/00_setup.sh @@ -1,21 +1,47 @@ #!/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 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# 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. +# 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 -export AIRSHIPCTL_PROJECT=${AIRSHIPCTL_PROJECT:="../airshipctl"} +export IMAGE_DIR=${IMAGE_DIR:-"/srv/images"} +export SERVE_PORT=${SERVE_PORT:-"8099"} export AIRSHIPCTL_WS=${AIRSHIPCTL_WS:-$PWD} +export TMP_DIR=${TMP_DIR:-"$(dirname $(mktemp -u))"} -cd ${AIRSHIPCTL_PROJECT} -./tools/gate/00_setup.sh \ No newline at end of file +ANSIBLE_CFG=${ANSIBLE_CFG:-"${HOME}/.ansible.cfg"} +ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"} +PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"} + +mkdir -p "$TMP_DIR" +envsubst <"${AIRSHIPCTL_WS}/tools/gate/config_template.yaml" > "$PLAYBOOK_CONFIG" + +# use new version of ansible, Ubuntu has old one +sudo apt update +sudo DEBIAN_FRONTEND=noninteractive apt -y install software-properties-common python3-pip curl wget ca-certificates +sudo DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends install docker.io make + +PACKAGES="ansible netaddr" +if [[ -z "${http_proxy}" ]]; then + sudo pip3 install $PACKAGES +else + sudo pip3 --proxy "${http_proxy}" install $PACKAGES +fi + +echo "primary ansible_host=localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3" > "$ANSIBLE_HOSTS" +printf "[defaults]\nroles_path = %s/roles\n" "$AIRSHIPCTL_WS" > "$ANSIBLE_CFG" diff --git a/tools/gate/10_build_gate.sh b/tools/gate/10_build_gate.sh index 935469c4c..aba2f4d13 100755 --- a/tools/gate/10_build_gate.sh +++ b/tools/gate/10_build_gate.sh @@ -1,20 +1,28 @@ #!/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 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# 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. +# 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 -: ${AIRSHIPCTL_PROJECT:="../airshipctl"} +TMP_DIR=${TMP_DIR:-"$(dirname $(mktemp -u))"} +ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"} +PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"} -cd ${AIRSHIPCTL_PROJECT} -./tools/gate/10_build_gate.sh +sudo -E ansible-playbook -i "$ANSIBLE_HOSTS" \ + playbooks/airship-treasuremap-build-gate.yaml \ + -e @"$PLAYBOOK_CONFIG" diff --git a/tools/gate/20_run_gate_runner.sh b/tools/gate/20_run_gate_runner.sh index b907d0d53..32e54628d 100755 --- a/tools/gate/20_run_gate_runner.sh +++ b/tools/gate/20_run_gate_runner.sh @@ -22,8 +22,8 @@ set -xe TMP_DIR=${TMP_DIR:-"$(dirname $(mktemp -u))"} ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"} PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"} - -export AIRSHIPCTL_WS=${AIRSHIPCTL_WS:-"../airshipctl"} +export AIRSHIPCTL_WS=${AIRSHIPCTL_WS:-$PWD} +export AIRSHIP_CONFIG_PHASE_REPO_URL=${AIRSHIP_CONFIG_PHASE_REPO_URL:-$PWD} sudo -E --preserve-env=AIRSHIPCTL_WS ANSIBLE_STDOUT_CALLBACK=debug ansible-playbook -i "$ANSIBLE_HOSTS" \ playbooks/airship-treasuremap-gate-runner.yaml \