Merge "Update requirements-check job to run on arbitrary targets"

This commit is contained in:
Zuul 2024-11-08 02:10:38 +00:00 committed by Gerrit Code Review
commit 7d062f8663
6 changed files with 56 additions and 15 deletions

View File

@ -10,6 +10,21 @@
- job:
name: requirements-check
parent: unittests
description: |
Check that requirements in the target repo match OpenStack
global requirements.
**Job Variables**
.. zuul:jobvar:: zuul_work_dir
:default: {{ zuul.project.src_dir }}
Directory holding the project to check.
.. zuul:jobvar:: zuul_branch
:default: {{ zuul.branch }}
Branch to check.
# NOTE(gmann): Update the nodeset if we move testing to the new version
# of ubuntu. We are explicitly setting the nodeset here because the base
# job (unittests) moving to the ubuntu latest version can break this
@ -28,3 +43,15 @@
- ^doc/requirements.txt$
- playbooks/requirements-check.yaml
- ^lower-constraints.txt$
- job:
name: requirements-check-self
description: |
Run the requirements-check job on another repo in order to
self-test changes to its job configuration.
parent: requirements-check
# This could be any project, nova is chosen arbitrarily.
required-projects: openstack/nova
vars:
zuul_work_dir: "{{ zuul.projects['opendev.org/openstack/nova'].src_dir }}"
zuul_branch: "master"

View File

@ -13,6 +13,7 @@
files:
- bindep.txt
- openstack-tox-validate
- requirements-check-self
- requirements-tox-babel
- requirements-tox-bindep:
voting: false
@ -79,6 +80,7 @@
files:
- bindep.txt
- openstack-tox-validate
- requirements-check-self
- requirements-tox-babel
- requirements-tox-py39-check-uc
- requirements-tox-py310-check-uc

View File

@ -1,16 +1,4 @@
- hosts: all
pre_tasks:
- name: Ensure pip
include_role:
name: ensure-pip
tasks:
- name: Install openstack_requirements
command: "pip3 install --user {{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}"
- name: Run requirements check script
# Use command module here instead of script since Zuul gets output
# with command into job-output.txt file.
# Command expects the file to be at the remote system - the system
# running the tests. Ask zuul variables for the path.
command: "{{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}/playbooks/files/project-requirements-change.py {{ zuul.project.src_dir }} {{ zuul.branch }}"
roles:
- ensure-pip
- check-requirements

View File

@ -0,0 +1,13 @@
Check that a project's requirements match the global requirements repo.
**Role Variables**
.. zuul:rolevar:: zuul_work_dir
:default: {{ zuul.project.src_dir }}
Directory holding the project to check.
.. zuul:rolevar:: zuul_branch
:default: {{ zuul.branch }}
Branch to check.

View File

@ -0,0 +1,2 @@
zuul_work_dir: "{{ zuul.project.src_dir }}"
zuul_branch: "{{ zuul.branch }}"

View File

@ -0,0 +1,9 @@
- name: Install openstack_requirements
command: "pip3 install --user {{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}"
- name: Run requirements check script
# Use command module here instead of script since Zuul gets output
# with command into job-output.txt file.
# Command expects the file to be at the remote system - the system
# running the tests. Ask zuul variables for the path.
command: "{{ zuul.projects['opendev.org/openstack/requirements'].src_dir }}/playbooks/files/project-requirements-change.py {{ zuul_work_dir }} {{ zuul_branch }}"