#13 Trigger deploy webhook
All checks were successful
Amarillo/amarillo-gitea/amarillo-core/pipeline/head This commit looks good

This commit is contained in:
Csaba 2024-01-16 15:11:22 +01:00
parent 3965bd575c
commit cfa05d4fb3

50
Jenkinsfile vendored
View file

@ -9,6 +9,8 @@ pipeline {
IMAGE_NAME = 'amarillo' IMAGE_NAME = 'amarillo'
TAG = 'latest' TAG = 'latest'
PLUGINS = 'amarillo-metrics amarillo-enhancer' PLUGINS = 'amarillo-metrics amarillo-enhancer'
DEPLOY_WEBHOOK_URL = 'http://amarillo.mfdz.de:8888/mitanand'
DEPLOY_SECRET = credentials('AMARILLO-JENKINS-DEPLOY-SECRET')
} }
stages { stages {
stage('Build docker image') { stage('Build docker image') {
@ -20,22 +22,22 @@ pipeline {
} }
} }
} }
stage('Run tests on image'){ // stage('Run tests on image'){
steps{ // steps{
script { // script {
docker.image("${OWNER}/${IMAGE_NAME}:${TAG}").inside( // docker.image("${OWNER}/${IMAGE_NAME}:${TAG}").inside(
"--name amarillo -p 8000:80 -e MODULE_NAME=amarillo.app.main -e MAX_WORKERS=1 -e ADMIN_TOKEN=test -e RIDE2GO_TOKEN=test -e METRICS_USER=test -e METRICS_PASSWORD=test -e TZ=Europe/Berlin -v ${pwd()}/data:/app/data" // "--name amarillo -p 8000:80 -e MODULE_NAME=amarillo.app.main -e MAX_WORKERS=1 -e ADMIN_TOKEN=test -e RIDE2GO_TOKEN=test -e METRICS_USER=test -e METRICS_PASSWORD=test -e TZ=Europe/Berlin -v ${pwd()}/data:/app/data"
){ // ){
// TODO: wait until the API is up // // TODO: wait until the API is up
c -> sh script: """ // c -> sh script: """
sleep 15 // sleep 15
echo Testing... // echo Testing...
python -m pytest // python -m pytest
""" // """
} // }
} // }
} // }
} // }
stage('Push image to container registry') { stage('Push image to container registry') {
steps { steps {
echo 'Pushing image to registry' echo 'Pushing image to registry'
@ -46,6 +48,22 @@ pipeline {
} }
} }
} }
stage('Notify CD script') {
steps {
echo 'Triggering deploy webhook'
script {
def body = """
{"secret": "${DEPLOY_SECRET}"}
"""
def response = httpRequest contentType: 'APPLICATION_JSON',
httpMode: 'POST', requestBody: body,
url: "${DEPLOY_WEBHOOK_URL}"
println("Status: ${response.status}")
println("Response: ${response.content}")
}
}
}
} }
post { post {
always { always {