Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.

Commit

Permalink
Add timeout & daily timing
Browse files Browse the repository at this point in the history
  • Loading branch information
osher cohen committed Sep 3, 2020
1 parent b375f7f commit 15a6789
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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'''

}
}
}
}
Expand Down

0 comments on commit 15a6789

Please sign in to comment.