From b6d66646b89ea72ec5f52facb138dd33989bd86d Mon Sep 17 00:00:00 2001 From: "Gael Chamoulaud (Strider)" Date: Wed, 11 Mar 2020 09:30:22 +0100 Subject: [PATCH] Migrate molecule jobs from centos 7 to 8 - assure we have docker installed - add .gitreview file - Fix Python shebangs for packaging Change-Id: If9d78891f9b5a1615a9fb1f4251801eec1f29ed5 Signed-off-by: Gael Chamoulaud (Strider) --- .gitreview | 4 + releasenotes/source/index.rst | 7 -- releasenotes/source/ocata.rst | 6 - releasenotes/source/pike.rst | 6 - releasenotes/source/queens.rst | 6 - releasenotes/source/rocky.rst | 6 - releasenotes/source/stein.rst | 6 - releasenotes/source/train.rst | 6 - requirements.txt | 1 - tools/test-setup.sh | 8 ++ validations_common/library/advanced_format.py | 2 +- .../library/check_package_update.py | 2 +- validations_common/library/haproxy_conf.py | 2 +- validations_common/library/hiera.py | 2 +- .../library/validations_read_ini.py | 2 +- validations_common/library/warn.py | 2 +- zuul.d/base.yaml | 15 +++ zuul.d/layout.yaml | 14 +++ zuul.d/molecule.yaml | 115 ++++++++++++++++++ zuul.d/playbooks/pre.yml | 28 +++++ zuul.d/playbooks/run-local.yml | 13 ++ zuul.d/playbooks/run.yml | 20 +++ 22 files changed, 223 insertions(+), 50 deletions(-) create mode 100644 .gitreview delete mode 100644 releasenotes/source/ocata.rst delete mode 100644 releasenotes/source/pike.rst delete mode 100644 releasenotes/source/queens.rst delete mode 100644 releasenotes/source/rocky.rst delete mode 100644 releasenotes/source/stein.rst delete mode 100644 releasenotes/source/train.rst create mode 100755 tools/test-setup.sh create mode 100644 zuul.d/base.yaml create mode 100644 zuul.d/layout.yaml create mode 100644 zuul.d/molecule.yaml create mode 100644 zuul.d/playbooks/pre.yml create mode 100644 zuul.d/playbooks/run-local.yml create mode 100644 zuul.d/playbooks/run.yml diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..639b7a6 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.opendev.org +port=29418 +project=openstack/validations-common.git diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst index cbf65d1..1975962 100644 --- a/releasenotes/source/index.rst +++ b/releasenotes/source/index.rst @@ -9,13 +9,6 @@ Contents :maxdepth: 2 unreleased - train - stein - rocky - queens - pike - ocata - Indices and tables ================== diff --git a/releasenotes/source/ocata.rst b/releasenotes/source/ocata.rst deleted file mode 100644 index ebe62f4..0000000 --- a/releasenotes/source/ocata.rst +++ /dev/null @@ -1,6 +0,0 @@ -=================================== - Ocata Series Release Notes -=================================== - -.. release-notes:: - :branch: origin/stable/ocata diff --git a/releasenotes/source/pike.rst b/releasenotes/source/pike.rst deleted file mode 100644 index e43bfc0..0000000 --- a/releasenotes/source/pike.rst +++ /dev/null @@ -1,6 +0,0 @@ -=================================== - Pike Series Release Notes -=================================== - -.. release-notes:: - :branch: stable/pike diff --git a/releasenotes/source/queens.rst b/releasenotes/source/queens.rst deleted file mode 100644 index 36ac616..0000000 --- a/releasenotes/source/queens.rst +++ /dev/null @@ -1,6 +0,0 @@ -=================================== - Queens Series Release Notes -=================================== - -.. release-notes:: - :branch: stable/queens diff --git a/releasenotes/source/rocky.rst b/releasenotes/source/rocky.rst deleted file mode 100644 index 40dd517..0000000 --- a/releasenotes/source/rocky.rst +++ /dev/null @@ -1,6 +0,0 @@ -=================================== - Rocky Series Release Notes -=================================== - -.. release-notes:: - :branch: stable/rocky diff --git a/releasenotes/source/stein.rst b/releasenotes/source/stein.rst deleted file mode 100644 index efaceb6..0000000 --- a/releasenotes/source/stein.rst +++ /dev/null @@ -1,6 +0,0 @@ -=================================== - Stein Series Release Notes -=================================== - -.. release-notes:: - :branch: stable/stein diff --git a/releasenotes/source/train.rst b/releasenotes/source/train.rst deleted file mode 100644 index 5839003..0000000 --- a/releasenotes/source/train.rst +++ /dev/null @@ -1,6 +0,0 @@ -========================== -Train Series Release Notes -========================== - -.. release-notes:: - :branch: stable/train diff --git a/requirements.txt b/requirements.txt index cdeaf68..dcb7d1a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,3 @@ # process, which may cause wedges in the gate later. pbr>=3.1.1 # Apache-2.0 -PyYAML diff --git a/tools/test-setup.sh b/tools/test-setup.sh new file mode 100755 index 0000000..e3179bf --- /dev/null +++ b/tools/test-setup.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -euxo pipefail +# Used by Zuul CI to perform extra bootstrapping + +# Workaround for a potential: +# Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock +# See https://docs.docker.com/install/linux/linux-postinstall/ +newgrp docker || true diff --git a/validations_common/library/advanced_format.py b/validations_common/library/advanced_format.py index 84b1c99..9b1bcaa 100644 --- a/validations_common/library/advanced_format.py +++ b/validations_common/library/advanced_format.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 Red Hat, Inc. # All Rights Reserved. # diff --git a/validations_common/library/check_package_update.py b/validations_common/library/check_package_update.py index fcf42fb..90f083e 100755 --- a/validations_common/library/check_package_update.py +++ b/validations_common/library/check_package_update.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 Red Hat, Inc. # All Rights Reserved. # diff --git a/validations_common/library/haproxy_conf.py b/validations_common/library/haproxy_conf.py index de2e452..6fcb4d8 100644 --- a/validations_common/library/haproxy_conf.py +++ b/validations_common/library/haproxy_conf.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/validations_common/library/hiera.py b/validations_common/library/hiera.py index c5edd02..0022f59 100644 --- a/validations_common/library/hiera.py +++ b/validations_common/library/hiera.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 Red Hat, Inc. # All Rights Reserved. # diff --git a/validations_common/library/validations_read_ini.py b/validations_common/library/validations_read_ini.py index 63cc4af..026c568 100644 --- a/validations_common/library/validations_read_ini.py +++ b/validations_common/library/validations_read_ini.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/validations_common/library/warn.py b/validations_common/library/warn.py index 61852f3..1fd1fd8 100644 --- a/validations_common/library/warn.py +++ b/validations_common/library/warn.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 Red Hat, Inc. # All Rights Reserved. # diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml new file mode 100644 index 0000000..478f97e --- /dev/null +++ b/zuul.d/base.yaml @@ -0,0 +1,15 @@ +--- +- job: + description: Base validations-common job + name: validations-common-centos-8-base + nodeset: centos-8 + parent: base + success-url: "reports.html" + failure-url: "reports.html" + pre-run: + - tests/prepare-test-host.yml + - zuul.d/playbooks/pre.yml + run: + - zuul.d/playbooks/run.yml + timeout: 1800 + voting: true diff --git a/zuul.d/layout.yaml b/zuul.d/layout.yaml new file mode 100644 index 0000000..bb33e99 --- /dev/null +++ b/zuul.d/layout.yaml @@ -0,0 +1,14 @@ +- project: + templates: + - openstack-python3-ussuri-jobs + - validations-common-molecule-jobs + - check-requirements + - release-notes-jobs-python3 + check: + jobs: + - openstack-tox-linters + - openstack-tox-lower-constraints + gate: + jobs: + - openstack-tox-linters + - openstack-tox-lower-constraints diff --git a/zuul.d/molecule.yaml b/zuul.d/molecule.yaml new file mode 100644 index 0000000..62af0b8 --- /dev/null +++ b/zuul.d/molecule.yaml @@ -0,0 +1,115 @@ +--- +- project-template: + check: + jobs: + - validations-common-centos-8-molecule-advanced_format_512e_support + - validations-common-centos-8-molecule-check_latest_packages_version + - validations-common-centos-8-molecule-dns + - validations-common-centos-8-molecule-haproxy + - validations-common-centos-8-molecule-ntp + - validations-common-centos-8-molecule-service_status + - validations-common-centos-8-molecule-check_cpu + - validations-common-centos-8-molecule-check_disk_space + - validations-common-centos-8-molecule-check_ram + - validations-common-centos-8-molecule-check_selinux_mode + - validations-common-centos-8-molecule-validate_selinux + - validations-common-centos-8-molecule-xfs_check_ftype + gate: + jobs: + - validations-common-centos-8-molecule-check_latest_packages_version + - validations-common-centos-8-molecule-dns + - validations-common-centos-8-molecule-haproxy + - validations-common-centos-8-molecule-check_cpu + - validations-common-centos-8-molecule-check_disk_space + - validations-common-centos-8-molecule-check_ram + - validations-common-centos-8-molecule-validate_selinux + name: validations-common-molecule-jobs +- job: + files: + - ^roles/check_selinux_mode/.* + name: validations-common-centos-8-molecule-check_selinux_mode + parent: validations-common-centos-8-base + vars: + validations_common_role_name: check_selinux_mode + voting: false +- job: + files: + - ^roles/ntp/.* + name: validations-common-centos-8-molecule-ntp + parent: validations-common-centos-8-base + vars: + validations_common_role_name: ntp + voting: false +- job: + files: + - ^roles/service_status/.* + name: validations-common-centos-8-molecule-service_status + parent: validations-common-centos-8-base + vars: + validations_common_role_name: service_status + voting: false +- job: + files: + - ^roles/advanced_format_512e_support/.* + name: validations-common-centos-8-molecule-advanced_format_512e_support + parent: validations-common-centos-8-base + vars: + validations_common_role_name: advanced_format_512e_support + voting: false +- job: + files: + - ^roles/dns/.* + name: validations-common-centos-8-molecule-dns + parent: validations-common-centos-8-base + vars: + validations_common_role_name: dns +- job: + files: + - ^roles/haproxy/.* + name: validations-common-centos-8-molecule-haproxy + parent: validations-common-centos-8-base + vars: + validations_common_role_name: haproxy +- job: + files: + - ^roles/check_cpu/.* + name: validations-common-centos-8-molecule-check_cpu + parent: validations-common-centos-8-base + vars: + validations_common_role_name: check_cpu +- job: + files: + - ^roles/check_ram/.* + name: validations-common-centos-8-molecule-check_ram + parent: validations-common-centos-8-base + vars: + validations_common_role_name: check_ram +- job: + files: + - ^roles/check_disk_space/.* + name: validations-common-centos-8-molecule-check_disk_space + parent: validations-common-centos-8-base + vars: + validations_common_role_name: check_disk_space +- job: + files: + - ^roles/xfs_check_ftype/.* + name: validations-common-centos-8-molecule-xfs_check_ftype + parent: validations-common-centos-8-base + vars: + validations_common_role_name: xfs_check_ftype + voting: false +- job: + files: + - ^roles/check_latest_packages_version/.* + name: validations-common-centos-8-molecule-check_latest_packages_version + parent: validations-common-centos-8-base + vars: + validations_common_role_name: check_latest_packages_version +- job: + files: + - ^roles/validate_selinux/.* + name: validations-common-centos-8-molecule-validate_selinux + parent: validations-common-centos-8-base + vars: + validations_common_role_name: validate_selinux diff --git a/zuul.d/playbooks/pre.yml b/zuul.d/playbooks/pre.yml new file mode 100644 index 0000000..aa46e5e --- /dev/null +++ b/zuul.d/playbooks/pre.yml @@ -0,0 +1,28 @@ +--- +- hosts: all + pre_tasks: + - name: Ensure output dirs + file: + path: "{{ ansible_user_dir }}/zuul-output/logs" + state: directory + + - name: Setup bindep + pip: + name: "bindep" + virtualenv: "{{ ansible_user_dir }}/test-python" + virtualenv_site_packages: true + + - name: Run bindep + shell: |- + . {{ ansible_user_dir }}/test-python/bin/activate + {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/scripts/bindep-install + become: true + changed_when: false + + - name: Setup test-python + pip: + requirements: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/molecule-requirements.txt" + virtualenv: "{{ ansible_user_dir }}/test-python" + virtualenv_site_packages: true + roles: + - role: install-docker diff --git a/zuul.d/playbooks/run-local.yml b/zuul.d/playbooks/run-local.yml new file mode 100644 index 0000000..cd0f83e --- /dev/null +++ b/zuul.d/playbooks/run-local.yml @@ -0,0 +1,13 @@ +--- +- hosts: all + tasks: + - name: set basic zuul fact + set_fact: + zuul: + project: + src_dir: "{{ tripleo_src }}" + ansible_connection: ssh + +- import_playbook: pre.yml + +- import_playbook: run.yml diff --git a/zuul.d/playbooks/run.yml b/zuul.d/playbooks/run.yml new file mode 100644 index 0000000..c9f2c81 --- /dev/null +++ b/zuul.d/playbooks/run.yml @@ -0,0 +1,20 @@ +--- + +- hosts: all + environment: + ANSIBLE_LOG_PATH: "{{ ansible_user_dir }}/zuul-output/logs/ansible-execution.log" + tasks: + - name: Run role test job + shell: |- + . {{ ansible_user_dir }}/test-python/bin/activate + . {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/ansible-test-env.rc + pytest --color=no \ + --html={{ ansible_user_dir }}/zuul-output/logs/reports.html \ + --self-contained-html \ + --ansible-args='{{ tripleo_job_ansible_args | default("") }}' \ + {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/test_molecule.py + args: + chdir: + "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/validations_common/roles/{{ validations_common_role_name }}" + executable: /bin/bash + changed_when: false