From f1a8594a2fc3ede2d030b2642efb2be7064b7d3a Mon Sep 17 00:00:00 2001 From: yuobrezkov Date: Wed, 9 Apr 2025 16:38:52 +0300 Subject: [PATCH 1/6] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 91a810d..92ccc9f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -85,10 +85,11 @@ pipeline { def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim() withCredentials([usernamePassword(credentialsId: 'gitea_creds', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) { def prId = env.CHANGE_ID + echo "GIT_COMMIT: ${env.GIT_COMMIT}" sh """ curl -v -X POST -u "${GITEA_USER}:${GITEA_PASS}" \ -H "Content-Type: application/json" \ - -d '{"tag_name": "${env.NEW_VERSION}", "name": "Release ${env.NEW_VERSION}", "target_commitish": "${commitHash}"}' \ + -d '{"tag_name": "${env.NEW_VERSION}", "name": "Release ${env.NEW_VERSION}", "target_commitish": "${env.GIT_COMMIT}"}' \ "${env.GITEA_REPOSITORY_URL}deployer3000/${env.IMAGE_NAME}/releases" """ echo "New release succeeded!" From 8cc0fe3dd79d337b9d9a59c357ca0d282555d19f Mon Sep 17 00:00:00 2001 From: yuobrezkov Date: Wed, 9 Apr 2025 16:41:26 +0300 Subject: [PATCH 2/6] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 92ccc9f..73525ca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,7 +82,7 @@ pipeline { script { if (env.CHANGE_BRANCH?.startsWith('rc')) { echo "Attempting to merge PR ${env.CHANGE_ID} into master..." - def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim() + def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim() || null withCredentials([usernamePassword(credentialsId: 'gitea_creds', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) { def prId = env.CHANGE_ID echo "GIT_COMMIT: ${env.GIT_COMMIT}" From 00d3927df69e64950bcd3ea11b15808e4f265ac0 Mon Sep 17 00:00:00 2001 From: yuobrezkov Date: Wed, 9 Apr 2025 16:42:34 +0300 Subject: [PATCH 3/6] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 73525ca..730a3cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,7 +30,7 @@ pipeline { stage ('Initialize variables') { steps { script { - def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() + def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() || null if (!lastVersion) { lastVersion = "0.0.0" @@ -82,7 +82,7 @@ pipeline { script { if (env.CHANGE_BRANCH?.startsWith('rc')) { echo "Attempting to merge PR ${env.CHANGE_ID} into master..." - def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim() || null + def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim() withCredentials([usernamePassword(credentialsId: 'gitea_creds', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) { def prId = env.CHANGE_ID echo "GIT_COMMIT: ${env.GIT_COMMIT}" From 82b6a1b765c13d4f50c335131dff70f786911d82 Mon Sep 17 00:00:00 2001 From: yuobrezkov Date: Wed, 9 Apr 2025 16:45:31 +0300 Subject: [PATCH 4/6] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 730a3cf..02c6b55 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,8 +30,10 @@ pipeline { stage ('Initialize variables') { steps { script { - def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() || null - + def hasTags = sh(script: "git tag -l | wc -l", returnStdout: true).trim().toInteger() > 0 + if (hasTags) { + def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() + } if (!lastVersion) { lastVersion = "0.0.0" } From 23700c92afc73c1f250b74a6acdf382dc392dbf7 Mon Sep 17 00:00:00 2001 From: yuobrezkov Date: Wed, 9 Apr 2025 16:49:50 +0300 Subject: [PATCH 5/6] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 02c6b55..2e9ddf2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,6 +31,7 @@ pipeline { steps { script { def hasTags = sh(script: "git tag -l | wc -l", returnStdout: true).trim().toInteger() > 0 + echo "${hasTags}" if (hasTags) { def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() } From 46172a59a732d02ab44af2995de852e7c27f0162 Mon Sep 17 00:00:00 2001 From: yuobrezkov Date: Wed, 9 Apr 2025 16:53:33 +0300 Subject: [PATCH 6/6] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B06?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2e9ddf2..0e41373 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,11 +32,11 @@ pipeline { script { def hasTags = sh(script: "git tag -l | wc -l", returnStdout: true).trim().toInteger() > 0 echo "${hasTags}" + + def lastVersion = "0.0.0" + if (hasTags) { - def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() - } - if (!lastVersion) { - lastVersion = "0.0.0" + lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() } echo "Last version: ${lastVersion}"