Skip to content

Commit f41de37

Browse files
lukebargehenrybell
andauthored
Fix unset deploy parameters (#55)
<!-- Thank you for proposing a pull request! Please note that SOME TESTS WILL LIKELY FAIL due to how GitHub exposes secrets in Pull Requests from forks. Someone from the team will review your Pull Request and respond. Please describe your change and any implementation details below. --> Check `--deploy-parameters` object is empty Fix #54 --------- Co-authored-by: henrybell <[email protected]>
1 parent fd4cd11 commit f41de37

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export async function run(): Promise<void> {
147147
if (skaffoldFile) {
148148
cmd.push('--skaffold-file', skaffoldFile);
149149
}
150-
if (deployParameters) {
150+
if (deployParameters && Object.keys(deployParameters).length > 0) {
151151
cmd.push('--deploy-parameters', joinKVString(deployParameters));
152152
}
153153

tests/unit/main.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,16 @@ test('#run', { concurrency: true }, async (suite) => {
362362
]);
363363
});
364364

365+
await suite.test('does not set deploy parameters if not given', async (t) => {
366+
const mocks = defaultMocks(t.mock);
367+
368+
await run();
369+
370+
const execArguments = mocks.getExecOutput.mock.calls?.at(0)?.arguments?.at(1);
371+
assert(execArguments);
372+
assert(!execArguments?.includes('--deploy-parameters'));
373+
});
374+
365375
await suite.test('sets flags if given', async (t) => {
366376
const mocks = defaultMocks(t.mock, {
367377
flags: '--flag1=value1 --flag2=value2',

0 commit comments

Comments
 (0)