Проверка6
test-org/test-ci-cd/pipeline/pr-main There was a failure building this commit
Details
test-org/test-ci-cd/pipeline/pr-main There was a failure building this commit
Details
parent
1c1b0765be
commit
efa7794e38
|
|
@ -44,13 +44,6 @@ pipeline {
|
||||||
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}"
|
||||||
env.IMAGE_TAG = newVersion
|
env.IMAGE_TAG = newVersion
|
||||||
|
|
||||||
sh """
|
|
||||||
curl -X POST -u "${GITEA_USER}:${GITEA_PASS}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"tag_name": "${newVersion}", "name": "Release ${newVersion}", "target_commitish": "${env.GIT_COMMIT}"}' \
|
|
||||||
"${env.GITEA_REPOSITORY_URL}deployer3000/${env.IMAGE_NAME}/releases"
|
|
||||||
"""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -66,18 +59,18 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage ('Push docker image to registry') {
|
// stage ('Push docker image to registry') {
|
||||||
when {
|
// when {
|
||||||
expression { env.CHANGE_BRANCH?.startsWith('rc') }
|
// expression { env.CHANGE_BRANCH?.startsWith('rc') }
|
||||||
}
|
// }
|
||||||
steps {
|
// steps {
|
||||||
script {
|
// script {
|
||||||
docker.withRegistry('https://registry.entcor/harbor/', 'harbor-credentials-id') {
|
// docker.withRegistry('https://registry.entcor/harbor/', 'harbor-credentials-id') {
|
||||||
docker.image("${env.REGISTRY_NAME}/${env.IMAGE_NAME}:${env.IMAGE_TAG}").push()
|
// docker.image("${env.REGISTRY_NAME}/${env.IMAGE_NAME}:${env.IMAGE_TAG}").push()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
|
|
@ -86,27 +79,34 @@ pipeline {
|
||||||
sh "rm -rf ${env.WORKSPACE}/rc/ || true"
|
sh "rm -rf ${env.WORKSPACE}/rc/ || true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// success {
|
success {
|
||||||
// script {
|
script {
|
||||||
// if (env.CHANGE_BRANCH?.startsWith('rc')) {
|
if (env.CHANGE_BRANCH?.startsWith('rc')) {
|
||||||
// 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/trust-module-backend/pulls/${prId}/merge
|
http://git.entcor/api/v1/repos/deployer3000/trust-module-backend/pulls/${prId}/merge
|
||||||
// """
|
"""
|
||||||
// echo "PR ${prId} merged successfully into main!"
|
echo "PR ${prId} merged successfully into main!"
|
||||||
// def context = "test-org/trust-module-backend/pipeline/pr-${env.CHANGE_TARGET}"
|
sh """
|
||||||
// def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim()
|
curl -X POST -u "${GITEA_USER}:${GITEA_PASS}" \
|
||||||
// notify(context, GITEA_USER, GITEA_PASS, env.GITEA_REPOSITORY_URL, "trust-module-backend", commitHash, "success")
|
-H "Content-Type: application/json" \
|
||||||
// }
|
-d '{"tag_name": "${newVersion}", "name": "Release ${newVersion}", "target_commitish": "${env.GIT_COMMIT}"}' \
|
||||||
// }
|
"${env.GITEA_REPOSITORY_URL}deployer3000/${env.IMAGE_NAME}/releases"
|
||||||
// }
|
"""
|
||||||
// }
|
echo "New release succeeded!"
|
||||||
|
def context = "test-org/trust-module-backend/pipeline/pr-${env.CHANGE_TARGET}"
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
failure {
|
failure {
|
||||||
echo "Pipeline failed. Check the logs for details."
|
echo "Pipeline failed. Check the logs for details."
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue