Files
hello-ci/Jenkinsfile

33 lines
964 B
Groovy

pipeline {
agent any
stages {
stage("Build") {
steps {
echo "Hello from Gitea + Jenkins CI"
echo "Webhook trigger is working"
sh "date"
}
}
}
post {
always {
script {
def status = currentBuild.currentResult
def payload = groovy.json.JsonOutput.toJson([
name: env.JOB_NAME,
build: [
number: env.BUILD_NUMBER as int,
status: status,
phase: "COMPLETED",
duration: currentBuild.duration,
full_url: env.BUILD_URL
]
])
sh """curl -s -X POST http://127.0.0.1:9090/jenkins \
-H 'Content-Type: application/json' \
-d '${payload}'"""
}
}
}
}