Compare commits

..

3 Commits

Author SHA1 Message Date
deployer3000 1e1b48685d Merge pull request 'rc' (#3) from rc into main 2025-04-09 15:57:36 +03:00
yuobrezkov 414835c013 Проверка 1002
test-org/test-ci-cd/pipeline/pr-main This commit looks good Details
2025-04-09 15:55:30 +03:00
yuobrezkov 707780e0dc Проверка 1001 2025-04-09 15:51:27 +03:00
1 changed files with 6 additions and 4 deletions

10
Jenkinsfile vendored
View File

@ -30,21 +30,23 @@ pipeline {
stage ('Initialize variables') { stage ('Initialize variables') {
steps { steps {
script { script {
withCredentials([usernamePassword(credentialsId: 'gitea_creds', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) {
lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim() lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim()
if (!lastVersion) { if (!lastVersion) {
lastVersion = "0.0.0" lastVersion = "0.0.0"
} }
sh "echo ${lastVersion}"
echo "Last version: ${lastVersion}"
def (major, minor, patch) = lastVersion.tokenize('.') def (major, minor, patch) = lastVersion.tokenize('.')
def newVersion = "${major}.${minor}.${patch.toInteger() + 1}" def newVersion = "${major}.${minor}.${patch.toInteger() + 1}"
echo "New version: ${newVersion}"
env.IMAGE_TAG = newVersion env.IMAGE_TAG = newVersion
env.NEW_VERSION = newVersion env.NEW_VERSION = newVersion
} }
} }
} }
}
stage ('Build docker image') { stage ('Build docker image') {
when { when {
expression { env.CHANGE_BRANCH?.startsWith('rc') } expression { env.CHANGE_BRANCH?.startsWith('rc') }
@ -97,7 +99,7 @@ pipeline {
"${env.GITEA_REPOSITORY_URL}deployer3000/${env.IMAGE_NAME}/releases" "${env.GITEA_REPOSITORY_URL}deployer3000/${env.IMAGE_NAME}/releases"
""" """
echo "New release succeeded!" echo "New release succeeded!"
def context = "test-org/trust-module-backend/pipeline/pr-${env.CHANGE_TARGET}" def context = "test-org/${env.IMAGE_NAME}/pipeline/pr-${env.CHANGE_TARGET}"
def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim() def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim()
notify(context, GITEA_USER, GITEA_PASS, env.GITEA_REPOSITORY_URL, env.IMAGE_NAME, commitHash, "success") notify(context, GITEA_USER, GITEA_PASS, env.GITEA_REPOSITORY_URL, env.IMAGE_NAME, commitHash, "success")
} }