screwdriver-api 4.1.216 → 4.1.217

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": "4.1.216",
3
+ "version": "4.1.217",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,6 +4,7 @@ const logger = require('screwdriver-logger');
4
4
  const workflowParser = require('screwdriver-workflow-parser');
5
5
  const merge = require('lodash.mergewith');
6
6
  const schema = require('screwdriver-data-schema');
7
+ const hoek = require('@hapi/hoek');
7
8
  const getRoute = require('./get');
8
9
  const getBuildStatusesRoute = require('./getBuildStatuses');
9
10
  const updateRoute = require('./update');
@@ -719,10 +720,12 @@ const buildsPlugin = {
719
720
  if (!isExternal) {
720
721
  buildConfig.eventId = event.id;
721
722
  } else {
722
- buildConfig.eventId = pipelineJoinData[pid].event.id;
723
+ buildConfig.eventId = hoek.reach(pipelineJoinData[pid], 'event.id');
723
724
  }
724
725
 
725
- deletePromises.push(deleteBuild(buildConfig, buildFactory));
726
+ if (buildConfig.eventId) {
727
+ deletePromises.push(deleteBuild(buildConfig, buildFactory));
728
+ }
726
729
  } catch (err) {
727
730
  logger.error(
728
731
  `Error in removeJoinBuilds:${nextJobName} from pipeline:${current.pipeline.id}-${current.job.name}-event:${current.event.id} `,