Skip to content

Commit 6703641

Browse files
authored
feat: remove beta installation and use from GA components (#377) (#379)
Fixes GH-376
1 parent fcc32e6 commit 6703641

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

dist/main/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export async function run(): Promise<void> {
6060
const credentials = core.getInput('credentials'); // Service account key
6161
let projectId = core.getInput('project_id');
6262
let gcloudVersion = core.getInput('gcloud_version');
63-
let gcloudComponent = presence(core.getInput('gcloud_component')); // Cloud SDK component version
63+
const gcloudComponent = presence(core.getInput('gcloud_component')); // Cloud SDK component version
6464
// Flags
6565
const envVars = parseKVString(core.getInput('env_vars')); // String of env vars KEY=VALUE,...
6666
const secrets = parseKVString(core.getInput('secrets')); // String of secrets KEY=VALUE,...
@@ -116,7 +116,6 @@ export async function run(): Promise<void> {
116116
'--region',
117117
region,
118118
];
119-
gcloudComponent = gcloudComponent ?? 'beta';
120119
if (revTraffic) cmd.push('--to-revisions', revTraffic);
121120
if (tagTraffic) cmd.push('--to-tags', tagTraffic);
122121
} else if (source) {
@@ -133,7 +132,6 @@ export async function run(): Promise<void> {
133132
'--source',
134133
source,
135134
];
136-
gcloudComponent = gcloudComponent ?? 'beta';
137135
if (timeout) cmd.push('--timeout', timeout);
138136
} else if (metadata) {
139137
// Deploy service from metadata
@@ -143,7 +141,6 @@ export async function run(): Promise<void> {
143141
);
144142
}
145143
cmd = ['run', 'services', 'replace', metadata, '--platform', 'managed', '--region', region];
146-
gcloudComponent = gcloudComponent ?? 'beta';
147144
} else {
148145
// Deploy service with image specified
149146
cmd = [
@@ -166,11 +163,9 @@ export async function run(): Promise<void> {
166163
}
167164
if (secrets && Object.keys(secrets).length > 0) {
168165
cmd.push('--update-secrets', kvToString(secrets));
169-
gcloudComponent = gcloudComponent ?? 'beta';
170166
}
171167
if (tag) {
172168
cmd.push('--tag', tag);
173-
gcloudComponent = gcloudComponent ?? 'beta';
174169
}
175170
if (suffix) cmd.push('--revision-suffix', suffix);
176171
if (noTraffic) cmd.push('--no-traffic');

tests/unit/main.test.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,24 @@ describe('#deploy-cloudrun', function () {
113113
await run();
114114
expect(this.stubs.setFailed.callCount).to.be.at.least(1);
115115
});
116-
it('installs beta components with source', async function () {
116+
it('sets source if given', async function () {
117117
this.stubs.getInput.withArgs('source').returns('example-app');
118118
this.stubs.getInput.withArgs('image').returns('');
119119
await run();
120-
expect(this.stubs.installComponent.withArgs('beta').callCount).to.eq(1);
120+
const call = this.stubs.getExecOutput.getCall(0);
121+
expect(call).to.be;
122+
const args = call.args[1];
123+
expect(args).to.include.members(['--source', 'example-app']);
121124
});
122-
it('installs beta components with metadata', async function () {
125+
it('sets metadata if given', async function () {
123126
this.stubs.getInput.withArgs('metadata').returns('yaml');
124127
this.stubs.getInput.withArgs('image').returns('');
125128
this.stubs.getInput.withArgs('service').returns('');
126129
await run();
127-
expect(this.stubs.installComponent.withArgs('beta').callCount).to.eq(1);
130+
const call = this.stubs.getExecOutput.getCall(0);
131+
expect(call).to.be;
132+
const args = call.args[1];
133+
expect(args).to.include.members(['services', 'replace', 'yaml']);
128134
});
129135
it('sets timeout if given', async function () {
130136
this.stubs.getInput.withArgs('timeout').returns('55m12s');
@@ -134,16 +140,22 @@ describe('#deploy-cloudrun', function () {
134140
const args = call.args[1];
135141
expect(args).to.include.members(['--timeout', '55m12s']);
136142
});
137-
it('installs beta components with tag', async function () {
143+
it('sets tag if given', async function () {
138144
this.stubs.getInput.withArgs('tag').returns('test');
139145
await run();
140-
expect(this.stubs.installComponent.withArgs('beta').callCount).to.eq(1);
146+
const call = this.stubs.getExecOutput.getCall(0);
147+
expect(call).to.be;
148+
const args = call.args[1];
149+
expect(args).to.include.members(['--tag', 'test']);
141150
});
142-
it('installs beta components with tag traffic', async function () {
151+
it('sets tag traffic if given', async function () {
143152
this.stubs.getInput.withArgs('tag').returns('test');
144153
this.stubs.getInput.withArgs('name').returns('service-name');
145154
await run();
146-
expect(this.stubs.installComponent.withArgs('beta').callCount).to.eq(1);
155+
const call = this.stubs.getExecOutput.getCall(0);
156+
expect(call).to.be;
157+
const args = call.args[1];
158+
expect(args).to.include.members(['--tag', 'test']);
147159
});
148160
it('fails if tag traffic and revision traffic are provided', async function () {
149161
this.stubs.getInput.withArgs('revision_traffic').returns('TEST=100');

0 commit comments

Comments
 (0)