Skip to content

Commit 9da53b5

Browse files
fix app proxy bypass bug (#657)
1 parent 4bb35b9 commit 9da53b5

File tree

6 files changed

+46
-18
lines changed

6 files changed

+46
-18
lines changed

lib/interface/cli/commands/app-proxy/install.cmd.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ const installAppProxyHandler = new Command({
9292
.option('ingress-class', {
9393
describe: 'the ingress class that will be used by the app-proxy ingress',
9494
type: 'string',
95+
})
96+
.option('bypass-download', {
97+
describe: 'Will bypass the attempt to download the installer. Instead, will immediately attempt to'
98+
+ ' use the binary from the components folder',
99+
default: false,
100+
type: 'boolean',
95101
}),
96102

97103
handler: async (_argv) => {
@@ -104,6 +110,7 @@ const installAppProxyHandler = new Command({
104110
'set-value': setValues,
105111
'ingress-class': ingressClass,
106112
noExit,
113+
'bypass-download': bypassDownload,
107114
} = argv;
108115
let {
109116
host,
@@ -164,6 +171,7 @@ const installAppProxyHandler = new Command({
164171
kubeContextName,
165172
kubeNamespace,
166173
dockerRegistry,
174+
bypassDownload,
167175
valuesFile: values,
168176
setValue: setValues,
169177
verbose,

lib/interface/cli/commands/app-proxy/uninstall.cmd.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ const uninstallAppProxyHandler = new Command({
7777
})
7878
.option('verbose', {
7979
describe: 'Print logs',
80+
})
81+
.option('bypass-download', {
82+
describe: 'Will bypass the attempt to download the installer. Instead, will immediately attempt to'
83+
+ ' use the binary from the components folder',
84+
default: false,
85+
type: 'boolean',
8086
}),
8187
handler: async (_argv) => {
8288
const argv = mergeWithValues(_argv);
@@ -87,6 +93,7 @@ const uninstallAppProxyHandler = new Command({
8793
values,
8894
'set-value': setValues,
8995
noExit,
96+
'bypass-download': bypassDownload,
9097
} = argv;
9198
let {
9299
'kube-namespace': kubeNamespace,
@@ -145,7 +152,7 @@ const uninstallAppProxyHandler = new Command({
145152
verbose,
146153
valuesFile: values,
147154
setValue: setValues,
148-
155+
bypassDownload,
149156
}));
150157
await handleError(uninstallErr, 'Failed to uninstall app-proxy');
151158

lib/interface/cli/commands/app-proxy/upgrade.cmd.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ const upgradeAppProxyHandler = new Command({
5050
})
5151
.option('verbose', {
5252
describe: 'Print logs',
53+
})
54+
.option('bypass-download', {
55+
describe: 'Will bypass the attempt to download the installer. Instead, will immediately attempt to'
56+
+ ' use the binary from the components folder',
57+
default: false,
58+
type: 'boolean',
5359
}),
5460
handler: async (_argv) => {
5561
const argv = mergeWithValues(_argv);
@@ -59,6 +65,7 @@ const upgradeAppProxyHandler = new Command({
5965
values,
6066
'set-value': setValues,
6167
noExit,
68+
'bypass-download': bypassDownload,
6269
} = argv;
6370
let {
6471
'kube-namespace': kubeNamespace,
@@ -87,6 +94,7 @@ const upgradeAppProxyHandler = new Command({
8794
verbose,
8895
valuesFile: values,
8996
setValue: setValues,
97+
bypassDownload,
9098
}));
9199
handleError(upgradeErr, 'Failed to upgrade app-proxy');
92100

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ const DEMO_STEP_IMAGE = {
5555
'docker.io': 'alpine:latest',
5656
'quay.io': 'quay.io/codefresh/alpine:3.11',
5757
'gcr.io': 'gcr.io/google-containers/alpine-with-bash',
58-
default: 'quay.io/codefresh/alpine:3.11'
59-
}
58+
default: 'quay.io/codefresh/alpine:3.11',
59+
};
6060

6161
const maxRuntimeNameLength = 63;
6262
const DefaultLogFormatter = 'plain';
@@ -156,10 +156,10 @@ async function updateTestPipelineRuntime(pipeline, runtimeName, pipelineName, do
156156
name: runtimeName,
157157
};
158158

159-
let demoStepImage = DEMO_STEP_IMAGE[dockerRegistry] || DEMO_STEP_IMAGE.default;
159+
const demoStepImage = DEMO_STEP_IMAGE[dockerRegistry] || DEMO_STEP_IMAGE.default;
160160

161161
_pipeline.spec.steps.test.image = demoStepImage;
162-
162+
163163
await sdk.pipelines.replace(
164164
{ name: _pipeline.metadata.name },
165165
{
@@ -375,11 +375,11 @@ async function attemptDownload(location, component) {
375375
return await to(downloader.download(component));
376376
}
377377

378-
async function downloadVeonona(location = CODEFRESH_PATH, bypassDownload = false) {
378+
async function downloadVeonona(location = CODEFRESH_PATH, bypassDownload = false) {
379379
if (await bypassDownloadSuccess(bypassDownload, components.venona.local.dir, components.venona.local.binary)) {
380380
return path.resolve(process.cwd(), INSTALLATION_DEFAULTS.COMPONENTS_FOLDER);
381381
}
382-
382+
383383
const [error] = await attemptDownload(location, components.venona);
384384
if (error) {
385385
if (await bypassDownloadSuccess(!bypassDownload, components.venona.local.dir, components.venona.local.binary)) {
@@ -395,7 +395,7 @@ async function downloadVeonona(location = CODEFRESH_PATH, bypassDownload = false
395395

396396
async function downloadProvider({ provider, location = CODEFRESH_PATH }, bypassDownload = false) {
397397
const localSettings = components.gitops[provider].local;
398-
398+
399399
if (await bypassDownloadSuccess(bypassDownload, localSettings.dir, localSettings.binary)) {
400400
return path.resolve(process.cwd(), INSTALLATION_DEFAULTS.COMPONENTS_FOLDER);
401401
}
@@ -429,7 +429,7 @@ async function downloadSteveDore(location = CODEFRESH_PATH, bypassDownload = fal
429429
return location;
430430
}
431431

432-
async function downloadHybridComponents(location, bypassDownload = false) {
432+
async function downloadHybridComponents(location, bypassDownload = false) {
433433
await downloadVeonona(location, bypassDownload);
434434
console.log(`Kubernetes components installer downloaded successfully to ${location} `);
435435
await downloadSteveDore(location, bypassDownload);
@@ -494,7 +494,7 @@ async function runClusterAcceptanceTests({
494494
await componentRunner.run(components.venona, cmd);
495495
}
496496

497-
async function runUpgrade({ kubeNamespace, kubeContextName }) {
497+
async function runUpgrade({ kubeNamespace, kubeContextName, bypassDownload }) {
498498
const binLocation = await downloadVeonona(undefined, bypassDownload);
499499
const componentRunner = new Runner(binLocation);
500500
const cmd = ['upgrade', '--log-formtter', DefaultLogFormatter];
@@ -531,7 +531,7 @@ async function installAgent({
531531
setValue, // --set-value
532532
setFile, // --set-file
533533
}) {
534-
const binLocation = await downloadVeonona(undefined, bypassDownload);
534+
const binLocation = await downloadVeonona(undefined, bypassDownload);
535535
const componentRunner = new Runner(binLocation);
536536
const cmd = [
537537
'install',
@@ -695,6 +695,7 @@ async function installAppProxy({
695695
verbose, // --verbose
696696
dockerRegistry, // --docker-registry
697697
logFormatting = DefaultLogFormatter, // --log-formtter
698+
bypassDownload, // --bypass-download
698699
valuesFile, // --values
699700
setValue, // --set-value
700701
setFile, // --set-file
@@ -771,6 +772,7 @@ async function unInstallAppProxy({
771772
kubeNamespace, // --kube-namespace
772773
kubeConfigPath, // --kube-config-path
773774
verbose, // --verbose
775+
bypassDownload, // --bypass-download
774776
logFormatting = DefaultLogFormatter, // --log-formtter
775777
valuesFile, // --values
776778
setValue, // --set-value
@@ -812,6 +814,7 @@ async function upgradeAppProxy({
812814
kubeNamespace, // --kube-namespace
813815
kubeConfigPath, // --kube-config-path
814816
verbose, // --verbose
817+
bypassDownload, // --bypass-download
815818
logFormatting = DefaultLogFormatter, // --log-formtter
816819
valuesFile, // --values
817820
setValue, // --set-value
@@ -971,6 +974,7 @@ async function newAgentName(kubeContextName, kubeNamespace, agents) {
971974

972975
return name;
973976
}
977+
974978
function keyValueAsStringToObject(nodeSelectorStr) {
975979
if (nodeSelectorStr) {
976980
const kubeNodeSelectorObj = {};

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ const initCmd = new Command({
219219
describe: 'Will save all of the manifests to be deployed on the cluster to: ./manifests/',
220220
default: false,
221221
type: 'boolean',
222-
})
222+
})
223223
.option('bypass-download', {
224224
describe: 'Will bypass the attempt to download the installer. Instead, will immediately attempt to use the binary from the components folder',
225225
default: false,
@@ -284,7 +284,7 @@ const initCmd = new Command({
284284
userVolumeMounts,
285285
userVolumes,
286286
'dry-run': dryRun,
287-
'bypass-download': bypassDownload
287+
'bypass-download': bypassDownload,
288288
} = _argv;
289289

290290
const shouldUseHelm = !!helmValuesFile;
@@ -747,6 +747,7 @@ const initCmd = new Command({
747747
valuesFile,
748748
setValue,
749749
setFile,
750+
bypassDownload,
750751
appProxyHost,
751752
appProxyIngressClass,
752753
dryRun,
@@ -924,20 +925,20 @@ const initCmd = new Command({
924925
installationPlan.getContext('runtimeName'),
925926
INSTALLATION_DEFAULTS.DEMO_PIPELINE_NAME,
926927
['echo hello Codefresh Runner!'],
927-
dockerRegistry
928+
dockerRegistry,
928929
);
929930
},
930931
installationEvent: installationProgress.events.PIPELINE_CREATED,
931932
});
932933
} else {
933-
installationPlan.addStep({
934+
installationPlan.addStep({
934935
name: 'update test pipeline runtime',
935936
func: async () => {
936-
await updateTestPipelineRuntime(
937+
await updateTestPipelineRuntime(
937938
undefined,
938939
installationPlan.getContext('runtimeName'),
939940
INSTALLATION_DEFAULTS.DEMO_PIPELINE_NAME,
940-
dockerRegistry
941+
dockerRegistry,
941942
);
942943
},
943944
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.15",
3+
"version": "0.75.16",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)