Compare commits
3 Commits
v1.0.0-jen
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3630fa35a | ||
|
|
8561f6d762 | ||
|
|
1e21a7f11c |
56
Jenkinsfile
vendored
56
Jenkinsfile
vendored
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user