Compare commits

..

3 Commits

Author SHA1 Message Date
William Bell
f3630fa35a add tag to build name 2025-12-01 03:42:36 +00:00
William Bell
8561f6d762 test 2025-12-01 03:40:00 +00:00
William Bell
1e21a7f11c fix tagging 2025-12-01 03:33:07 +00:00

56
Jenkinsfile vendored
View File

@@ -35,30 +35,18 @@ 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
currentBuild.displayName = "#${env.BUILD_NUMBER} ${tag}"
env.TAG_NAME = tag
}
}
}
@@ -138,26 +126,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"
}
}
}