-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(3143): skip jobs between stage setup and startFrom stage job only…
… if they belong to the same stage (#3166)
- Loading branch information
1 parent
c0560d6
commit c3888a7
Showing
4 changed files
with
95 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1628,7 +1628,7 @@ describe('build plugin test', () => { | |
}); | ||
}); | ||
|
||
it('triggers the startFrom job after the stage setup job if the startFrom job is a non-setup stage job', () => { | ||
it('triggers the startFrom job after the stage setup job if the startFrom job is a non-setup job in the same stage', () => { | ||
const status = 'SUCCESS'; | ||
const options = { | ||
method: 'PUT', | ||
|
@@ -1703,6 +1703,81 @@ describe('build plugin test', () => { | |
}); | ||
}); | ||
|
||
it('triggers the startFrom job after the stage setup job if the startFrom job is a non-setup job in a different stage', () => { | ||
const status = 'SUCCESS'; | ||
const options = { | ||
method: 'PUT', | ||
url: `/builds/${id}`, | ||
auth: { | ||
credentials: { | ||
username: id, | ||
scope: ['build'] | ||
}, | ||
strategy: ['token'] | ||
}, | ||
payload: { | ||
status | ||
} | ||
}; | ||
|
||
jobMock = { | ||
id: 1234, | ||
name: 'stage@alpha:setup', | ||
pipelineId, | ||
permutations: [ | ||
{ | ||
settings: { | ||
email: '[email protected]' | ||
} | ||
} | ||
], | ||
pipeline: sinon.stub().resolves(pipelineMock)(), | ||
getLatestBuild: sinon.stub().resolves(buildMock) | ||
}; | ||
buildMock.job = sinon.stub().resolves(jobMock)(); | ||
buildMock.parentBuilds = { | ||
123: { eventId: '8888', jobs: { '~commit': 7777, C: 7778, D: 7779 } } | ||
}; | ||
eventMock.getBuilds.resolves([ | ||
{ | ||
id: 1, | ||
eventId: '8888', | ||
jobId: 1, | ||
status: 'FAILURE' | ||
}, | ||
{ | ||
id: 7777, | ||
eventId: '8888', | ||
jobId: 4, | ||
status: 'SUCCESS' | ||
}, | ||
{ | ||
id: 7778, | ||
eventId: '8888', | ||
jobId: 5, | ||
status: 'SUCCESS' | ||
}, | ||
{ | ||
id: 7779, | ||
eventId: '8888', | ||
jobId: 6, | ||
status: 'SUCCESS' | ||
} | ||
]); | ||
|
||
eventMock.workflowGraph = testWorkflowGraphWithStages; | ||
eventMock.startFrom = 'beta-certify'; | ||
eventFactoryMock.get.resolves(eventMock); | ||
|
||
return server.inject(options).then(reply => { | ||
assert.equal(reply.statusCode, 200); | ||
assert.calledWith(jobFactoryMock.get, { | ||
name: 'alpha-deploy', | ||
pipelineId | ||
}); | ||
}); | ||
}); | ||
|
||
it('triggers next job in the stage workflow if current is successful stage teardown and stageBuild is success', () => { | ||
const stageBuildMock = { | ||
id: 1, | ||
|