screwdriver-api 8.0.135 → 8.0.137

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.135",
3
+ "version": "8.0.137",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -76,20 +76,20 @@ async function createEvent(config, server) {
76
76
  const event = await eventFactory.create(config);
77
77
 
78
78
  if (event.builds) {
79
- const jobIds = event.builds.map(b => b.jobId);
80
-
79
+ // Virtual builds are just CREATED. Not started(QUEUED, RUNNNING, ...).
80
+ const createdBuilds = event.builds.filter(b => b.status === 'CREATED');
81
+ const jobIds = createdBuilds.map(b => b.jobId);
81
82
  const virtualNodeNames = getVirtualJobNames(event.workflowGraph);
82
83
 
83
- if (virtualNodeNames.length > 0) {
84
- const prJobs = await jobFactory.list({
84
+ if (createdBuilds.length > 0 && virtualNodeNames.length > 0) {
85
+ const jobs = await jobFactory.list({
85
86
  params: {
86
87
  id: jobIds
87
88
  }
88
89
  });
89
90
 
90
- const virtualJobIds = getVirtualJobIds(virtualNodeNames, prJobs);
91
-
92
- const virtualJobBuilds = event.builds.filter(b => virtualJobIds.includes(b.jobId));
91
+ const virtualJobIds = getVirtualJobIds(virtualNodeNames, jobs);
92
+ const virtualJobBuilds = createdBuilds.filter(b => virtualJobIds.includes(b.jobId));
93
93
 
94
94
  for (const build of virtualJobBuilds) {
95
95
  await updateBuildAndTriggerDownstreamJobs(