Browse Source

Merge "Change zuul config for functional CI execution"

changes/10/738510/6
Zuul 1 year ago
committed by Gerrit Code Review
parent
commit
47db76f3f3
  1. 27
      .zuul.yaml
  2. 96
      playbooks/legacy/validations-dsvm-functional/post.yaml
  3. 37
      playbooks/legacy/validations-dsvm-functional/run.yaml
  4. 60
      playbooks/legacy/validations-dsvm-functional/setup.yaml
  5. 23
      playbooks/legacy/validations-dsvm-functional/validations.yaml
  6. 37
      zuul.d/layout.yaml

27
.zuul.yaml

@ -0,0 +1,27 @@
- job:
name: validations-dsvm-functional
parent: legacy-dsvm-base
run: playbooks/legacy/validations-dsvm-functional/run.yaml
post-run: playbooks/legacy/validations-dsvm-functional/post.yaml
timeout: 7200
required-projects:
- openstack/devstack-gate
- openstack/validations-libs
- openstack/validations-common
irrelevant-files:
- ^.*\.rst$
- ^doc/.*$
- ^releasenotes/.*$
- project:
templates:
- check-requirements
- openstack-lower-constraints-jobs
- openstack-python3-victoria-jobs
check:
jobs:
- validations-dsvm-functional
gate:
jobs:
- openstack-tox-linters
- validations-dsvm-functional

96
playbooks/legacy/validations-dsvm-functional/post.yaml

@ -0,0 +1,96 @@
- hosts: primary
tasks:
- name: Set fact for validation src directory
set_fact:
src_dir: '/home/zuul/src/opendev.org/openstack'
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*nose_results.html
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*testr_results.html.gz
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/.testrepository/tmp*
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*testrepository.subunit.gz
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}/tox'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/.tox/*/log/*
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
synchronize:
src: '{{ ansible_user_dir }}/workspace/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/logs/**
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Copy files from {{ src_dir }} on node
synchronize:
src: '{{ src_dir }}'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=**/*.log
- --include=*/
- --exclude=*
- --prune-empty-dirs

37
playbooks/legacy/validations-dsvm-functional/run.yaml

@ -0,0 +1,37 @@
---
- hosts: primary
name: validations-dsvm-functional
tasks:
- name: Ensure legacy workspace directory
file:
path: '{{ ansible_user_dir }}/workspace'
state: directory
- name: Set fact for validation src directory
set_fact:
src_dir: '/home/zuul/src/opendev.org/openstack'
- name: Set fact for validation executable
set_fact:
val_exec: "python {{ src_dir }}/validations-common/validations_common/validation.py"
- include: setup.yaml src_dir="{{ src_dir }}" log_dir="/var/log/validations"
- include: validations.yaml validation_command="{{ item.command }}" val_output="{{ item.output }}" src_dir="{{ src_dir }}"
with_items:
- { output: "{{ src_dir }}/run.log", command: "{{ val_exec }} run --validation check-ftype,512e \
--validation-dir {{ src_dir }}/validations-common/validations_common/playbooks \
--ansible-base-dir {{ src_dir }}/validations-common/validations_common \
--output-log {{ src_dir }}/run.log" }
- { output: "{{ src_dir }}/run-group.log", command: "{{ val_exec }} run --group prep \
--validation-dir {{ src_dir }}/validations-common/validations_common/playbooks \
--ansible-base-dir {{ src_dir }}/validations-common/validations_common \
--output-log {{ src_dir }}/run-group.log" }
- { output: "{{ src_dir }}/list.log", command: "{{ val_exec }} list \
--validation-dir {{ src_dir }}/validations-common/validations_common/playbooks \
--ansible-base-dir {{ src_dir }}/validations-common/validations_common \
--output-log {{ src_dir }}/list.log" }
- { output: "{{ src_dir }}/show.log", command: "{{ val_exec }} show \
--validation-dir {{ src_dir }}/validations-common/validations_common/playbooks \
--ansible-base-dir {{ src_dir }}/validations-common/validations_common \
--output-log {{ src_dir }}/show.log" }

60
playbooks/legacy/validations-dsvm-functional/setup.yaml

@ -0,0 +1,60 @@
- name: Instal python pip
ignore_errors: yes
become: yes
package:
name:
- python3-pip
- python-pip
state: present
- name: Install validations deps
ignore_errors: yes
shell:
cmd: |
sudo pip3 install prettytable
sudo pip3 install setuptools
sudo pip3 install ansible
- name: Install validations deps
shell:
cmd: |
sudo pip install prettytable
sudo pip install setuptools
sudo pip3 install ansible
- name: Install validations-libs
ignore_errors: yes
shell:
cmd: |
sudo pip install -r requirements.txt
sudo python setup.py install
executable: /bin/bash
chdir: '{{ src_dir }}/validations-libs'
- name: Install validations-common
ignore_errors: yes
shell:
cmd: |
sudo pip install -r requirements.txt
sudo python setup.py install
executable: /bin/bash
chdir: '{{ src_dir }}/validations-common'
- name: Make sure Validations Log dir exists
become: yes
file:
path: '{{ log_dir }}'
state: directory
mode: '0755'
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'
recurse: yes
- name: Make validation script executable
register: output
shell:
cmd: |
chmod +x validations_common/validation.py
executable: /bin/bash
chdir: '{{ src_dir }}/validations-common'
environment: '{{ zuul | zuul_legacy_vars }}'

23
playbooks/legacy/validations-dsvm-functional/validations.yaml

@ -0,0 +1,23 @@
- name: Execute validation commands
shell: "{{ validation_command }}"
- name: Get run results
register: result
shell:
cmd: "cat {{val_output}}"
executable: /bin/bash
- name: Get json data
set_fact:
jsondata: "{{ result.stdout | from_json }}"
- name: Get Validations Status
set_fact:
status: "{{ jsondata | json_query(jsonres) }}"
vars:
jsonres: 'results[*].Status'
- fail:
msg: "Validation failed: some of the validations has failed."
when: item != "PASSED"
loop: "{{ status }}"

37
zuul.d/layout.yaml

@ -1,37 +0,0 @@
- project:
templates:
- openstack-python3-victoria-jobs
- check-requirements
- openstack-lower-constraints-jobs
check:
jobs:
- openstack-tox-linters: &tripleo-linters
nodeset: centos-8
- openstack-tox-docs: &tripleo-docs
files:
- ^doc/.*
- ^README.rst
- tripleo-ci-centos-8-containers-multinode: &containers_multinode
dependencies: &deps
- openstack-tox-linters
files: &containers_files
- ^validations_libs/.*
irrelevant-files: &irrelevant_scenario_files
- .*.md$
- .*.rst$
- .*.txt$
- .*.ini$
- ^validations_libs/tests/.*
- tripleo-ci-centos-8-standalone: &basic_standalone
dependencies: *deps
files: *containers_files
irrelevant-files: *irrelevant_scenario_files
gate:
jobs:
- openstack-tox-linters: *tripleo-linters
- openstack-tox-docs: *tripleo-docs
- tripleo-ci-centos-8-containers-multinode: *containers_multinode
- tripleo-ci-centos-8-standalone: *basic_standalone
promote:
jobs:
- promote-openstack-tox-docs: *tripleo-docs
Loading…
Cancel
Save