Compare commits

...

2 Commits

Author SHA1 Message Date
deployer3000 18453be2aa Merge pull request 'added fn notify' (#14) from rc into master 2025-04-10 12:01:26 +03:00
yuobrezkov 165796aa54 added fn notify
test-org/prometheus-exporter/pipeline/pr-master Build succeeded
2025-04-10 11:57:48 +03:00
1 changed files with 21 additions and 0 deletions

21
Jenkinsfile vendored
View File

@ -1,3 +1,24 @@
def notify(
String context,
String giteaUser,
String giteaPass,
String repositoryUrl,
String repositoryName,
String commitHash,
String buildStatus
) {
def status = buildStatus == 'success' ? 'success' : 'failure'
def description = buildStatus == 'success' ? 'Build succeeded' : 'Build failed'
sh """
curl -X POST \
-u "${giteaUser}:${giteaPass}" \
-H "Content-Type: application/json" \
-d '{"context":"${context}","state": "${status}", "description": "${description}"}' \
${repositoryUrl}deployer3000/${repositoryName}/statuses/${commitHash}
"""
}
pipeline {
agent any
environment {