From f07bf54f8bcea8bdd0cddf98d58e1ac57f098cfe Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Tue, 28 May 2024 15:14:31 +0300 Subject: [PATCH] ci: fix --- .ci/envsh.common | 13 +++++++++---- .dockerignore | 1 - Makefile | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.ci/envsh.common b/.ci/envsh.common index 252055d..819b758 100644 --- a/.ci/envsh.common +++ b/.ci/envsh.common @@ -37,19 +37,24 @@ image_tag_norm() { ## misc CI things # CI_COMMIT_SHORT_SHA="${CI_COMMIT_SHA:0:8}" CI_COMMIT_SHORT_SHA=$(printf '%s' "${CI_COMMIT_SHA}" | cut -c 1-8) -CI_COMMIT_REF_SLUG="$(ref_slug "${CI_COMMIT_BRANCH}")" +if [ -n "${CI_COMMIT_BRANCH}" ] ; then + CI_COMMIT_REF_SLUG="$(ref_slug "${CI_COMMIT_BRANCH}")" +fi if [ -n "${CI_COMMIT_SOURCE_BRANCH}" ] ; then CI_COMMIT_REF_SLUG="$(ref_slug "${CI_COMMIT_SOURCE_BRANCH}")" fi +if [ -n "${CI_COMMIT_TAG}" ] ; then + CI_COMMIT_REF_SLUG="$(ref_slug "${CI_COMMIT_TAG}")" +fi ## image tag(s) IMAGE_TAG="${CI_COMMIT_SHORT_SHA}-b${CI_PIPELINE_NUMBER}-${CI_COMMIT_REF_SLUG}" EXTRA_TAGS=$(image_tag_norm "branch-${CI_COMMIT_BRANCH}") if [ -n "${CI_COMMIT_TAG}" ] ; then - IMAGE_TAG="${CI_COMMIT_TAG}" - unset EXTRA_TAGS + IMAGE_TAG="${CI_COMMIT_SHORT_SHA}" + EXTRA_TAGS="${CI_COMMIT_REF_SLUG}" ## TODO: think about "latest" tag: it should be error-prone for "backward tag push" - # EXTRA_TAGS='latest' + # EXTRA_TAGS="${CI_COMMIT_REF_SLUG} latest" else if [ -n "${CI_COMMIT_SOURCE_BRANCH}" ] ; then echo "Running on branch '${CI_COMMIT_SOURCE_BRANCH}'" diff --git a/.dockerignore b/.dockerignore index 64f69ed..81bcb62 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,3 @@ publish-nexus* .ci/* .woodpecker/* .woodpecker.yml -dist/* diff --git a/Makefile b/Makefile index 71e0921..a511880 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,9 @@ $(OUTBIN): echo "!!! git information is asbent !!!" >&2 ; \ GO_BUILDFLAGS="-buildvcs=false $${GO_BUILDFLAGS}" ; \ fi ; \ + for i in $$(seq 1 3) ; do \ + if $(GO) get ; then break ; fi ; \ + done ; \ $(GO) build -o $@ \ $${GO_BUILDFLAGS} \ $(if $(strip $(TAGS)),-tags '$(strip $(TAGS))') \