feat: append branch into tags if not main
This commit is contained in:
parent
4b62adacb1
commit
47140c2d81
15
podman.mk
15
podman.mk
@ -1,12 +1,19 @@
|
|||||||
# Parse version from latest git semver tag
|
# Parse version from latest git semver tag
|
||||||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||||
GIT_TAG=$(shell git describe --tags --match v*.*.* 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)
|
GIT_TAG := $(shell git describe --tags --match v*.*.* 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)
|
||||||
TAG ?= $(shell echo $(GIT_TAG) | awk -F '-' '{ print $$1 "-" $$2 }' | sed -e 's/-$$//')
|
TAG := $(GIT_TAG)
|
||||||
# EXTRA_TAGS supposed to be set at the caller, eg. $(shell echo $(TAG) | awk -F '.' '{ print $$1 "." $$2 }')
|
|
||||||
|
# append branch name to tag if NOT main nor master
|
||||||
|
ifeq (,$(filter main master, $(BRANCH)))
|
||||||
|
TAG = $(GIT_TAG)-$(BRANCH)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# optionally set by the caller
|
||||||
|
EXTRA_TAGS :=
|
||||||
|
|
||||||
ARCH := amd64
|
ARCH := amd64
|
||||||
ALL_ARCHS := amd64 arm64
|
ALL_ARCHS := amd64 arm64
|
||||||
_ARCH = $(or $(filter ${ARCH},${ALL_ARCHS}),$(error $$ARCH [${ARCH}] must be exactly one of ${ALL_ARCHS}))
|
_ARCH = $(or $(filter $(ARCH),$(ALL_ARCHS)),$(error $$ARCH [$(ARCH)] must be exactly one of "$(ALL_ARCHS)"))
|
||||||
|
|
||||||
ifneq ($(TRIVY_REMOTE),)
|
ifneq ($(TRIVY_REMOTE),)
|
||||||
TRIVY_OPTS := --server $(TRIVY_REMOTE)
|
TRIVY_OPTS := --server $(TRIVY_REMOTE)
|
||||||
|
@ -10,6 +10,7 @@ def call(Map config=[:]) {
|
|||||||
stages {
|
stages {
|
||||||
stage('Prepare') {
|
stage('Prepare') {
|
||||||
steps {
|
steps {
|
||||||
|
// pull tags
|
||||||
withCredentials([gitUsernamePassword(credentialsId: 'gitea-jenkins-user')]) {
|
withCredentials([gitUsernamePassword(credentialsId: 'gitea-jenkins-user')]) {
|
||||||
sh 'git fetch -q --tags ${GIT_URL}'
|
sh 'git fetch -q --tags ${GIT_URL}'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user