@@ -165,31 +165,33 @@ public function execute()
165
165
$ this ->build ->sendStatusPostback ();
166
166
$ this ->success = true ;
167
167
168
- try {
169
- // Set up the build:
170
- $ this ->setupBuild ();
168
+ // Set up the build:
169
+ $ this ->setupBuild ();
171
170
172
- // Run the core plugin stages:
173
- foreach (array ('setup ' , 'test ' , ' complete ' ) as $ stage ) {
174
- $ this ->success &= $ this ->pluginExecutor ->executePlugins ($ this ->config , $ stage );
175
- }
171
+ // Run the core plugin stages:
172
+ foreach (array ('setup ' , 'test ' ) as $ stage ) {
173
+ $ this ->success &= $ this ->pluginExecutor ->executePlugins ($ this ->config , $ stage );
174
+ }
176
175
177
- // Failed build? Execute failure plugins and then mark the build as failed.
178
- if (!$ this ->success ) {
179
- $ this ->pluginExecutor ->executePlugins ($ this ->config , 'failure ' );
180
- throw new \Exception ('BUILD FAILED! ' );
181
- }
176
+ // Set the status so this can be used by complete, success and failure
177
+ // stages.
178
+ if ($ this ->success ) {
179
+ $ this ->build ->setStatus (Build::STATUS_SUCCESS );
180
+ }
181
+ else {
182
+ $ this ->build ->setStatus (Build::STATUS_FAILED );
183
+ }
182
184
183
- // If we got this far, the build was successful!
184
- if ($ this ->success ) {
185
- $ this ->build ->setStatus (Build::STATUS_SUCCESS );
186
- $ this ->pluginExecutor ->executePlugins ($ this ->config , 'success ' );
187
- $ this ->logSuccess ('BUILD SUCCESSFUL! ' );
188
- }
185
+ // Complete stage plugins are always run
186
+ $ this ->pluginExecutor ->executePlugins ($ this ->config , 'complete ' );
189
187
190
- } catch (\Exception $ ex ) {
191
- $ this ->logFailure ($ ex ->getMessage (), $ ex );
192
- $ this ->build ->setStatus (Build::STATUS_FAILED );
188
+ if ($ this ->success ) {
189
+ $ this ->pluginExecutor ->executePlugins ($ this ->config , 'success ' );
190
+ $ this ->logSuccess ('BUILD SUCCESSFUL! ' );
191
+ }
192
+ else {
193
+ $ this ->pluginExecutor ->executePlugins ($ this ->config , 'failure ' );
194
+ $ this ->logFailure ("BUILD FAILURE " );
193
195
}
194
196
195
197
// Clean up:
0 commit comments