Compare commits
No commits in common. "607e884a819b5a7464fe9ee1c1ce18d431010473" and "4e1cd72f59da89497bde1f1c4249ea4e22c1a515" have entirely different histories.
607e884a81
...
4e1cd72f59
|
|
@ -30,23 +30,7 @@ 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
|
env.IMAGE_TAG = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim()
|
||||||
echo "${hasTags}"
|
|
||||||
|
|
||||||
def lastVersion = "0.0.0"
|
|
||||||
|
|
||||||
if (hasTags) {
|
|
||||||
lastVersion = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Last version: ${lastVersion}"
|
|
||||||
|
|
||||||
def (major, minor, patch) = lastVersion.tokenize('.')
|
|
||||||
def newVersion = "${major}.${minor}.${patch.toInteger() + 1}"
|
|
||||||
echo "New version: ${newVersion}"
|
|
||||||
|
|
||||||
env.IMAGE_TAG = newVersion
|
|
||||||
env.NEW_VERSION = newVersion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -87,29 +71,17 @@ pipeline {
|
||||||
echo "Attempting to merge PR ${env.CHANGE_ID} into master..."
|
echo "Attempting to merge PR ${env.CHANGE_ID} into master..."
|
||||||
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
|
||||||
|
|
||||||
sh """
|
sh """
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-u "${GITEA_USER}:${GITEA_PASS}" \
|
-u "${GITEA_USER}:${GITEA_PASS}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"do":"merge"}' \
|
-d '{"do":"merge"}' \
|
||||||
http://git.entcor/api/v1/repos/deployer3000/${env.IMAGE_NAME}/pulls/${prId}/merge
|
http://git.entcor/api/v1/repos/deployer3000/trust-module-backend/pulls/${prId}/merge
|
||||||
"""
|
"""
|
||||||
def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim() // необходим для корректного отображения статусов
|
|
||||||
echo "PR ${prId} merged successfully into main!"
|
echo "PR ${prId} merged successfully into main!"
|
||||||
sleep(time: 15, unit: 'SECONDS')
|
def context = "test-org/trust-module-backend/pipeline/pr-${env.CHANGE_TARGET}"
|
||||||
sh "git checkout main && git pull origin main"
|
def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim()
|
||||||
|
notify(context, GITEA_USER, GITEA_PASS, env.GITEA_REPOSITORY_URL, "trust-module-backend", commitHash, "success")
|
||||||
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": "main"}' \
|
|
||||||
"${env.GITEA_REPOSITORY_URL}deployer3000/${env.IMAGE_NAME}/releases"
|
|
||||||
"""
|
|
||||||
echo "New release succeeded!"
|
|
||||||
|
|
||||||
def context = "test-org/${env.IMAGE_NAME}/pipeline/pr-${env.CHANGE_TARGET}"
|
|
||||||
notify(context, GITEA_USER, GITEA_PASS, env.GITEA_REPOSITORY_URL, env.IMAGE_NAME, commitHash, "success")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue