From a49ea2fd824363dd40210da4343ddc968fcd01d3 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Tue, 9 Mar 2021 14:07:02 +0000 Subject: [PATCH] Fix the branch selection in cronjobs Fix the branch selection in cronjobs by: - checking for main before master - make the regex more robust by adding a $ to avoid partial matches Signed-off-by: Andrea Frittoli --- tekton/cronjobs/bases/release/trigger-with-uuid.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tekton/cronjobs/bases/release/trigger-with-uuid.yaml b/tekton/cronjobs/bases/release/trigger-with-uuid.yaml index 542b86fc6..6af3ddcf1 100644 --- a/tekton/cronjobs/bases/release/trigger-with-uuid.yaml +++ b/tekton/cronjobs/bases/release/trigger-with-uuid.yaml @@ -33,10 +33,10 @@ spec: - -ce - | GIT_SHA=$(git ls-remote --heads https://${GIT_REPO} | \ - awk '/refs\/heads\/master/{ print $1 }') + awk '/refs\/heads\/main$/{ print $1 }') if [ "${GIT_SHA}" == "" ]; then GIT_SHA=$(git ls-remote --heads https://${GIT_REPO} | \ - awk '/refs\/heads\/main/{ print $1 }') + awk '/refs\/heads\/master$/{ print $1 }') fi VERSION_TAG="v$(date +"%Y%m%d")-$(echo $GIT_SHA | cut -c 1-10)" cat < /shared/git