screwdriver-api 8.0.202 → 8.0.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "8.0.202",
3
+ "version": "8.0.204",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -161,7 +161,15 @@ module.exports = () => ({
161
161
 
162
162
  // Apply state change and return early
163
163
  applyStateChange(oldPipeline, state, username, stateChangeMessage);
164
- const updatedPipeline = await oldPipeline.update();
164
+ let updatedPipeline;
165
+
166
+ // Screwdriver admins may not have valid pipeline-admin SCM credentials,
167
+ // so persist the state change without accessing SCM.
168
+ if (isScrewdriverAdmin) {
169
+ updatedPipeline = await (state === 'ACTIVE' ? oldPipeline.enable() : oldPipeline.disable());
170
+ } else {
171
+ updatedPipeline = await oldPipeline.update();
172
+ }
165
173
 
166
174
  return h.response(updatedPipeline.toJson()).code(200);
167
175
  }
@@ -200,7 +208,7 @@ module.exports = () => ({
200
208
  }
201
209
 
202
210
  applyStateChange(oldPipeline, state, username, stateChangeMessage);
203
- const updatedPipeline = await oldPipeline.update();
211
+ const updatedPipeline = await (state === 'ACTIVE' ? oldPipeline.enable() : oldPipeline.disable());
204
212
 
205
213
  return h.response(updatedPipeline.toJson()).code(200);
206
214
  }