Skip to content

Commit

Permalink
Drop redundant copy of checkout, run in pod (#750)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Büchse <matthias.buechse@cloudandheat.com>
  • Loading branch information
mbuechse authored Sep 19, 2024
1 parent 90f3244 commit e1fcbb1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .zuul.d/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- job:
name: scs-check-adr-syntax
parent: base
nodeset: pod-fedora-40
pre-run: playbooks/pre.yaml
run: playbooks/adr_syntax.yaml
- job:
Expand All @@ -26,6 +27,7 @@
secrets:
- name: clouds_conf
secret: SECRET_STANDARDS
nodeset: pod-fedora-40
vars:
preset: default
pre-run:
Expand Down
10 changes: 6 additions & 4 deletions playbooks/adr_syntax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
hosts: all
tasks:
- name: Run ADR syntax check script
ansible.builtin.shell: |
python3 ~/Tests/chk_adrs.py ~/Standards
ansible.builtin.command:
cmd: python3 Tests/chk_adrs.py Standards
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
register: result
changed_when: true
failed_when: result.rc != 0

- name: Run test script consistency check script
ansible.builtin.shell: |
python3 ~/Tests/iaas/flavor-naming/check_yaml.py ~/Tests/iaas
ansible.builtin.shell:
cmd: python3 Tests/iaas/flavor-naming/check_yaml.py Tests/iaas
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
register: result
changed_when: true
failed_when: result.rc != 0
Expand Down
7 changes: 4 additions & 3 deletions playbooks/compliance_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
hosts: all
tasks:
- name: Run compliance script
ansible.builtin.shell: >
python3 ~/Tests/scs-test-runner.py --config ~/Tests/config.toml --debug run --preset {{ preset }} --output report.yaml
ansible.builtin.command:
cmd: python3 Tests/scs-test-runner.py --config Tests/config.toml --debug run --preset {{ preset }} --output report.yaml
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
changed_when: true

- name: Copy result YAML
ansible.builtin.synchronize:
dest: "{{ zuul.executor.log_root }}/report.yaml"
mode: pull
src: "report.yaml"
src: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/report.yaml"
verify_host: true
owner: no
group: no
Expand Down
17 changes: 2 additions & 15 deletions playbooks/pre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,7 @@
roles:
- role: ensure-pip # https://zuul-ci.org/docs/zuul-jobs/latest/python-roles.html#role-ensure-pip
tasks:
- name: Copy ADRs on the node
ansible.builtin.copy:
src: "../Standards"
dest: "~/"
mode: 0500
no_log: false

- name: Copy Tests on the node
ansible.builtin.copy:
src: "../Tests"
dest: "~/"
mode: 0500
no_log: false

- name: Install dependencies
ansible.builtin.pip:
requirements: ~/Tests/requirements.txt
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
requirements: "Tests/requirements.txt"
12 changes: 6 additions & 6 deletions playbooks/pre_cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
- name: Prepare cloud config and ensure clean env
hosts: all
roles:
- role: ensure-pip # https://zuul-ci.org/docs/zuul-jobs/latest/python-roles.html#role-ensure-pip
- role: bindep # https://zuul-ci.org/docs/zuul-jobs/latest/general-roles.html#role-bindep
tasks:
- name: Create cloud config dir
Expand All @@ -21,7 +20,7 @@

- name: Create secrets dir
ansible.builtin.file:
path: "~/Tests/.secret"
path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/Tests/.secret"
state: directory
recurse: true
mode: "0700"
Expand All @@ -30,18 +29,19 @@
ansible.builtin.copy:
# the secrets are usually stripped of whitespace, but the final newline is essential here
content: "{{ clouds_conf.zuul_ci_signing_key + '\n' }}"
dest: "~/Tests/.secret/keyfile"
dest: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/Tests/.secret/keyfile"
mode: "0600"
no_log: true

- name: Create basic_auth token file
ansible.builtin.copy:
content: "{{ clouds_conf.zuul_ci_basic_auth }}"
dest: "~/Tests/.secret/tokenfile"
dest: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/Tests/.secret/tokenfile"
mode: "0600"
no_log: true

- name: Clean up any lingering resources from previous run
ansible.builtin.shell: >
python3 ~/Tests/scs-test-runner.py --config ~/Tests/config.toml --debug cleanup --preset {{ preset }}
ansible.builtin.command:
cmd: python3 Tests/scs-test-runner.py --config Tests/config.toml --debug cleanup --preset {{ preset }}
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
changed_when: true

0 comments on commit e1fcbb1

Please sign in to comment.