Skip to content

Commit

Permalink
Merge 7cbe89e into 327270b
Browse files Browse the repository at this point in the history
  • Loading branch information
lance committed Jun 29, 2017
2 parents 327270b + 7cbe89e commit d3e6478
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
9 changes: 9 additions & 0 deletions bin/nodeshift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ yargs
.options('osc.strictSSL', {
describe: 'setting to pass to the Openshift Rest Client. Set to false if using a self-sign cert'
})
.options('nodeVersion', {
describe: 'the version of Node.js to use for the deployed application.',
alias: 'n',
type: 'string',
choices: ['latest', '8.x', '7.x', '6.x', '5.x', '4.x'],
default: 'latest',

})
.help();

const argv = yargs.argv;
Expand All @@ -35,6 +43,7 @@ const options = {};
options.projectLocation = argv.projectLocation;
options.configLocation = argv.configLocation;
options.nodeshiftDirectory = argv.nodeshiftDirectory;
options.nodeVersion = argv.nodeVersion;

if (argv.osc) {
options.osc = {
Expand Down
7 changes: 5 additions & 2 deletions lib/build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ function createOrUpdateBuildConfig (config) {
if (buildConfig.code === 404) {
// Need to create the build config
console.log(`Creating Build Config ${buildName} for Source build`);
const newBuildConfig = createBuildConfig(config, {outputImageStreamTag: outputImageStreamTag});
const newBuildConfig = createBuildConfig(config, {
outputImageStreamTag: outputImageStreamTag,
nodeVersion: config.nodeVersion
});
return config.openshiftRestClient.buildconfigs.create(newBuildConfig);
}

console.log(`Using Build Config ${buildName} for Source strategy`);
console.log(`Using Build Config ${buildName} for Source strategy`);
// TODO: be able to update the buildconfig
return buildConfig;
});
Expand Down
3 changes: 2 additions & 1 deletion lib/definitions/build-config-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ function createBuildConfigSpec (options) {
options = options || {};
const buildConfigSpec = baseBuildConfigSpec;
buildConfigSpec.source = buildSource('Binary');
buildConfigSpec.strategy = buildStrategy();
buildConfigSpec.strategy = buildStrategy(options);
buildConfigSpec.output = buildOutput(options.outputImageStreamTag);
console.log('BuildConfigSpec', buildConfigSpec);
return buildConfigSpec;
}

Expand Down
7 changes: 5 additions & 2 deletions lib/definitions/build-strategy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
'use strict';

// Perhaps we should define this in another location
const dockerImageName = 'bucharestgold/centos7-s2i-nodejs:latest';
const dockerImage = 'bucharestgold/centos7-s2i-nodejs';
const dockerTag = 'latest';

// https://docs.openshift.com/online/rest_api/openshift_v1.html#v1-buildstrategy
module.exports = () => {
module.exports = (options) => {
// Just doing the source strategy
const dockerImageName = `${dockerImage}:${options.nodeVersion ? options.nodeVersion : dockerTag}`;
console.log('Using docker image', dockerImageName);
return {
type: 'Source',
sourceStrategy: {
Expand Down

0 comments on commit d3e6478

Please sign in to comment.