ansible-lint: use pipefail

Use pipefail in some shell commands.  In this case I don't think we
can really be fooled, but not a bad idea to fail if the first command
errors.

Change-Id: I25750c4edfe815af9e9d9ee47639b315e7133aa2
This commit is contained in:
Ian Wienand 2023-02-02 14:52:46 +11:00
parent 0958588280
commit 977aaf6f59
No known key found for this signature in database
3 changed files with 26 additions and 10 deletions

View File

@ -21,15 +21,19 @@
- name: Wait for the pod to be ready
command: kubectl wait --for=condition=Ready pod/quaytest --timeout=60s
- name: Check the output of the pod
shell: "kubectl logs pod/quaytest | grep 'Zuul container test'"
shell: |
set -o pipefail
kubectl logs pod/quaytest | grep 'Zuul container test'
args:
warn: false
executable: /bin/bash
- name: Run a remote test pod
command: kubectl run --image=docker.io/debian:testing upstream-dockertest --command -- /bin/bash -c 'echo Upstream; sleep infinity'
- name: Wait for the pod to be ready
command: kubectl wait --for=condition=Ready pod/upstream-dockertest --timeout=60s
- name: Check the output of the pod
shell: "kubectl logs pod/upstream-dockertest | grep 'Upstream'"
shell: |
set -o pipefail
kubectl logs pod/upstream-dockertest | grep 'Upstream'
args:
warn: false
executable: /bin/bash

View File

@ -28,7 +28,11 @@
command: kubectl wait --for=condition=Ready pod/quaytest --timeout=60s
- name: Check the output of the pod
shell: "kubectl logs pod/quaytest | grep 'Zuul container test'"
shell: |
set -o pipefail
kubectl logs pod/quaytest | grep 'Zuul container test'
args:
executable: /bin/bash
- name: Run a remote test pod
command: kubectl run --image=docker.io/debian:testing upstream-dockertest --command -- /bin/bash -c 'echo Upstream; sleep infinity'
@ -44,4 +48,8 @@
command: kubectl wait --for=condition=Ready pod/upstream-dockertest --timeout=60s
- name: Check the output of the pod
shell: "kubectl logs pod/upstream-dockertest | grep 'Upstream'"
shell: |
set -o pipefail
kubectl logs pod/upstream-dockertest | grep 'Upstream'
args:
executable: /bin/bash

View File

@ -17,15 +17,19 @@
- name: Wait for the pod to be ready
command: oc wait --for=condition=Ready pod/dockertest --timeout=60s
- name: Check the output of the pod
shell: "oc logs pod/dockertest | grep 'Zuul container test'"
shell: |
set -o pipefail
oc logs pod/dockertest | grep 'Zuul container test'
args:
warn: false
executable: /bin/bash
- name: Run a remote test pod
command: oc run --generator=run-pod/v1 --image=debian:testing upstream-dockertest --command -- /bin/bash -c 'echo Upstream; sleep infinity'
- name: Wait for the pod to be ready
command: oc wait --for=condition=Ready pod/upstream-dockertest --timeout=60s
- name: Check the output of the pod
shell: "oc logs pod/upstream-dockertest | grep 'Upstream'"
shell: |
set -o pipefail
oc logs pod/upstream-dockertest | grep 'Upstream'
args:
warn: false
executable: /bin/bash