Compare commits

..

No commits in common. "0742af6f9279f79d4ccf01e46fcabe75dbdfbe84" and "cadbc249a99f72c74e3177d610254cefadefb768" have entirely different histories.

1 changed files with 4 additions and 8 deletions

12
Jenkinsfile vendored
View File

@ -30,13 +30,10 @@ pipeline {
stage ('Initialize variables') { stage ('Initialize variables') {
steps { steps {
script { script {
def hasTags = sh(script: "git tag -l | wc -l", returnStdout: true).trim().toInteger() > 0 def lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim()
echo "${hasTags}"
def lastVersion = "0.0.0" if (!lastVersion) {
lastVersion = "0.0.0"
if (hasTags) {
lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim()
} }
echo "Last version: ${lastVersion}" echo "Last version: ${lastVersion}"
@ -88,11 +85,10 @@ pipeline {
def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim() def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim()
withCredentials([usernamePassword(credentialsId: 'gitea_creds', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) { withCredentials([usernamePassword(credentialsId: 'gitea_creds', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) {
def prId = env.CHANGE_ID def prId = env.CHANGE_ID
echo "GIT_COMMIT: ${env.GIT_COMMIT}"
sh """ sh """
curl -v -X POST -u "${GITEA_USER}:${GITEA_PASS}" \ curl -v -X POST -u "${GITEA_USER}:${GITEA_PASS}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"tag_name": "${env.NEW_VERSION}", "name": "Release ${env.NEW_VERSION}", "target_commitish": "${env.GIT_COMMIT}"}' \ -d '{"tag_name": "${env.NEW_VERSION}", "name": "Release ${env.NEW_VERSION}", "target_commitish": "${commitHash}"}' \
"${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!"