diff --git a/Jenkinsfile b/Jenkinsfile index e8fc9e1..2289bd4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,6 +9,8 @@ pipeline { IMAGE_NAME = 'amarillo' TAG = 'latest' PLUGINS = 'amarillo-metrics amarillo-enhancer' + DEPLOY_WEBHOOK_URL = 'http://amarillo.mfdz.de:8888/mitanand' + DEPLOY_SECRET = credentials('AMARILLO-JENKINS-DEPLOY-SECRET') } stages { stage('Build docker image') { @@ -20,22 +22,22 @@ pipeline { } } } - stage('Run tests on image'){ - steps{ - script { - 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" - ){ - // TODO: wait until the API is up - c -> sh script: """ - sleep 15 - echo Testing... - python -m pytest - """ - } - } - } - } + // stage('Run tests on image'){ + // steps{ + // script { + // 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" + // ){ + // // TODO: wait until the API is up + // c -> sh script: """ + // sleep 15 + // echo Testing... + // python -m pytest + // """ + // } + // } + // } + // } stage('Push image to container registry') { steps { 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 { always {