Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ inputs:
default: 'false'
required: false

wait:
description: |-
If true, the action will wait for the job to complete before exiting. This
option only applies to jobs.
default: 'true'
required: false

revision_traffic:
description: |-
Comma-separated list of revision traffic assignments.
Expand Down
5 changes: 5 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export async function run(): Promise<void> {
const tag = getInput('tag');
const timeout = getInput('timeout');
const noTraffic = (getInput('no_traffic') || '').toLowerCase() === 'true';
const wait = parseBoolean(getInput('wait'));
const revTraffic = getInput('revision_traffic');
const tagTraffic = getInput('tag_traffic');
const labels = parseKVString(getInput('labels'));
Expand Down Expand Up @@ -196,6 +197,10 @@ export async function run(): Promise<void> {
setEnvVarsFlags(deployCmd, envVars, envVarsFile, envVarsUpdateStrategy);
setSecretsFlags(deployCmd, secrets, secretsUpdateStrategy);

if (wait) {
deployCmd.push('--wait');
}

// There is no --update-secrets flag on jobs, but there will be in the
// future. At that point, we can remove this.
const idx = deployCmd.indexOf('--update-secrets');
Expand Down
24 changes: 24 additions & 0 deletions tests/unit/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,30 @@ test('#run', { concurrency: true }, async (suite) => {
const args = mocks.getExecOutput.mock.calls?.at(0)?.arguments?.at(1);
assertMembers(args, ['run', 'jobs', 'deploy', 'my-test-job']);
});

await suite.test('deploys a job with --wait', async (t) => {
const mocks = defaultMocks(t.mock, {
job: 'my-test-job',
wait: 'true',
});

await run();

const args = mocks.getExecOutput.mock.calls?.at(0)?.arguments?.at(1);
assert.ok(args?.includes('--wait'));
});

await suite.test('deploys a job without --wait', async (t) => {
const mocks = defaultMocks(t.mock, {
job: 'my-test-job',
wait: 'false',
});

await run();

const args = mocks.getExecOutput.mock.calls?.at(0)?.arguments?.at(1);
assert.ok(!args.includes('--wait'));
});
});

const splitKV = (s: string): Record<string, string> => {
Expand Down
Loading