diff --git a/.zuul.yaml b/.zuul.yaml index a9274ff5..75cf1bd9 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -30,6 +30,7 @@ - deckhand-openstack-tox-pep8-focal - deckhand-openstack-tox-cover-focal - deckhand-airskiff-deployment-focal + # - deckhand-airskiff-deployment-focal-kubeadm gate: jobs: @@ -39,6 +40,7 @@ - deckhand-integration-uwsgi-py38 - deckhand-integration-docker-py38 - deckhand-chart-build-gate + - deckhand-chart-build-latest-htk - deckhand-docker-build-gate - deckhand-openstack-tox-pep8-focal - deckhand-openstack-tox-cover-focal @@ -78,36 +80,34 @@ name: deckhand-openstack-tox-pep8-focal parent: openstack-tox-pep8 description: Runs pep8 job on focal - nodeset: deckhand-single-node-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal - job: name: deckhand-openstack-tox-cover-focal parent: openstack-tox-cover description: Runs cover job on focal - nodeset: deckhand-single-node-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal - job: name: deckhand-tox-py38-postgresql parent: openstack-tox-py38 - nodeset: deckhand-single-node-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal pre-run: - - tools/gate/playbooks/install-postgresql.yaml + - tools/gate/playbooks/prepare-hosts.yaml vars: tox_envlist: py38-postgresql - - job: - name: deckhand-functional-uwsgi-py38 - voting: true - description: | - Run tox-based functional tests for the Airship Deckhand project using a - minimalistic deployment consisting of uwsgi for Deckhand API and pifpaf - for ephemeral PostgreSQL DB, under cPython version 3.8. - run: tools/gate/playbooks/run-functional-tests-uwsgi.yaml - nodeset: deckhand-single-node-focal - vars: - tox_envlist: py38-functional-dev - distro: ubuntu_focal + name: deckhand-base + abstract: true + roles: + - zuul: openstack/openstack-helm-infra + - zuul: zuul/zuul-jobs + required-projects: + - name: openstack/openstack-helm + - name: openstack/openstack-helm-infra + - name: airship/treasuremap + override-checkout: v1.9 irrelevant-files: &irrelevant-files - ^.*\.rst$ - ^doc/.*$ @@ -115,22 +115,43 @@ - ^releasenotes/.*$ - ^setup.cfg$ - ^deckhand/tests/unit/.*$ - -- job: - name: deckhand-functional-docker-base - description: | - Base job for running deckhand functional tests. Runs tests - against Docker image generated from source code. - nodeset: deckhand-single-node-focal - roles: - - zuul: openstack/openstack-helm-infra - timeout: 3600 + timeout: 10800 pre-run: - - tools/gate/playbooks/osh-infra-upgrade-host.yaml - - tools/gate/playbooks/osh-infra-deploy-docker.yaml - run: tools/gate/playbooks/run-functional-tests-docker.yaml - required-projects: - - openstack/openstack-helm-infra + - tools/gate/playbooks/prepare-hosts.yaml + - tools/gate/playbooks/mount-volumes.yaml + - tools/gate/playbooks/deploy-env.yaml + run: + - tools/gate/playbooks/airship-run-scripts.yaml + post-run: + - tools/gate/playbooks/osh-infra-collect-logs.yaml + vars: + extra_volume: + size: 80G + type: Linux + mount_point: /opt/ext_vol + docker: + root_path: "/opt/ext_vol/docker" + containerd: + root_path: "/opt/ext_vol/containerd" + kubeadm: + pod_network_cidr: "10.244.0.0/24" + service_cidr: "10.96.0.0/16" + loopback_setup: true + loopback_device: /dev/loop100 + loopback_image: "/opt/ext_vol/openstack-helm/ceph-loop.img" + ceph_osd_data_device: /dev/loop100 + kube_version: "1.28.4-1.1" + calico_version: "v3.27.0" + coredns_version: "v1.11.1" + helm_version: "v3.13.2" + yq_version: "v4.6.0" + crictl_version: "v1.26.1" + zuul_osh_relative_path: ../../openstack/openstack-helm + zuul_osh_infra_relative_path: ../../openstack/openstack-helm-infra + zuul_treasuremap_relative_path: ../../airship/treasuremap + gate_scripts_relative_path: ../../openstack/openstack-helm-infra + run_helm_tests: "no" + - job: name: deckhand-functional-docker-py38 @@ -138,39 +159,67 @@ Run tox-based functional tests for the Airship Deckhand project under cPython version 3.8. Uses tox with the ``functional-py38`` environment. Ubuntu (focal) image is built and used. - parent: deckhand-functional-docker-base - nodeset: deckhand-single-node-focal + parent: deckhand-base + run: tools/gate/playbooks/run-functional-tests-docker.yaml + nodeset: treasuremap-airskiff-1node-ubuntu_focal vars: tox_envlist: py38-functional disable_keystone: true distro: ubuntu_focal irrelevant-files: *irrelevant-files +- job: + name: deckhand-functional-uwsgi-py38 + description: | + Run tox-based functional tests for the Airship Deckhand project using a + minimalistic deployment consisting of uwsgi for Deckhand API and pifpaf + for ephemeral PostgreSQL DB, under cPython version 3.8. + parent: deckhand-base + run: tools/gate/playbooks/run-functional-tests-uwsgi.yaml + nodeset: treasuremap-airskiff-1node-ubuntu_focal + vars: + tox_envlist: py38-functional-dev + distro: ubuntu_focal + irrelevant-files: *irrelevant-files + - job: name: deckhand-integration-uwsgi-py38 - voting: true description: | Run tox-based integration tests for the Airship Deckhand project using a minimalistic deployment consisting of uwsgi for Deckhand API and pifpaf for ephemeral PostgreSQL DB, under cPython version 3.8. - timeout: 9600 + parent: deckhand-base run: tools/gate/playbooks/run-integration-tests-uwsgi.yaml - nodeset: deckhand-single-node-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal irrelevant-files: *irrelevant-files vars: disable_keystone: true distro: ubuntu_focal +- job: + name: deckhand-integration-docker-py38 + description: | + Run tox-based integration tests for the Airship Deckhand project under + cPython version 3.8. Builds ubuntu (focal) deckhand image. + parent: deckhand-base + run: tools/gate/playbooks/run-integration-tests-docker.yaml + nodeset: treasuremap-airskiff-1node-ubuntu_focal + vars: + tox_envlist: py38-functional + disable_keystone: false + distro: ubuntu_focal + irrelevant-files: *irrelevant-files + - job: name: deckhand-chart-build-gate description: | Build charts using pinned Helm toolkit. timeout: 900 run: tools/gate/playbooks/build-charts.yaml - nodeset: deckhand-single-node-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal vars: - HTK_COMMIT: ae91cf3fc3f288b6d92ace4a3a405606a653638f + HTK_COMMIT: cfff60ec10a6c386f38db79bb9f59a552c2b032f - job: name: deckhand-chart-build-latest-htk @@ -178,53 +227,14 @@ Build charts using latest Helm toolkit. timeout: 900 run: tools/gate/playbooks/build-charts.yaml - nodeset: deckhand-single-node-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal vars: HTK_COMMIT: master -- job: - name: deckhand-integration-docker-base - description: | - Base job for running deckhand integration tests. Runs tests - against Docker image generated from source code. - nodeset: deckhand-single-node-focal - timeout: 3600 - roles: - - zuul: openstack/openstack-helm-infra - vars: - zuul_osh_relative_path: ../../openstack/openstack-helm/ - zuul_osh_infra_relative_path: ../../openstack/openstack-helm-infra/ - zuul_treasuremap_relative_path: ../../airship/treasuremap/ - pre-run: - - tools/gate/playbooks/osh-infra-upgrade-host.yaml - - tools/gate/playbooks/osh-infra-deploy-docker.yaml - run: - - tools/gate/playbooks/run-integration-tests-docker.yaml - post-run: tools/gate/playbooks/osh-infra-collect-logs.yaml - required-projects: - - openstack/openstack-helm - - openstack/openstack-helm-infra - - airship/treasuremap - irrelevant-files: - - ^.*\.rst$ - - ^doc/.*$ - - ^releasenotes/.*$ - -- job: - name: deckhand-integration-docker-py38 - description: | - Run tox-based integration tests for the Airship Deckhand project under - cPython version 3.8. Builds ubuntu (focal) deckhand image. - parent: deckhand-integration-docker-base - nodeset: deckhand-single-node-focal - vars: - disable_keystone: false - distro: ubuntu_focal - - job: name: deckhand-airskiff-deployment-focal voting: true - nodeset: deckhand-single-node-airskiff-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal description: | Deploy Memcached using Airskiff and submitted Deckhand changes. timeout: 9600 @@ -243,17 +253,48 @@ OSH_INFRA_COMMIT: cfff60ec10a6c386f38db79bb9f59a552c2b032f OSH_COMMIT: 2d9457e34ca4200ed631466bd87569b0214c92e7 distro: ubuntu_focal - irrelevant-files: - - ^.*\.rst$ - - ^doc/.*$ - - ^releasenotes/.*$ + irrelevant-files: *irrelevant-files +- job: + name: deckhand-airskiff-deployment-focal-kubeadm + nodeset: treasuremap-airskiff-1node-ubuntu_focal + description: | + Deploy Memcached using Airskiff and submitted Deckhand changes. + parent: deckhand-base + vars: + site: airskiff + HELM_ARTIFACT_URL: https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz + HTK_COMMIT: cfff60ec10a6c386f38db79bb9f59a552c2b032f + OSH_INFRA_COMMIT: cfff60ec10a6c386f38db79bb9f59a552c2b032f + OSH_COMMIT: 2d9457e34ca4200ed631466bd87569b0214c92e7 + distro: ubuntu_focal + CLONE_DECKHAND: false + DECKHAND_IMAGE_DISTRO: ubuntu_focal + gate_scripts_relative_path: ../../airship/treasuremap + gate_scripts: + - ./tools/deployment/airskiff/developer/000-prepare-k8s.sh + - ./tools/deployment/airskiff/developer/009-setup-apparmor.sh + - ./tools/deployment/airskiff/developer/000-clone-dependencies.sh + - ./tools/deployment/airskiff/developer/020-setup-client.sh + - ./tools/deployment/airskiff/developer/015-make-all-charts.sh + - ./tools/deployment/airskiff/developer/025-start-artifactory.sh + - ./tools/deployment/airskiff/developer/026-reduce-site.sh + - ./tools/deployment/airskiff/common/sleep.sh + # TODO + # in treasuremap we need to create make local images script that will build + # local version of the image in order to be used instead of upstream image + - ./tools/deployment/airskiff/developer/030-armada-bootstrap.sh + - ./tools/deployment/airskiff/developer/100-deploy-osh.sh + - ./tools/deployment/airskiff/common/os-env.sh + - ./tools/gate/wait-for-shipyard.sh + - ./tools/deployment/airskiff/common/sleep.sh + irrelevant-files: *irrelevant-files - job: name: deckhand-docker-build-gate timeout: 3600 run: tools/gate/playbooks/docker-image-build.yaml - nodeset: deckhand-single-node-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal irrelevant-files: &non-code-files-template - ^.*\.rst$ - ^doc/.*$ @@ -276,7 +317,7 @@ listed in vars section. Waits in Zuul queue for a node (VM) assignment. timeout: 3600 run: tools/gate/playbooks/docker-image-build.yaml - nodeset: deckhand-single-node-focal + nodeset: treasuremap-airskiff-1node-ubuntu_focal secrets: - airship_deckhand_quay_creds irrelevant-files: *non-code-files-template diff --git a/bindep.txt b/bindep.txt index fdcc7d7d..0b8697f6 100644 --- a/bindep.txt +++ b/bindep.txt @@ -11,4 +11,5 @@ libsasl2-dev [platform:dpkg] libssl-dev [platform:dpkg] libre2-dev [platform:dpkg] postgresql [platform:dpkg] +postgresql-contrib [platform:dpkg] ethtool [platform:dpkg] diff --git a/tools/gate/playbooks/airship-run-scripts.yaml b/tools/gate/playbooks/airship-run-scripts.yaml new file mode 100644 index 00000000..6e29edc0 --- /dev/null +++ b/tools/gate/playbooks/airship-run-scripts.yaml @@ -0,0 +1,75 @@ +# 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. + +--- +- hosts: primary + tasks: + - name: Override images + when: buildset_registry is defined + vars: + work_dir: "{{ zuul.project.src_dir }}" + block: + - name: Buildset registry alias + include_role: + name: deploy-env + tasks_from: buildset_registry_alias + + - name: Print zuul + debug: + var: zuul + + - name: Override proposed images from artifacts + shell: > + find {{ override_paths | join(" ") }} -type f -exec sed -Ei + "s#['\"]?docker\.io/({{ repo }}):({{ tag }})['\"]?\$#{{ buildset_registry_alias }}:{{ buildset_registry.port }}/\1:\2#g" {} + + loop: "{{ zuul.artifacts | default([]) }}" + args: + chdir: "{{ work_dir }}" + loop_control: + loop_var: zj_zuul_artifact + when: "'metadata' in zj_zuul_artifact and zj_zuul_artifact.metadata.type | default('') == 'container_image'" + vars: + tag: "{{ zj_zuul_artifact.metadata.tag }}" + repo: "{{ zj_zuul_artifact.metadata.repository }}" + override_paths: + - ../openstack-helm*/*/values* + - ../openstack-helm-infra/tools/deployment/ + + - name: Diff + shell: | + set -ex; + for dir in openstack-helm openstack-helm-infra; do + path="{{ work_dir }}/../${dir}/" + if [ ! -d "${path}" ]; then continue; fi + echo "${dir} diff" + cd "${path}"; git diff; cd -; + done + + - name: "creating directory for run artifacts" + file: + path: "/tmp/artifacts" + state: directory + + - name: Run gate scripts + include_role: + name: "{{ ([item] | flatten | length == 1) | ternary('airship-run-script', 'airship-run-script-set') }}" + vars: + workload: "{{ [item] | flatten }}" + loop: "{{ gate_scripts }}" + + - name: "Downloads artifacts to executor" + synchronize: + src: "/tmp/artifacts" + dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}" + mode: pull + ignore_errors: True +... diff --git a/tools/gate/roles/install-postgresql/tasks/install-postgresql.yaml b/tools/gate/playbooks/deploy-env.yaml similarity index 57% rename from tools/gate/roles/install-postgresql/tasks/install-postgresql.yaml rename to tools/gate/playbooks/deploy-env.yaml index 1e9b5679..39b4acfc 100644 --- a/tools/gate/roles/install-postgresql/tasks/install-postgresql.yaml +++ b/tools/gate/playbooks/deploy-env.yaml @@ -1,5 +1,3 @@ -# 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 @@ -12,12 +10,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Install PostgreSQL - shell: |- - set -xe; - if [ -z $(which pg_config) ]; then - apt-get update -y - apt-get install postgresql postgresql-contrib -y - apt-get install libpq-dev -y - fi - become: yes +--- +- hosts: all + become: true + gather_facts: true + + roles: + - ensure-python + - ensure-pip + - ensure-tox + - clear-firewall + - deploy-apparmor + - deploy-selenium + - deploy-env + + tasks: + - name: Install Packaging python module for tools/airship + block: + - pip: + name: packaging + version: 23.1 + executable: pip3 + become: True + +... diff --git a/tools/gate/playbooks/git-config.yaml b/tools/gate/playbooks/git-config.yaml index 5c044f70..b841cf0a 100644 --- a/tools/gate/playbooks/git-config.yaml +++ b/tools/gate/playbooks/git-config.yaml @@ -12,14 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -- hosts: primary +- hosts: all tasks: - name: Git config shell: | - set -xe + set -xe; + tee .git/config << EOF [remote "origin"] url = https://opendev.org/airship/treasuremap.git EOF args: - chdir: "{{ zuul.projects['opendev.org/airship/treasuremap'].src_dir }}" + chdir: "{{ zuul.project.src_dir }}" diff --git a/tools/gate/roles/install-postgresql/tasks/main.yaml b/tools/gate/playbooks/mount-volumes.yaml similarity index 83% rename from tools/gate/roles/install-postgresql/tasks/main.yaml rename to tools/gate/playbooks/mount-volumes.yaml index 4fb50ef8..0049da19 100644 --- a/tools/gate/roles/install-postgresql/tasks/main.yaml +++ b/tools/gate/playbooks/mount-volumes.yaml @@ -1,5 +1,3 @@ -# 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 @@ -12,4 +10,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -- include: install-postgresql.yaml +--- +- hosts: all + roles: + - mount-extra-volume +... diff --git a/tools/gate/playbooks/osh-infra-build.yaml b/tools/gate/playbooks/osh-infra-build.yaml index 2de61964..5bd40932 100644 --- a/tools/gate/playbooks/osh-infra-build.yaml +++ b/tools/gate/playbooks/osh-infra-build.yaml @@ -13,8 +13,7 @@ # limitations under the License. - hosts: primary - vars_files: - - vars.yaml + vars: work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" gather_facts: True @@ -24,8 +23,7 @@ - build-helm-packages - hosts: all - vars_files: - - vars.yaml + vars: work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" gather_facts: False diff --git a/tools/gate/playbooks/osh-infra-collect-logs.yaml b/tools/gate/playbooks/osh-infra-collect-logs.yaml index 2cb0982d..83e76887 100644 --- a/tools/gate/playbooks/osh-infra-collect-logs.yaml +++ b/tools/gate/playbooks/osh-infra-collect-logs.yaml @@ -1,5 +1,3 @@ -# Copyright 2017 The Openstack-Helm Authors. -# # 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 @@ -12,17 +10,34 @@ # See the License for the specific language governing permissions and # limitations under the License. +--- - hosts: all + vars_files: + - vars.yaml vars: work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" logs_dir: "/tmp/logs" roles: - gather-host-logs - - helm-release-status - - describe-kubernetes-objects - - gather-pod-logs tags: - gather-host-logs + +- hosts: primary + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + logs_dir: "/tmp/logs" + roles: - helm-release-status - describe-kubernetes-objects - gather-pod-logs + - gather-prom-metrics + - gather-selenium-data + tags: + - helm-release-status + - describe-kubernetes-objects + - gather-pod-logs + - gather-prom-metrics + - gather-selenium-data +... diff --git a/tools/gate/playbooks/osh-infra-deploy-docker.yaml b/tools/gate/playbooks/osh-infra-deploy-docker.yaml deleted file mode 100644 index 74d696b1..00000000 --- a/tools/gate/playbooks/osh-infra-deploy-docker.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2017 The Openstack-Helm Authors. -# -# 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. - -- hosts: all - vars_files: - - vars.yaml - vars: - work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - gather_facts: False - become: yes - roles: - - ensure-python - tags: - - ensure-python - -- hosts: all - vars_files: - - vars.yaml - vars: - work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - gather_facts: True - become: yes - - roles: - - clear-firewall - - ensure-python - - ensure-pip - - ensure-docker - - ensure-tox - - install-test-requirements - - deploy-jq - tags: - - clear-firewall - - ensure-python - - ensure-pip - - ensure-docker - - ensure-tox - - install-test-requirements - - deploy-jq diff --git a/tools/gate/playbooks/osh-infra-deploy-k8s.yaml b/tools/gate/playbooks/osh-infra-deploy-k8s.yaml deleted file mode 100644 index c6d630ad..00000000 --- a/tools/gate/playbooks/osh-infra-deploy-k8s.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2017 The Openstack-Helm Authors. -# -# 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. - -- hosts: primary - vars_files: - - vars.yaml - vars: - work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - gather_facts: True - roles: - - build-helm-packages - - deploy-kubeadm-aio-master - tags: - - build-helm-packages - - deploy-kubeadm-aio-master - -- hosts: nodes - vars_files: - - vars.yaml - vars: - work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - roles: - - deploy-kubeadm-aio-node - tags: - - deploy-kubeadm-aio-node diff --git a/tools/gate/playbooks/osh-infra-upgrade-host.yaml b/tools/gate/playbooks/osh-infra-upgrade-host.yaml deleted file mode 100644 index b4a49c6a..00000000 --- a/tools/gate/playbooks/osh-infra-upgrade-host.yaml +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2017 The Openstack-Helm Authors. -# -# 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. - -- hosts: all - vars_files: - - vars.yaml - vars: - work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - gather_facts: False - become: yes - roles: - - ensure-python - tags: - - ensure-python - -- hosts: all - vars_files: - - vars.yaml - vars: - work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - gather_facts: True - become: yes - roles: - - upgrade-host - - start-zuul-console - - disable-local-nameserver - tags: - - upgrade-host - - start-zuul-console - - disable-local-nameserver - -- hosts: all - vars_files: - - vars.yaml - vars: - work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - gather_facts: False - become: yes - roles: - - deploy-apparmor - tags: - - deploy-apparmor diff --git a/tools/gate/playbooks/install-postgresql.yaml b/tools/gate/playbooks/prepare-hosts.yaml similarity index 82% rename from tools/gate/playbooks/install-postgresql.yaml rename to tools/gate/playbooks/prepare-hosts.yaml index 73d0763f..e7e3d9c9 100644 --- a/tools/gate/playbooks/install-postgresql.yaml +++ b/tools/gate/playbooks/prepare-hosts.yaml @@ -1,5 +1,3 @@ -# 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 @@ -12,7 +10,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +--- - hosts: all - gather_facts: False roles: - - install-postgresql + - bindep + - start-zuul-console +... diff --git a/tools/gate/playbooks/run-functional-tests-docker.yaml b/tools/gate/playbooks/run-functional-tests-docker.yaml index 5acbe1c5..7578425f 100644 --- a/tools/gate/playbooks/run-functional-tests-docker.yaml +++ b/tools/gate/playbooks/run-functional-tests-docker.yaml @@ -16,34 +16,10 @@ gather_facts: False become: yes roles: + - install-test-requirements - build-images - tags: - - build-images - -- hosts: all - gather_facts: False - roles: - deploy-postgresql - tags: - - deploy-postgresql - -- hosts: all - gather_facts: False - roles: - generate-test-config - tags: - - generate-test-config - -- hosts: all - gather_facts: False - roles: - deploy-deckhand - tags: - - deploy-deckhand - -- hosts: all - gather_facts: False - roles: - run-functional-tests - tags: - run-functional-tests diff --git a/tools/gate/playbooks/run-functional-tests-uwsgi.yaml b/tools/gate/playbooks/run-functional-tests-uwsgi.yaml index 7c9a1424..0cb682e0 100644 --- a/tools/gate/playbooks/run-functional-tests-uwsgi.yaml +++ b/tools/gate/playbooks/run-functional-tests-uwsgi.yaml @@ -15,14 +15,5 @@ - hosts: all gather_facts: False roles: - - bindep - - ensure-docker - - ensure-python - - ensure-pip - - disable-systemd-resolved - - install-postgresql - install-test-requirements - run-functional-tests - tags: - - install-postgresql - - run-functional-tests diff --git a/tools/gate/playbooks/run-integration-tests-docker.yaml b/tools/gate/playbooks/run-integration-tests-docker.yaml index abc0fc1f..0d83bf8f 100644 --- a/tools/gate/playbooks/run-integration-tests-docker.yaml +++ b/tools/gate/playbooks/run-integration-tests-docker.yaml @@ -13,15 +13,7 @@ # limitations under the License. - hosts: all - vars_files: - - vars.yaml roles: - - clear-firewall - - bindep - - ensure-docker - - ensure-python - - ensure-pip - - disable-systemd-resolved - install-test-requirements - deploy-keystone-dependencies - deploy-barbican @@ -34,12 +26,4 @@ - generate-test-config - deploy-deckhand - run-integration-tests - tags: - - build-images - - deploy-keystone-dependencies - - deploy-barbican - - build-charts - - deploy-postgresql - - generate-test-config - - deploy-deckhand - - run-integration-tests + diff --git a/tools/gate/playbooks/run-integration-tests-uwsgi.yaml b/tools/gate/playbooks/run-integration-tests-uwsgi.yaml index 74107e21..a9eb71f1 100644 --- a/tools/gate/playbooks/run-integration-tests-uwsgi.yaml +++ b/tools/gate/playbooks/run-integration-tests-uwsgi.yaml @@ -13,21 +13,9 @@ # limitations under the License. - hosts: all - vars_files: - - vars.yaml - gather_facts: False roles: - - clear-firewall - - bindep - - ensure-docker - - ensure-python - - ensure-pip - - disable-systemd-resolved - - install-postgresql - install-test-requirements - - run-integration-tests - - tags: - - install-postgresql + - deploy-keystone-dependencies + - deploy-barbican - run-integration-tests diff --git a/tools/gate/playbooks/vars.yaml b/tools/gate/roles/airship-run-script-set/defaults/main.yaml similarity index 50% rename from tools/gate/playbooks/vars.yaml rename to tools/gate/roles/airship-run-script-set/defaults/main.yaml index f18a6cf6..d160971b 100644 --- a/tools/gate/playbooks/vars.yaml +++ b/tools/gate/roles/airship-run-script-set/defaults/main.yaml @@ -1,5 +1,3 @@ -# Copyright 2017 The Openstack-Helm Authors. -# # 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 @@ -12,5 +10,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -# zuul_airship_deckhand_relative_path: ../airship-deckhand -# barbican_stable_commit: 3ac3caa0138d44aa6031848d5b83802128a169b5 +--- +ceph_osd_data_device: "/dev/loop0" +kubeadm: + pod_network_cidr: "10.244.0.0/24" +osh_params: + container_distro_name: ubuntu + container_distro_version: focal + # feature_gates: +site: airskiff +HELM_ARTIFACT_URL: https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz +HTK_COMMIT: cfff60ec10a6c386f38db79bb9f59a552c2b032f +OSH_INFRA_COMMIT: cfff60ec10a6c386f38db79bb9f59a552c2b032f +OSH_COMMIT: 2d9457e34ca4200ed631466bd87569b0214c92e7 +COREDNS_VERSION: v1.11.1 +distro: ubuntu_focal +CLONE_DECKHAND: false +DECKHAND_IMAGE_DISTRO: ubuntu_focal +... diff --git a/tools/gate/roles/airship-run-script-set/tasks/main.yaml b/tools/gate/roles/airship-run-script-set/tasks/main.yaml new file mode 100644 index 00000000..0fea2a19 --- /dev/null +++ b/tools/gate/roles/airship-run-script-set/tasks/main.yaml @@ -0,0 +1,67 @@ +# 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. + +--- +- block: + - name: "Run script set {{ workload }}" + shell: | + set -xe; + {{ gate_script_path }} + loop: "{{ workload }}" + loop_control: + loop_var: gate_script_path + pause: 5 + args: + chdir: "{{ zuul.project.src_dir }}/{{ gate_scripts_relative_path }}" + environment: + CEPH_OSD_DATA_DEVICE: "{{ ceph_osd_data_device }}" + POD_NETWORK_CIDR: "{{ kubeadm.pod_network_cidr }}" + zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" + OSH_EXTRA_HELM_ARGS: "{{ zuul_osh_extra_helm_args_relative_path | default('') }}" + OSH_PATH: "{{ zuul_osh_relative_path | default('../openstack-helm/') }}" + OSH_INFRA_PATH: "{{ zuul_osh_infra_relative_path | default('../openstack-helm-infra/') }}" + OPENSTACK_RELEASE: "{{ osh_params.openstack_release | default('') }}" + CONTAINER_DISTRO_NAME: "{{ osh_params.container_distro_name | default('') }}" + CONTAINER_DISTRO_VERSION: "{{ osh_params.container_distro_version | default('') }}" + FEATURE_GATES: "{{ osh_params.feature_gates | default('') }}" + RUN_HELM_TESTS: "{{ run_helm_tests | default('yes') }}" + PL_SITE: "{{ site | default('airskiff') }}" + HELM_ARTIFACT_URL: "{{ HELM_ARTIFACT_URL | default('https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz') }}" + HTK_COMMIT: "{{ HTK_COMMIT | default('cfff60ec10a6c386f38db79bb9f59a552c2b032f') }}" + OSH_INFRA_COMMIT: "{{ OSH_INFRA_COMMIT | default('cfff60ec10a6c386f38db79bb9f59a552c2b032f') }}" + OSH_COMMIT: "{{ OSH_COMMIT | default('2d9457e34ca4200ed631466bd87569b0214c92e7') }}" + COREDNS_VERSION: "{{ coredns_version | default('v1.11.1') }}" + distro: "{{ coredns_version | default('ubuntu_focal') }}" + CLONE_DECKHAND: "{{ coredns_version | default('false') }}" + DECKHAND_IMAGE_DISTRO: "{{ coredns_version | default('ubuntu_focal') }}" + # NOTE(aostapenko) using bigger than async_status timeout due to async_status issue with + # not recognizing timed out jobs: https://github.com/ansible/ansible/issues/25637 + async: 3600 + poll: 0 + register: async_results + + - name: Wait for script set to finish + async_status: + jid: '{{ item.ansible_job_id }}' + register: jobs + until: jobs.finished + delay: 5 + retries: 360 + loop: "{{ async_results.results }}" + + always: + - name: Print script set output + shell: | + # NOTE(aostapenko) safely retrieving items for the unlikely case if jobs timed out in async_status + echo 'STDOUT:\n{{ item.get("stdout") | regex_replace("\'", "") }}\nSTDERR:\n{{ item.get("stderr") | regex_replace("\'", "") }}' + loop: "{{ jobs.results }}" +... diff --git a/tools/gate/roles/airship-run-script/defaults/main.yaml b/tools/gate/roles/airship-run-script/defaults/main.yaml new file mode 100644 index 00000000..d160971b --- /dev/null +++ b/tools/gate/roles/airship-run-script/defaults/main.yaml @@ -0,0 +1,30 @@ +# 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. + +--- +ceph_osd_data_device: "/dev/loop0" +kubeadm: + pod_network_cidr: "10.244.0.0/24" +osh_params: + container_distro_name: ubuntu + container_distro_version: focal + # feature_gates: +site: airskiff +HELM_ARTIFACT_URL: https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz +HTK_COMMIT: cfff60ec10a6c386f38db79bb9f59a552c2b032f +OSH_INFRA_COMMIT: cfff60ec10a6c386f38db79bb9f59a552c2b032f +OSH_COMMIT: 2d9457e34ca4200ed631466bd87569b0214c92e7 +COREDNS_VERSION: v1.11.1 +distro: ubuntu_focal +CLONE_DECKHAND: false +DECKHAND_IMAGE_DISTRO: ubuntu_focal +... diff --git a/tools/gate/roles/airship-run-script/tasks/main.yaml b/tools/gate/roles/airship-run-script/tasks/main.yaml new file mode 100644 index 00000000..ca53759b --- /dev/null +++ b/tools/gate/roles/airship-run-script/tasks/main.yaml @@ -0,0 +1,43 @@ +# 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. + +--- +- name: "Run script {{ workload[0] }}" + shell: | + set -xe; + {{ gate_script_path }} + vars: + gate_script_path: "{{ workload[0] }}" + args: + chdir: "{{ zuul.project.src_dir }}/{{ gate_scripts_relative_path }}" + environment: + CEPH_OSD_DATA_DEVICE: "{{ ceph_osd_data_device }}" + POD_NETWORK_CIDR: "{{ kubeadm.pod_network_cidr }}" + zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" + OSH_EXTRA_HELM_ARGS: "{{ zuul_osh_extra_helm_args_relative_path | default('') }}" + OSH_PATH: "{{ zuul_osh_relative_path | default('../openstack-helm/') }}" + OSH_INFRA_PATH: "{{ zuul_osh_infra_relative_path | default('../openstack-helm-infra/') }}" + OPENSTACK_RELEASE: "{{ osh_params.openstack_release | default('') }}" + CONTAINER_DISTRO_NAME: "{{ osh_params.container_distro_name | default('') }}" + CONTAINER_DISTRO_VERSION: "{{ osh_params.container_distro_version | default('') }}" + FEATURE_GATES: "{{ osh_params.feature_gates | default('') }}" + RUN_HELM_TESTS: "{{ run_helm_tests | default('yes') }}" + PL_SITE: "{{ site | default('airskiff') }}" + HELM_ARTIFACT_URL: "{{ HELM_ARTIFACT_URL | default('https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz') }}" + HTK_COMMIT: "{{ HTK_COMMIT | default('cfff60ec10a6c386f38db79bb9f59a552c2b032f') }}" + OSH_INFRA_COMMIT: "{{ OSH_INFRA_COMMIT | default('cfff60ec10a6c386f38db79bb9f59a552c2b032f') }}" + OSH_COMMIT: "{{ OSH_COMMIT | default('2d9457e34ca4200ed631466bd87569b0214c92e7') }}" + COREDNS_VERSION: "{{ coredns_version | default('v1.11.1') }}" + distro: "{{ coredns_version | default('ubuntu_focal') }}" + CLONE_DECKHAND: "{{ coredns_version | default('false') }}" + DECKHAND_IMAGE_DISTRO: "{{ coredns_version | default('ubuntu_focal') }}" +... diff --git a/tools/gate/roles/deploy-keystone-dependencies/tasks/deploy-keystone-dependencies.yaml b/tools/gate/roles/deploy-keystone-dependencies/tasks/deploy-keystone-dependencies.yaml index 725fa4b0..1131cdb1 100644 --- a/tools/gate/roles/deploy-keystone-dependencies/tasks/deploy-keystone-dependencies.yaml +++ b/tools/gate/roles/deploy-keystone-dependencies/tasks/deploy-keystone-dependencies.yaml @@ -17,24 +17,6 @@ set_fact: zuul_site_mirror_fqdn: "{{ lookup('env','zuul_site_mirror_fqdn') }}" -- name: Checkout treasuremap v1.9 branch - shell: | - set -xe; - git checkout v1.9 - environment: - zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" - args: - chdir: "{{ zuul.project.src_dir }}/{{ zuul_treasuremap_relative_path | default('') }}" - -- name: Deploy Kubernetes - shell: | - set -xe; - ./tools/deployment/airskiff/developer/010-deploy-k8s.sh - environment: - zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" - args: - chdir: "{{ zuul.project.src_dir }}/{{ zuul_treasuremap_relative_path | default('') }}" - - name: Make OSH charts shell: | set -xe @@ -53,6 +35,12 @@ args: chdir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" +- name: Prepare kubernetes + shell: | + set -xe; + ./tools/deployment/common/prepare-k8s.sh + args: + chdir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" - name: Setup docker-based openstack client shell: | @@ -64,7 +52,7 @@ - name: Deploy Ingress shell: | set -xe; - ./tools/deployment/component/common/ingress.sh + ./tools/deployment/common/ingress.sh args: chdir: "{{ zuul.project.src_dir }}/{{ zuul_osh_relative_path | default('') }}" diff --git a/tools/gate/roles/run-integration-tests/tasks/integration-tests.yaml b/tools/gate/roles/run-integration-tests/tasks/integration-tests.yaml index e1f2325c..ed04b52c 100644 --- a/tools/gate/roles/run-integration-tests/tasks/integration-tests.yaml +++ b/tools/gate/roles/run-integration-tests/tasks/integration-tests.yaml @@ -59,16 +59,6 @@ sudo -E -H pip3 install -r requirements-frozen.txt echo "$(pwd)" | sudo tee /usr/local/lib/python3.8/dist-packages/deckhand.pth - sudo fdisk --list - df -h - sudo mkdir -p /opt/ext_vol - BIG_VOLUME=$(sudo fdisk -l 2>&1 | grep -E 80G | grep Linux | awk '{print $1}') - if ! mount | grep "${BIG_VOLUME}" - then - sudo mkfs.ext4 "${BIG_VOLUME}" - sudo mount "${BIG_VOLUME}" /opt/ext_vol - df -h - fi pifpaf run postgresql -- ./tools/integration-tests.sh args: chdir: "{{ zuul.project.src_dir }}" diff --git a/tools/helm_install.sh b/tools/helm_install.sh index 81eddd2b..537958da 100755 --- a/tools/helm_install.sh +++ b/tools/helm_install.sh @@ -17,7 +17,7 @@ set -x HELM=$1 -HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://get.helm.sh/helm-v3.12.2-linux-amd64.tar.gz"} +HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz"} function install_helm_binary { diff --git a/tools/helm_tk.sh b/tools/helm_tk.sh index b16732de..cb5a66bf 100755 --- a/tools/helm_tk.sh +++ b/tools/helm_tk.sh @@ -17,7 +17,7 @@ set -eux HTK_REPO=${HTK_REPO:-"https://opendev.org/openstack/openstack-helm-infra.git"} -HTK_STABLE_COMMIT=${HTK_COMMIT:-"d0c93b5648704b9d9999412d932f8329c80362c0"} +HTK_STABLE_COMMIT=${HTK_COMMIT:-"cfff60ec10a6c386f38db79bb9f59a552c2b032f"} TMP_DIR=$(mktemp -d) diff --git a/tools/integration-tests.sh b/tools/integration-tests.sh index da53588b..f4d46d17 100755 --- a/tools/integration-tests.sh +++ b/tools/integration-tests.sh @@ -27,74 +27,6 @@ export MAKE_CHARTS_PORTHOLE="${MAKE_CHARTS_PORTHOLE:-false}" export MAKE_CHARTS_PROMENADE="${MAKE_CHARTS_PROMENADE:-false}" -function deploy_barbican { - set -xe - - # Pull images and lint chart - make pull-images barbican - - # Deploy command - helm upgrade --install barbican ./barbican \ - --namespace=openstack - - # Wait for deploy - ./tools/deployment/common/wait-for-pods.sh openstack - - # Validate deployment info - helm status barbican -n openstack -} - - -function deploy_osh_keystone_barbican { - set -xe - - if [ ! -d "$OSH_INFRA_PATH" ]; then - git clone https://git.openstack.org/openstack/openstack-helm-infra.git ../openstack-helm-infra - fi - - if [ ! -d "$OSH_PATH" ]; then - git clone https://git.openstack.org/openstack/openstack-helm.git ../openstack-helm - fi - - if [ ! -d "$TM_PATH" ]; then - git clone https://git.openstack.org/airship/treasuremap.git ../treasuremap - pushd ../treasuremap - git checkout v1.9 - popd - fi - - cd "${TM_PATH}" - # Deploy required packages - ./tools/deployment/airskiff/developer/009-setup-apparmor.sh - # - # Deploy Kubernetes - ./tools/deployment/airskiff/developer/010-deploy-k8s.sh - # - # Make charts - ./tools/deployment/airskiff/developer/015-make-all-charts.sh - # - # Deploy docker-based openstack client - ./tools/deployment/airskiff/developer/020-setup-client.sh - - - cd "${OSH_PATH}" - # Deploy the ingress controller - ./tools/deployment/component/common/ingress.sh - # Deploy NFS Provisioner - ./tools/deployment/component/nfs-provisioner/nfs-provisioner.sh - # Deploy MariaDB - ./tools/deployment/component/common/mariadb.sh - # Deploy RabbitMQ - ./tools/deployment/component/common/rabbitmq.sh - # Deploy Memcached - ./tools/deployment/component/common/memcached.sh - # Deploy Keystone - ./tools/deployment/component/keystone/keystone.sh - - deploy_barbican -} - - function deploy_deckhand { set -xe @@ -177,9 +109,6 @@ source ${CURRENT_DIR}/tools/common-tests.sh export AIRSHIP_DECKHAND_DATABASE_URL=${PIFPAF_POSTGRESQL_URL} -# Clone openstack-helm-infra and setup host and k8s. -deploy_osh_keystone_barbican - # Deploy Deckhand. deploy_deckhand