diff --git a/Jenkinsfile b/Jenkinsfile index 3a39e94..7d673b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,11 @@ +String cron_string = BRANCH_NAME == "master" ? "@daily" : "" + pipeline { + options { timeout(time: 1, unit: 'HOURS') } + triggers { cron(cron_string) } environment { GENERATOR = 'quay.io/ocpmetal/assisted-ignition-generator' + SLACK_TOKEN = credentials('slack-token') } agent { node { @@ -41,14 +46,11 @@ pipeline { script { if (env.BRANCH_NAME == 'master') stage('notify master branch fail') { - withCredentials([string(credentialsId: 'slack-token', variable: 'TOKEN')]) { script { def data = [text: "Attention! assisted-ignition-generator branch test failed, see: ${BUILD_URL}"] writeJSON(file: 'data.txt', json: data, pretty: 4) } - sh '''curl -X POST -H 'Content-type: application/json' --data-binary "@data.txt" https://hooks.slack.com/services/$TOKEN''' - - } + sh '''curl -X POST -H 'Content-type: application/json' --data-binary "@data.txt" https://hooks.slack.com/services/${SLACK_TOKEN}''' } } }