From 2a4cf789522725c7b9e1840dcdbd215e54bf9c69 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Wed, 31 Jul 2024 12:27:36 +0100 Subject: [PATCH] Do not fail on missing dockerfile When a dockerfile is removed, the build CI job fails today as it see the file in the list of modified ones, but cannot locate it to run the test. This still logs the missing file condition, but do not fail, so that we may pass CI on PRs that delete a dockerfile, like: - https://github.com/tektoncd/plumbing/pull/2065 - https://github.com/tektoncd/plumbing/pull/2064 Signed-off-by: Andrea Frittoli --- tekton/ci/jobs/tekton-image-build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tekton/ci/jobs/tekton-image-build.yaml b/tekton/ci/jobs/tekton-image-build.yaml index e3b511420..29947b898 100644 --- a/tekton/ci/jobs/tekton-image-build.yaml +++ b/tekton/ci/jobs/tekton-image-build.yaml @@ -47,7 +47,9 @@ spec: while [ ! -f "${CONTEXT}/Dockerfile" ]; do if [ "${CONTEXT}" == "/" ]; then echo "No Dockerfile found in ${FQ_DOCKER_FILE}'s directory or any of its parents" - exit 1 + # The file may be missing if it was deleted as part of the PR + # so we stop building but do not fail + exit 0 fi CONTEXT=$(dirname ${CONTEXT}) done