zuul-jobs/test-playbooks/stage-output.yaml
James E. Blair f0d7c980b5 Handle no-sudo in stage-output
The stage-output role had two assumptions:

1) The zuul_copy_output variable would always be defined
2) The role would be able to sudo on the remote node

To make it easier for users who want to use this in a base job,
remove both of those assumptions.

1) We now supply a default empty dict if the variable is not defined
so that the role does not fail with an error.

2) We check to see if we can sudo on the remote node, and if we can,
we do when copying files; otherwise we don't, and assume that the
user will only specify files they have access to (if they don't then
the copy will fail).

Change-Id: I5428c44adfafac4872342b59a92de311f41687b6
2021-05-31 15:47:57 -07:00

22 lines
545 B
YAML

- hosts: all
tasks:
- name: Write a test file
copy:
content: "Test file"
dest: "/tmp/test-output.txt"
- name: Test stage-output with a file
include_role:
name: stage-output
vars:
zuul_copy_output:
/tmp/test-output.txt: logs
- name: Test stage-output with no input
include_role:
name: stage-output
- name: Remove sudo
include_role:
name: revoke-sudo
- name: Test stage-output without sudo
include_role:
name: stage-output