Skip to content

Commit

Permalink
feat: add a flag, --build.incremental, that turns on incremental buil…
Browse files Browse the repository at this point in the history
…ds. (#254)

fixes #253
  • Loading branch information
lholmquist committed Jul 19, 2018
1 parent fcc4d12 commit 68be3dc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ Flag to recreate a BuildConfig or Imagestream. Defaults to false. Choices are "
#### build.forcePull
Flag to make your BuildConfig always pull a new image from dockerhub. Defaults to false

#### build.incremental
Flag to perform incremental builds(if applicable), which means it reuses artifacts from previously-built images. Defaults to false

#### build.env
Flag to pass build config environment variables as NAME=Value. Can be used multiple times. ex: `nodeshift --build.env NODE_ENV=development --build.env YARN_ENABLED=true`

Expand Down Expand Up @@ -224,6 +227,9 @@ Shows the below help
--build.forcePull flag to make your BuildConfig always pull a new image
from dockerhub or not
[boolean] [choices: true, false] [default: false]
--build.incremental flag to perform incremental builds, which means it reuses
artifacts from previously-built images
[boolean] [choices: true, false] [default: false]
--metadata.out determines what should be done with the response
metadata from OpenShift
[string] [choices: "stdout", "ignore", "<filename>"] [default: "ignore"]
Expand Down
6 changes: 6 additions & 0 deletions bin/nodeshift
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ yargs
type: 'boolean',
default: false
})
.options('build.incremental', {
describe: 'flag to perform incremental builds, which means it reuses artifacts from previously-built images',
choices: [true, false],
type: 'boolean',
default: false
})
.array('build.env')
.options('metadata.out', {
describe: 'determines what should be done with the response metadata from OpenShift',
Expand Down
1 change: 1 addition & 0 deletions lib/build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ async function createOrUpdateBuildConfig (config) {
outputImageStreamTag: outputImageStreamTag,
nodeVersion: config.nodeVersion,
forcePull: config.build.forcePull,
incremental: config.build.incremental,
dockerImage: config.dockerImage,
buildEnv: config.build.env
});
Expand Down
1 change: 1 addition & 0 deletions lib/definitions/build-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = (options = {}) => {
kind: 'DockerImage',
name: dockerImageName
},
incremental: options.incremental,
forcePull: options.forcePull
}
};
Expand Down
12 changes: 12 additions & 0 deletions test/definitions-tests/build-strategy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ test('strategy with changed forcePull to false', (t) => {
t.end();
});

test('strategy with changed incremental', (t) => {
const result = buildStrategy({incremental: true});
t.equal(result.sourceStrategy.incremental, true, 'incremental on');
t.end();
});

test('strategy with changed incremental to false', (t) => {
const result = buildStrategy({incremental: false});
t.equal(result.sourceStrategy.incremental, false, 'incremental off');
t.end();
});

test('strategy with change dockerImage', (t) => {
const result = buildStrategy({dockerImage: 'lholmquist/centos7-s2i-nodejs'});

Expand Down

0 comments on commit 68be3dc

Please sign in to comment.