From 977aaf6f591acee16da171a62425f00ce6661195 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 2 Feb 2023 14:52:46 +1100 Subject: [PATCH] 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 --- .../registry/buildset-registry-k8s-crio.yaml | 12 ++++++++---- .../registry/buildset-registry-k8s-microk8s.yaml | 12 ++++++++++-- .../registry/buildset-registry-openshift-docker.yaml | 12 ++++++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/test-playbooks/registry/buildset-registry-k8s-crio.yaml b/test-playbooks/registry/buildset-registry-k8s-crio.yaml index 035f69c20..6a3288a6c 100644 --- a/test-playbooks/registry/buildset-registry-k8s-crio.yaml +++ b/test-playbooks/registry/buildset-registry-k8s-crio.yaml @@ -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 diff --git a/test-playbooks/registry/buildset-registry-k8s-microk8s.yaml b/test-playbooks/registry/buildset-registry-k8s-microk8s.yaml index f893bfe21..253e6de31 100644 --- a/test-playbooks/registry/buildset-registry-k8s-microk8s.yaml +++ b/test-playbooks/registry/buildset-registry-k8s-microk8s.yaml @@ -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 diff --git a/test-playbooks/registry/buildset-registry-openshift-docker.yaml b/test-playbooks/registry/buildset-registry-openshift-docker.yaml index 8437fe985..aec5958dd 100644 --- a/test-playbooks/registry/buildset-registry-openshift-docker.yaml +++ b/test-playbooks/registry/buildset-registry-openshift-docker.yaml @@ -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