ci: fix
This commit is contained in:
parent
a0cfdfa8a5
commit
f07bf54f8b
|
@ -37,19 +37,24 @@ image_tag_norm() {
|
||||||
## misc CI things
|
## misc CI things
|
||||||
# CI_COMMIT_SHORT_SHA="${CI_COMMIT_SHA:0:8}"
|
# CI_COMMIT_SHORT_SHA="${CI_COMMIT_SHA:0:8}"
|
||||||
CI_COMMIT_SHORT_SHA=$(printf '%s' "${CI_COMMIT_SHA}" | cut -c 1-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
|
if [ -n "${CI_COMMIT_SOURCE_BRANCH}" ] ; then
|
||||||
CI_COMMIT_REF_SLUG="$(ref_slug "${CI_COMMIT_SOURCE_BRANCH}")"
|
CI_COMMIT_REF_SLUG="$(ref_slug "${CI_COMMIT_SOURCE_BRANCH}")"
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${CI_COMMIT_TAG}" ] ; then
|
||||||
|
CI_COMMIT_REF_SLUG="$(ref_slug "${CI_COMMIT_TAG}")"
|
||||||
|
fi
|
||||||
|
|
||||||
## image tag(s)
|
## image tag(s)
|
||||||
IMAGE_TAG="${CI_COMMIT_SHORT_SHA}-b${CI_PIPELINE_NUMBER}-${CI_COMMIT_REF_SLUG}"
|
IMAGE_TAG="${CI_COMMIT_SHORT_SHA}-b${CI_PIPELINE_NUMBER}-${CI_COMMIT_REF_SLUG}"
|
||||||
EXTRA_TAGS=$(image_tag_norm "branch-${CI_COMMIT_BRANCH}")
|
EXTRA_TAGS=$(image_tag_norm "branch-${CI_COMMIT_BRANCH}")
|
||||||
if [ -n "${CI_COMMIT_TAG}" ] ; then
|
if [ -n "${CI_COMMIT_TAG}" ] ; then
|
||||||
IMAGE_TAG="${CI_COMMIT_TAG}"
|
IMAGE_TAG="${CI_COMMIT_SHORT_SHA}"
|
||||||
unset EXTRA_TAGS
|
EXTRA_TAGS="${CI_COMMIT_REF_SLUG}"
|
||||||
## TODO: think about "latest" tag: it should be error-prone for "backward tag push"
|
## 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
|
else
|
||||||
if [ -n "${CI_COMMIT_SOURCE_BRANCH}" ] ; then
|
if [ -n "${CI_COMMIT_SOURCE_BRANCH}" ] ; then
|
||||||
echo "Running on branch '${CI_COMMIT_SOURCE_BRANCH}'"
|
echo "Running on branch '${CI_COMMIT_SOURCE_BRANCH}'"
|
||||||
|
|
|
@ -4,4 +4,3 @@ publish-nexus*
|
||||||
.ci/*
|
.ci/*
|
||||||
.woodpecker/*
|
.woodpecker/*
|
||||||
.woodpecker.yml
|
.woodpecker.yml
|
||||||
dist/*
|
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -46,6 +46,9 @@ $(OUTBIN):
|
||||||
echo "!!! git information is asbent !!!" >&2 ; \
|
echo "!!! git information is asbent !!!" >&2 ; \
|
||||||
GO_BUILDFLAGS="-buildvcs=false $${GO_BUILDFLAGS}" ; \
|
GO_BUILDFLAGS="-buildvcs=false $${GO_BUILDFLAGS}" ; \
|
||||||
fi ; \
|
fi ; \
|
||||||
|
for i in $$(seq 1 3) ; do \
|
||||||
|
if $(GO) get ; then break ; fi ; \
|
||||||
|
done ; \
|
||||||
$(GO) build -o $@ \
|
$(GO) build -o $@ \
|
||||||
$${GO_BUILDFLAGS} \
|
$${GO_BUILDFLAGS} \
|
||||||
$(if $(strip $(TAGS)),-tags '$(strip $(TAGS))') \
|
$(if $(strip $(TAGS)),-tags '$(strip $(TAGS))') \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user