Merge latest ci-tools-lib
This commit is contained in:
commit
7043dcb2bf
@ -1,30 +1,26 @@
|
|||||||
# Parse version from latest git semver tag
|
# Parse version from latest git semver tag
|
||||||
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)
|
||||||
|
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||||
|
|
||||||
GIT_BRANCH ?= $(shell git name-rev --name-only HEAD 2>/dev/null | sed -e 's,remotes/origin/,,' -e 's/[^a-zA-Z0-9]/-/g')
|
TAG ::= $(GIT_TAG)
|
||||||
# if "tags/" is in the branchname we are actually on a tag and need to use rev-parse instead
|
|
||||||
ifeq ($(findstring tags/, $(GIT_TAG)),)
|
|
||||||
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
||||||
endif
|
|
||||||
|
|
||||||
TAG := $(GIT_TAG)
|
|
||||||
# append branch name to tag if NOT main nor master
|
# append branch name to tag if NOT main nor master
|
||||||
ifeq (,$(filter main master, $(GIT_BRANCH)))
|
ifeq (,$(filter main master, $(GIT_BRANCH)))
|
||||||
# If branch is substring of tag, omit branch name
|
# If branch is substring of tag, omit branch name
|
||||||
ifeq ($(findstring $(GIT_BRANCH), $(GIT_TAG)),)
|
ifeq ($(findstring $(GIT_BRANCH), $(GIT_TAG)),)
|
||||||
# only append branch name if not equal tag
|
# only append branch name if not equal tag
|
||||||
ifneq ($(GIT_TAG), $(GIT_BRANCH))
|
ifneq ($(GIT_TAG), $(GIT_BRANCH))
|
||||||
TAG = $(GIT_TAG)-$(GIT_BRANCH)
|
# Sanitize GIT_BRANCH to allowed Docker tag character set
|
||||||
|
TAG = $(GIT_TAG)-$(shell echo $$GIT_BRANCH | sed -e 's/[^a-zA-Z0-9]/-/g')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
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)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.SILENT: ; # no need for @
|
.SILENT: ; # no need for @
|
||||||
|
@ -10,10 +10,11 @@ def call(Map config=[:]) {
|
|||||||
stages {
|
stages {
|
||||||
stage('Prepare') {
|
stage('Prepare') {
|
||||||
steps {
|
steps {
|
||||||
|
// we set pull tags as project adv. options
|
||||||
// pull tags
|
// 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}'
|
||||||
}
|
//}
|
||||||
// Optional project specific preparations
|
// Optional project specific preparations
|
||||||
sh 'make prepare'
|
sh 'make prepare'
|
||||||
}
|
}
|
||||||
@ -22,7 +23,7 @@ def call(Map config=[:]) {
|
|||||||
// Build using rootless podman
|
// Build using rootless podman
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
sh 'make build'
|
sh 'make build GIT_BRANCH=$GIT_BRANCH'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user