Ensure output dirs are empty
Change-Id: I813ecc32c9781091dc7faf67dcc99dfe88bbaa5d
This commit is contained in:
parent
1ab22a3b44
commit
00d758af26
@ -1,4 +1,4 @@
|
|||||||
Ensure output directories are in place
|
Ensure output directories are in place and are empty.
|
||||||
|
|
||||||
**Role Variables**
|
**Role Variables**
|
||||||
|
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
- name: Empty Zuul Output directories by removing them
|
||||||
|
file:
|
||||||
|
path: "{{ zuul_output_dir }}/{{ zj_output_dir }}"
|
||||||
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- logs
|
||||||
|
- artifacts
|
||||||
|
- docs
|
||||||
|
loop_control:
|
||||||
|
loop_var: zj_output_dir
|
||||||
|
|
||||||
- name: Ensure Zuul Output directories exist
|
- name: Ensure Zuul Output directories exist
|
||||||
file:
|
file:
|
||||||
path: "{{ zuul_output_dir }}/{{ zj_output_dir }}"
|
path: "{{ zuul_output_dir }}/{{ zj_output_dir }}"
|
||||||
|
@ -30,3 +30,33 @@
|
|||||||
- artifact_directory is succeeded
|
- artifact_directory is succeeded
|
||||||
- doc_directory is not changed
|
- doc_directory is not changed
|
||||||
- doc_directory is succeeded
|
- doc_directory is succeeded
|
||||||
|
|
||||||
|
- name: Add a logfile, artifact, and doc item
|
||||||
|
file:
|
||||||
|
path: "{{ zuul_output_dir }}/{{ item }}/file.txt"
|
||||||
|
state: touch
|
||||||
|
loop:
|
||||||
|
- docs
|
||||||
|
- artifacts
|
||||||
|
- logs
|
||||||
|
|
||||||
|
- name: Run ensure-output-dirs
|
||||||
|
include_role:
|
||||||
|
name: ensure-output-dirs
|
||||||
|
|
||||||
|
- name: Make sure output dirs were emptied
|
||||||
|
file:
|
||||||
|
path: "{{ zuul_output_dir }}/{{ item }}/file.txt"
|
||||||
|
state: absent
|
||||||
|
register: output_items
|
||||||
|
loop:
|
||||||
|
- docs
|
||||||
|
- artifacts
|
||||||
|
- logs
|
||||||
|
|
||||||
|
- name: Validate that files were removed in ensure-output-dirs
|
||||||
|
loop: "{{ output_items.results }}"
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- item is not changed
|
||||||
|
- item is succeeded
|
||||||
|
Loading…
Reference in New Issue
Block a user