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