Skip to content

Commit 9cffb3d

Browse files
CR-4248 (#647)
* bump * for cr * after cr * for approval * without resolveDemoStepImage function * without resolveDemoStepImage function * fixed parameter
1 parent 97ec4ee commit 9cffb3d

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

lib/interface/cli/commands/hybrid/helper.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ const RUNTIME_IMAGES = {
5151
PIPELINE_DEBUGGER_IMAGE: 'codefresh/cf-debugger:1.1.2',
5252
};
5353

54+
const DEMO_STEP_IMAGE = {
55+
'docker.io': 'alpine:latest',
56+
'quay.io': 'quay.io/codefresh/alpine:3.11',
57+
'gcr.io': 'gcr.io/google-containers/alpine-with-bash',
58+
default: 'quay.io/codefresh/alpine:3.11'
59+
}
60+
5461
const maxRuntimeNameLength = 63;
5562
const DefaultLogFormatter = 'plain';
5663

@@ -86,7 +93,7 @@ async function getTestPipelineLink(pipelineName, pipeline) {
8693
return '';
8794
}
8895

89-
async function createTestPipeline(runtimeName, pipelineName, pipelineCommands) {
96+
async function createTestPipeline(runtimeName, pipelineName, pipelineCommands, dockerRegistry) {
9097
await _createRunnerProjectIfNotExists();
9198
console.log(`Creating test pipeline with the name: "${colors.cyan(pipelineName)}" ` +
9299
`in project "${colors.cyan(INSTALLATION_DEFAULTS.PROJECT_NAME)}"`);
@@ -95,12 +102,15 @@ async function createTestPipeline(runtimeName, pipelineName, pipelineCommands) {
95102
pipeline.spec.runtimeEnvironment = {
96103
name: runtimeName,
97104
};
105+
106+
const demoStepImage = DEMO_STEP_IMAGE[dockerRegistry] || DEMO_STEP_IMAGE.default;
107+
98108
pipeline.spec.steps = {};
99109
pipeline.spec.stages = ['test'];
100110
pipeline.spec.steps.test = {
101111
stage: 'test',
102112
title: 'test',
103-
image: 'alpine:latest',
113+
image: demoStepImage,
104114
commands: pipelineCommands || ['echo hello Codefresh Runner!'],
105115
};
106116

@@ -130,11 +140,10 @@ async function getTestPipeline(pipelineName) {
130140
return pipeline;
131141
}
132142

133-
134143
return null;
135144
}
136145

137-
async function updateTestPipelineRuntime(pipeline, runtimeName, pipelineName) {
146+
async function updateTestPipelineRuntime(pipeline, runtimeName, pipelineName, dockerRegistry) {
138147
let _pipeline = pipeline;
139148
if (!_pipeline) {
140149
const testPipeline = await getTestPipeline(pipelineName);
@@ -147,6 +156,10 @@ async function updateTestPipelineRuntime(pipeline, runtimeName, pipelineName) {
147156
name: runtimeName,
148157
};
149158

159+
let demoStepImage = DEMO_STEP_IMAGE[dockerRegistry] || DEMO_STEP_IMAGE.default;
160+
161+
_pipeline.spec.steps.test.image = demoStepImage;
162+
150163
await sdk.pipelines.replace(
151164
{ name: _pipeline.metadata.name },
152165
{

lib/interface/cli/commands/hybrid/init.cmd.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,18 +843,20 @@ const initCmd = new Command({
843843
installationPlan.getContext('runtimeName'),
844844
INSTALLATION_DEFAULTS.DEMO_PIPELINE_NAME,
845845
['echo hello Codefresh Runner!'],
846+
dockerRegistry
846847
);
847848
},
848849
installationEvent: installationProgress.events.PIPELINE_CREATED,
849850
});
850851
} else {
851-
installationPlan.addStep({
852+
installationPlan.addStep({
852853
name: 'update test pipeline runtime',
853854
func: async () => {
854-
await updateTestPipelineRuntime(
855+
await updateTestPipelineRuntime(
855856
undefined,
856857
installationPlan.getContext('runtimeName'),
857858
INSTALLATION_DEFAULTS.DEMO_PIPELINE_NAME,
859+
dockerRegistry
858860
);
859861
},
860862
errMessage: colors.yellow('*warning* could not update test pipeline runtime, you can' +

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.75.10",
3+
"version": "0.75.11",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)