From 55ff6674780f35a453ec312cdb96a5c0f4f1212b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 27 Feb 2024 14:13:52 +0100 Subject: [PATCH] chore(ci): use git describe for image version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way we get both the full commit and the version, whether it's a proper release or not. Signed-off-by: Jakub SokoĊ‚owski --- Dockerfile | 1 + Makefile | 3 ++- ci/Jenkinsfile.release | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 52459f6227..1cf659b1d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,7 @@ LABEL maintainer="jakub@status.im" LABEL source="https://github.com/waku-org/nwaku" LABEL description="Wakunode: Waku client" LABEL commit="unknown" +LABEL version="unknown" # DevP2P, LibP2P, and JSON RPC ports EXPOSE 30303 60000 8545 diff --git a/Makefile b/Makefile index c1745d535b..2125f5d85c 100644 --- a/Makefile +++ b/Makefile @@ -264,7 +264,8 @@ docker-image: --build-arg="NIMFLAGS=$(DOCKER_IMAGE_NIMFLAGS)" \ --build-arg="NIM_COMMIT=$(DOCKER_NIM_COMMIT)" \ --build-arg="LOG_LEVEL=$(LOG_LEVEL)" \ - --label="commit=$(GIT_VERSION)" \ + --label="commit=$(shell git rev-parse HEAD)" \ + --label="version=$(GIT_VERSION)" \ --target $(TARGET) \ --tag $(DOCKER_IMAGE_NAME) . diff --git a/ci/Jenkinsfile.release b/ci/Jenkinsfile.release index 8e51e88730..e4c42ed99b 100644 --- a/ci/Jenkinsfile.release +++ b/ci/Jenkinsfile.release @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.8.6' +library 'status-jenkins-lib@v1.8.9' pipeline { agent { label 'linux' } @@ -66,7 +66,9 @@ pipeline { steps { script { image = docker.build( "${params.IMAGE_NAME}:${params.IMAGE_TAG ?: env.GIT_COMMIT.take(8)}", - "--label=commit='${env.GIT_COMMIT.take(8)}' " + + "--label=build='${env.BUILD_URL}' " + + "--label=commit='${git.commit()}' " + + "--label=version='${git.describe()}' " + "--build-arg=MAKE_TARGET='${params.MAKE_TARGET}' " + "--build-arg=NIMFLAGS='${params.NIMFLAGS} -d:postgres ' " + "--build-arg=LOG_LEVEL='${params.LOWEST_LOG_LEVEL_ALLOWED}' " +