New try
All checks were successful
jenkins-ci Build successful

This commit is contained in:
2026-01-08 20:19:05 +01:00
parent 34f12e3e08
commit 047fde1cf5

14
Jenkinsfile vendored
View File

@@ -42,20 +42,20 @@ pipeline {
post {
always {
script {
// Fetch the current commit SHA
// 1. Get current commit SHA
def commitSha = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
// Define build status and description based on current result
// 2. Determine build status for Gitea
def buildState = currentBuild.currentResult == 'SUCCESS' ? 'success' : 'failure'
def buildDesc = currentBuild.currentResult == 'SUCCESS' ? 'Build successful' : 'Build failed'
// Notify Gitea using the API (requires credential in Jenkins)
withCredentials([[$class: 'StringBinding', credentialsId: 'jenkins', variable: 'GITEA_TOKEN']]) {
// 3. Send status to Gitea API using our new 'gitea-token'
withCredentials([string(credentialsId: 'gitea-token', variable: 'GITEA_TOKEN')]) {
sh """
curl -f -X POST "${GITEA_API_URL}/repos/${GITEA_REPO_PATH}/statuses/${commitSha}" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"state": "${buildState}", "target_url": "${env.BUILD_URL}", "description": "${buildDesc}", "context": "jenkins-ci"}'
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"state": "${buildState}", "target_url": "${env.BUILD_URL}", "description": "${buildDesc}", "context": "jenkins-ci"}'
"""
}
}