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

Commit

Permalink
add notification to master channel
Browse files Browse the repository at this point in the history
  • Loading branch information
osher cohen committed Sep 2, 2020
1 parent b375f7f commit 12a593b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
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')
MASTER_SLACK_TOKEN = credentials('slack_master_token')
}
agent {
node {
Expand Down Expand Up @@ -41,16 +47,13 @@ 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/$MASTER_SLACK_TOKEN'''
}
}
}
}
}
}

0 comments on commit 12a593b

Please sign in to comment.