@@ -24,6 +24,18 @@ anchors:
24
24
docker-hub-task-params : &docker-hub-task-params
25
25
DOCKER_HUB_USERNAME : ((docker-hub-username))
26
26
DOCKER_HUB_PASSWORD : ((docker-hub-password))
27
+ slack-fail-params : &slack-fail-params
28
+ text : >
29
+ :concourse-failed: <!here> <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!>
30
+ silent : true
31
+ icon_emoji : " :concourse:"
32
+ username : concourse-ci
33
+ slack-success-params : &slack-success-params
34
+ text : >
35
+ :concourse-succeeded: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} was successful!>
36
+ silent : true
37
+ icon_emoji : " :concourse:"
38
+ username : concourse-ci
27
39
resource_types :
28
40
- name : artifactory-resource
29
41
type : registry-image
@@ -34,6 +46,11 @@ resource_types:
34
46
type : registry-image
35
47
source :
36
48
repository : teliaoss/github-pr-resource
49
+ - name : slack-notification
50
+ type : registry-image
51
+ source :
52
+ repository : cfcommunity/slack-notification-resource
53
+ tag : latest
37
54
resources :
38
55
- name : git-repo
39
56
type : git
@@ -88,6 +105,11 @@ resources:
88
105
username : ((artifactory-username))
89
106
password : ((artifactory-password))
90
107
build_name : ((build-name))
108
+ - name : slack-alert
109
+ type : slack-notification
110
+ icon : slack
111
+ source :
112
+ url : ((slack-webhook-url))
91
113
jobs :
92
114
- name : build-ci-images
93
115
plan :
@@ -111,19 +133,33 @@ jobs:
111
133
- get : ci-image
112
134
- get : git-repo
113
135
trigger : true
114
- - task : build-project
115
- image : ci-image
116
- privileged : true
117
- timeout : ((task-timeout))
118
- file : git-repo/ci/tasks/build-project.yml
119
- params :
120
- << : *docker-hub-task-params
121
- BRANCH : ((branch))
136
+ - do :
137
+ - task : build-project
138
+ image : ci-image
139
+ privileged : true
140
+ timeout : ((task-timeout))
141
+ file : git-repo/ci/tasks/build-project.yml
142
+ params :
143
+ << : *docker-hub-task-params
144
+ BRANCH : ((branch))
145
+ on_failure :
146
+ do :
147
+ - put : slack-alert
148
+ params :
149
+ << : *slack-fail-params
122
150
- put : artifactory-repo
123
151
params :
124
152
<< : *artifactory-repo-put-params
125
153
get_params :
126
154
threads : 8
155
+ on_failure :
156
+ do :
157
+ - put : slack-alert
158
+ params :
159
+ << : *slack-fail-params
160
+ - put : slack-alert
161
+ params :
162
+ << : *slack-success-params
127
163
- name : build-pull-requests
128
164
serial : true
129
165
public : true
0 commit comments