diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..9f062cd --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,45 @@ +@Library("cadoles") _ + +pipeline { + agent { + dockerfile { + label 'docker' + filename 'Dockerfile' + dir 'misc/ci' + } + } + + triggers { + cron('0 10 * * 1-5') + cron('0 16 * * 1-5') + } + + parameters { + booleanParam(name: 'FORCE_SEND', defaultValue: false, description: 'Force send of message') + } + + stages { + stage("Send call to action") { + when { + allOf { + anyOf { + triggeredBy 'TimerTrigger' + expression { params.FORCE_SEND == true } + } + } + } + steps { + script { + String callToAction = sh(script: "curl https://kouiz.dev.lookingfora.name/api/presentation/turn", returnStdout: true) + if (callToAction) { + rocketSend( + channel: '#le-kouiz', + message: newsletter, + rawMessage: true + ) + } + } + } + } + } +} \ No newline at end of file diff --git a/misc/ci/Dockerfile b/misc/ci/Dockerfile new file mode 100644 index 0000000..3d2f266 --- /dev/null +++ b/misc/ci/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.21 + +RUN apk add nodejs npm jq bash curl ca-certificates python3 build-base coreutils + +SHELL ["/bin/bash"] \ No newline at end of file