This is a communication issue between Google Cloud Build verify and Skaffold verify. Skaffold allows you to specify a Kubernetes Job file.
apiVersion: skaffold/v4beta13
kind: Config
verify:
- name: "verify-fail"
container:
name: test-verifier
image: ubuntu
executionMode:
kubernetesCluster:
jobManifestPath: test-job.yaml
test-job.yaml is a Kubernetes job
apiVersion: batch/v1
kind: Job
metadata:
name: test-verifier
namespace: deployment-ns
spec:
template:
spec:
containers:
- name: test-verifier
image: ubuntu
command: ["/bin/sh"]
args: ["-c", "echo 'Test fail'; exit 1"]
restartPolicy: Never
backoffLimit: 0
podFailurePolicy:
rules:
- action: FailJob
onExitCodes:
containerName: test-verifier
operator: NotIn
values: [0]
The exit code is not respected; it does not cause the Google Cloud deploy verify to fail. I would suppose that Skaffold is not picking up the exit code of the test-verifier container and the subsequent failure of the test-verifier job. I would expect the behavior to be the same as
apiVersion: skaffold/v4beta13
kind: Config
verify:
- name: "verify-fail"
container:
name: test-verifier
image: ubuntu
command: ["/bin/sh"]
args: ["-c", "echo 'Test fail'; exit 1" ]
executionMode:
kubernetesCluster: {}
but run in the default namespace rather than in the namespace specified in the Kubernetes Job definition. This version causes Google Cloud Deploy verify to fail as expected.
This is a communication issue between Google Cloud Build verify and Skaffold verify. Skaffold allows you to specify a Kubernetes Job file.
test-job.yaml is a Kubernetes job
The exit code is not respected; it does not cause the Google Cloud deploy verify to fail. I would suppose that Skaffold is not picking up the exit code of the test-verifier container and the subsequent failure of the test-verifier job. I would expect the behavior to be the same as
but run in the default namespace rather than in the namespace specified in the Kubernetes Job definition. This version causes Google Cloud Deploy verify to fail as expected.