From 8561f6d762ada67e5440203ad4b5ea44edb1c860 Mon Sep 17 00:00:00 2001 From: William Bell <62452284+Ugric@users.noreply.github.com> Date: Mon, 1 Dec 2025 03:40:00 +0000 Subject: [PATCH] test --- Jenkinsfile | 60 ++++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 44 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d8d364e..f15cdbf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,11 +26,6 @@ pipeline { } // update submodules - sh ''' - git fetch --tags - latest_tag=$(git describe --tags --abbrev=0) - git checkout tags/$latest_tag - ''' sh 'git submodule update --init --recursive' } } @@ -40,30 +35,17 @@ pipeline { stage('Detect Tag') { steps { script { - echo "REF from Gitea: ${env.GITEA_REF}" - echo "GIT_BRANCH: ${env.GIT_BRANCH}" - echo "GIT_TAG: ${env.GIT_TAG}" - def ref = sh(script: "git rev-parse --symbolic-full-name HEAD", returnStdout: true).trim() - if (ref.startsWith('refs/tags/')) { - def tag = ref.replace('refs/tags/', '') - echo "Tag detected: ${tag}" + def tag = sh(script: "git describe --tags --exact-match", returnStdout: true).trim() + echo "Tag detected: ${tag}" - if (tag.toLowerCase().contains('unsable')) { - echo "Tag contains 'unsable' → marking build UNSTABLE" - currentBuild.result = 'UNSTABLE' - } - - // Expose for other stages - env.TAG_NAME = tag - } else { - // Normal branch push = DEV build - def branchName = ref.replace("refs/heads/", "") - echo "Regular branch build: ${branchName}" - - // Mark display name as a dev build - currentBuild.displayName = "#${env.BUILD_NUMBER} DEV-${branchName}" + if (tag.toLowerCase().contains('unsable')) { + echo "Tag contains 'unsable' → marking build UNSTABLE" + currentBuild.result = 'UNSTABLE' } + + // Expose for other stages + env.TAG_NAME = tag } } } @@ -143,26 +125,16 @@ stage('Archive Build Artifacts') { always { script { // Automatically detects full ref name - def ref = sh(script: "git rev-parse --symbolic-full-name HEAD", returnStdout: true).trim() + def tag = sh(script: "git describe --tags --exact-match", returnStdout: true).trim() + echo "Detected tag: ${tag}" - if (ref.startsWith("refs/tags/")) { - // Extract tag name - def tag = ref.replace("refs/tags/", "") - echo "Detected tag: ${tag}" - - if (tag.toLowerCase().contains("unstable")) { - echo "Unstable tag detected" - currentBuild.result = "UNSTABLE" - } else { - echo "Stable tagged build" - currentBuild.description = "Stable" - currentBuild.result = "SUCCESS" - } - - } else { + if (tag.toLowerCase().contains("unstable")) { + echo "Unstable tag detected" currentBuild.result = "UNSTABLE" - echo "Regular commit → marking as dev build" - currentBuild.description = "Dev Build" + } else { + echo "Stable tagged build" + currentBuild.description = "Stable" + currentBuild.result = "SUCCESS" } } }