Skip to content

Commit

Permalink
Merge pull request #155 from screwdriver-cd/alwaysrun
Browse files Browse the repository at this point in the history
feat(473): Add alwaysRun flag to steps in builds
  • Loading branch information
minzcmu authored Apr 21, 2017
2 parents e1cb44b + e8e7d87 commit 85d7bf2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions lib/buildFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class BuildFactory extends BaseFactory {
modelConfig.environment = permutation.environment;
modelConfig.steps = permutation.commands.map(command => ({
name: command.name,
command: command.command
command: command.command,
alwaysRun: command.alwaysRun || false
}));

const bookendConfig = { pipeline, job, build: modelConfig };
Expand All @@ -168,7 +169,7 @@ class BuildFactory extends BaseFactory {
]).then(([setup, teardown]) => {
modelConfig.steps = setup.concat(modelConfig.steps, teardown);
// Launcher is hardcoded to do some business in sd-setup-launcher
modelConfig.steps.unshift({ name: 'sd-setup-launcher' });
modelConfig.steps.unshift({ name: 'sd-setup-launcher', alwaysRun: true });

return super.create(modelConfig);
});
Expand Down
20 changes: 10 additions & 10 deletions test/lib/buildFactory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,30 +134,30 @@ describe('Build Factory', () => {
const isoTime = (new Date(dateNow)).toISOString();
const container = 'node:4';
const steps = [
{ name: 'sd-setup-launcher' },
{ name: 'sd-setup-scm', command: 'git clone' },
{ command: 'npm install', name: 'init' },
{ command: 'npm test', name: 'test' }
{ name: 'sd-setup-launcher', alwaysRun: true },
{ name: 'sd-setup-scm', command: 'git clone', alwaysRun: true },
{ command: 'npm install', name: 'init', alwaysRun: false },
{ command: 'npm test', name: 'test', alwaysRun: false }
];
const environment = { NODE_ENV: 'test', NODE_VERSION: '4' };
const permutations = [{
commands: [
{ command: 'npm install', name: 'init' },
{ command: 'npm test', name: 'test' }
{ command: 'npm install', name: 'init', alwaysRun: false },
{ command: 'npm test', name: 'test', alwaysRun: false }
],
environment: { NODE_ENV: 'test', NODE_VERSION: '4' },
image: 'node:4'
}, {
commands: [
{ command: 'npm install', name: 'init' },
{ command: 'npm test', name: 'test' }
{ command: 'npm install', name: 'init', alwaysRun: false },
{ command: 'npm test', name: 'test', alwaysRun: false }
],
environment: { NODE_ENV: 'test', NODE_VERSION: '5' },
image: 'node:5'
}, {
commands: [
{ command: 'npm install', name: 'init' },
{ command: 'npm test', name: 'test' }
{ command: 'npm install', name: 'init', alwaysRun: false },
{ command: 'npm test', name: 'test', alwaysRun: false }
],
environment: { NODE_ENV: 'test', NODE_VERSION: '6' },
image: 'node:6'
Expand Down

0 comments on commit 85d7bf2

Please sign in to comment.