Browse Source

Remove CI roles from validations-libs

The CI roles are stored on both repos:
validations-common and validations-libs.
We need to stored those roles only in one place.

This review removed the roles from validations-libs
and used it from validations-common

Change-Id: Ia343509716f0a7769c8edcd502a678927935b419
changes/16/758716/14
Mathieu Bultel 6 months ago
committed by mathieu bultel
parent
commit
2c2b71a3fa
8 changed files with 3 additions and 110 deletions
  1. +1
    -2
      playbooks/post.yaml
  2. +2
    -1
      playbooks/validations-libs-functional.yaml
  3. +0
    -3
      roles/fetch-validations/defaults/main.yaml
  4. +0
    -24
      roles/fetch-validations/tasks/main.yaml
  5. +0
    -23
      roles/validations/defaults/main.yaml
  6. +0
    -29
      roles/validations/tasks/main.yaml
  7. +0
    -25
      roles/validations/tasks/validations.yaml
  8. +0
    -3
      setup.cfg

+ 1
- 2
playbooks/post.yaml View File

@ -1,9 +1,8 @@
- hosts: all
- hosts: tempest
vars:
tox_envlist: functional
roles:
- fetch-subunit-output
- fetch-devstack-log-dir
- fetch-output
- fetch-validations
- fetch-python-sdist-output

+ 2
- 1
playbooks/validations-libs-functional.yaml View File

@ -11,4 +11,5 @@
- role: ensure-if-python
vars:
zuul_work_dir: "src/opendev.org/openstack/validations-common"
- role: validations
- role: "src/opendev.org/openstack/validations-common/roles/validations"
- role: "src/opendev.org/openstack/validations-common/roles/fetch_validations"

+ 0
- 3
roles/fetch-validations/defaults/main.yaml View File

@ -1,3 +0,0 @@
src_dir: "{{ zuul.project.src_dir }}"
output_dir: "{{ ansible_user_dir }}"
log_path: "{{ zuul.executor.log_root }}"

+ 0
- 24
roles/fetch-validations/tasks/main.yaml View File

@ -1,24 +0,0 @@
- name: Ensure local output dirs
delegate_to: localhost
file:
path: "{{ vf_output_dir }}"
state: directory
with_items:
- "{{ log_path }}/validations-logs"
- "{{ zuul.executor.work_root }}/artifacts"
loop_control:
loop_var: vf_output_dir
- name: Collect logs and artifacts
synchronize:
dest: "{{ vf_output.dest }}/"
mode: pull
src: "{{ output_dir }}/{{ vf_output.src }}/"
verify_host: true
owner: false
group: false
loop:
- dest: "{{ log_path }}/validations-logs"
src: "logs"
loop_control:
loop_var: vf_output

+ 0
- 23
roles/validations/defaults/main.yaml View File

@ -1,23 +0,0 @@
log_dir: "{{ ansible_user_dir }}/logs"
zuul_work_virtualenv: "{{ ansible_user_dir }}/.venv"
ansible_dir: "{{ zuul_work_virtualenv }}/share/ansible"
validation_dir: "{{ zuul_work_virtualenv }}/share/ansible/validation-playbooks"
vf_log_dir: "/var/log/validations"
val_exec: "source {{ zuul_work_virtualenv }}/bin/activate; validation.py"
command:
- { output: "{{ log_dir }}/run.log", command: "{{ val_exec }} run --validation check-ftype,512e \
--validation-dir {{ validation_dir }} \
--ansible-base-dir {{ ansible_dir }} \
--output-log {{ log_dir }}/run.log" }
- { output: "{{ log_dir }}/run-group.log", command: "{{ val_exec }} run --group prep \
--validation-dir {{ validation_dir }} \
--ansible-base-dir {{ ansible_dir }} \
--output-log {{ log_dir }}/run-group.log" }
- { output: "{{ log_dir }}/list.log", command: "{{ val_exec }} list \
--validation-dir {{ validation_dir }} \
--ansible-base-dir {{ ansible_dir }} \
--output-log {{ log_dir }}/list.log" }
- { output: "{{ log_dir }}/show.log", command: "{{ val_exec }} show \
--validation-dir {{ validation_dir }} \
--ansible-base-dir {{ ansible_dir }} \
--output-log {{ log_dir }}/show.log" }

+ 0
- 29
roles/validations/tasks/main.yaml View File

@ -1,29 +0,0 @@
- name: Make sure Validations Log dir exists
become: yes
file:
path: "{{ vf_log_dir }}"
state: directory
mode: "0755"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
recurse: yes
# @matbu: TODO make the /var/log/validations as a parameter
# We should be able to write validation logs outside of the /var/log path
# This statement will have to be remove then.
- name: Create Validations log symlink
file:
src: "{{ vf_log_dir }}"
dest: "{{ log_dir }}"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
state: link
# @matbu: TODO make ansible-runner depends on Ansible
- name: Install Ansible
pip:
name: ansible
virtualenv: "{{ zuul_work_virtualenv }}"
- include: validations.yaml validation_command="{{ item.command }}" val_output="{{ item.output }}"
loop: "{{command}}"

+ 0
- 25
roles/validations/tasks/validations.yaml View File

@ -1,25 +0,0 @@
- name: Execute validation commands
shell:
cmd: "{{ validation_command }}"
executable: /bin/bash
- 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 }}"

+ 0
- 3
setup.cfg View File

@ -21,9 +21,6 @@ classifier =
[files]
packages = validations_libs
data_files =
share/ansible/roles = roles/*
[compile_catalog]
directory = validations-libs/locale
domain = validations-lib


Loading…
Cancel
Save