From 362c43b28d934527153692e9391c1ea77bd82cd4 Mon Sep 17 00:00:00 2001 From: Sdevanahally Date: Fri, 2 Oct 2026 20:30:08 +0000 Subject: [PATCH] Add Gitea commit status reporting --- Jenkinsfile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index bf8f4a4..00c0546 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,4 +16,34 @@ pipeline { } } } + post { + success { + withCredentials([usernamePassword( + credentialsId: 'gitea-token', + usernameVariable: 'GITEA_USER', + passwordVariable: 'GITEA_TOKEN')]) { + sh ''' + curl -s -X POST \ + "https://git.ssw590.abrdns.com/api/v1/repos/StartupTeam/Strartup-product/statuses/${GIT_COMMIT}" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d '{"state":"success","context":"continuous-integration/jenkins","description":"Build passed"}' + ''' + } + } + failure { + withCredentials([usernamePassword( + credentialsId: 'gitea-token', + usernameVariable: 'GITEA_USER', + passwordVariable: 'GITEA_TOKEN')]) { + sh ''' + curl -s -X POST \ + "https://git.ssw590.abrdns.com/api/v1/repos/StartupTeam/Strartup-product/statuses/${GIT_COMMIT}" \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: application/json" \ + -d '{"state":"failure","context":"continuous-integration/jenkins","description":"Build failed"}' + ''' + } + } + } } \ No newline at end of file