You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69-1Lines changed: 69 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ Third, you need to add the Bitbucket OAuth Consumer credentials. You have two wa
73
73
4. Click **Add** button.
74
74
7. Select the desired credentials.
75
75
76
-
### Configure Jenkins to notify Bitbucket
76
+
### Configure Jenkins to notify Bitbucket from a standard build
77
77
78
78
Once you have configured the credentials, configure jenkins to notify Bitbucket.
79
79
@@ -82,6 +82,74 @@ Once you have configured the credentials, configure jenkins to notify Bitbucket.
82
82
3. Select **Bitbucket notify build status**.
83
83
4. Choose whether you want to notify the build status on Jenkins to Bitbucket.
84
84
85
+
### Pipeline step to notify Bitbucket
86
+
87
+
Once you have configured the credential, you can notify BitBucket from your Pipeline script through the `bitbucketStatusNotify` step.
88
+
89
+
#### Usage
90
+
91
+
The `bitbucketStatusNotify` step notifies the status of a build identified by a build key and build name to BitBucket.
92
+
If `buildKey` and `buildName` parameters are not provided, a standard name will be assigned to the build (NameOfYourJob #numberOfBuild - eg. MyProject #32).
93
+
When a `FAILED` status is sent to BitBucket, `bitbucketStatusNotify` throws an exception terminating your Pipeline.
94
+
95
+
```groovy
96
+
...
97
+
stage 'Build'
98
+
bitbucketStatusNotify(
99
+
buildState: 'INPROGRESS',
100
+
buildKey: 'build',
101
+
buildName: 'Build'
102
+
)
103
+
try {
104
+
myBuildFunction()
105
+
bitbucketStatusNotify(
106
+
buildState: 'SUCCESSFUL',
107
+
buildKey: 'build',
108
+
buildName: 'Build'
109
+
)
110
+
} catch(Exception e) {
111
+
bitbucketStatusNotify(
112
+
buildState: 'FAILED',
113
+
buildKey: 'build',
114
+
buildName: 'Build',
115
+
buildDescription: 'Something went wrong with build!'
116
+
)
117
+
}
118
+
stage 'Test'
119
+
bitbucketStatusNotify(
120
+
buildState: 'INPROGRESS',
121
+
buildKey: 'test',
122
+
buildName: 'Test'
123
+
)
124
+
try {
125
+
myTestFunction()
126
+
bitbucketStatusNotify(
127
+
buildState: 'SUCCESSFUL',
128
+
buildKey: 'test',
129
+
buildName: 'Test'
130
+
)
131
+
} catch(Exception e) {
132
+
bitbucketStatusNotify(
133
+
buildState: 'FAILED',
134
+
buildKey: 'test',
135
+
buildName: 'Test',
136
+
buildDescription: 'Something went wrong with tests!'
137
+
)
138
+
}
139
+
...
140
+
```
141
+
142
+
#### API Summary
143
+
144
+
Parameter:
145
+
146
+
| Name | Type | Optional | Description |
147
+
| --- | --- | --- | --- |
148
+
| `buildState` | `"INPROGRESS"|"SUCCESSFUL"|"FAILED"` | no | The status of the current build phase
149
+
| `buildKey` | String | yes | The unique key identifying the current build phase
150
+
| `buildName` | String | yes | The build phase's name shown on BitBucket
151
+
| `buildDescription` | String | yes | The build phase's description shown on BitBucket
152
+
85
153
## Contributions
86
154
87
155
Contributions are welcome! For feature requests and bug reports please read the following Wiki page for guidelines on [how to submit an issue][how-to-submit-issue].
0 commit comments