Skip to content

Commit d82c52c

Browse files
authored
Disable prompts and set additional metrics (#364)
1 parent f217ff2 commit d82c52c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/main.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import {
5050
parseKVString,
5151
pinnedToHeadWarning,
5252
presence,
53-
stubEnv,
5453
} from '@google-github-actions/actions-utils';
5554

5655
import { parseDeployResponse, parseDescribeResponse } from './output-parser';
@@ -74,10 +73,10 @@ let originalAppYamlContents: string, originalAppYamlPath: string;
7473
*/
7574
export async function run(): Promise<void> {
7675
// Register metrics
77-
const restoreEnv = stubEnv({
78-
CLOUDSDK_METRICS_ENVIRONMENT: 'github-actions-deploy-appengine',
79-
CLOUDSDK_METRICS_ENVIRONMENT_VERSION: appVersion,
80-
});
76+
process.env.CLOUDSDK_CORE_DISABLE_PROMPTS = '1';
77+
process.env.CLOUDSDK_METRICS_ENVIRONMENT = 'github-actions-deploy-cloudrun';
78+
process.env.CLOUDSDK_METRICS_ENVIRONMENT_VERSION = appVersion;
79+
process.env.GOOGLE_APIS_USER_AGENT = `google-github-actions:deploy-appengine/${appVersion}`;
8180

8281
// Warn if pinned to HEAD
8382
if (isPinnedToHead()) {
@@ -155,7 +154,7 @@ export async function run(): Promise<void> {
155154
const toolCommand = getToolCommand();
156155

157156
// Create app engine gcloud cmd.
158-
let appDeployCmd = ['app', 'deploy', '--quiet', '--format', 'json', ...deliverables];
157+
let appDeployCmd = ['app', 'deploy', '--format', 'json', ...deliverables];
159158

160159
// Add gcloud flags.
161160
if (projectId) {
@@ -219,7 +218,7 @@ export async function run(): Promise<void> {
219218
logDebug(`Deployed new version: ${JSON.stringify(deployResponse)}`);
220219

221220
// Look up the new version to get metadata.
222-
const appVersionsDescribeCmd = ['app', 'versions', 'describe', '--quiet', '--format', 'json'];
221+
const appVersionsDescribeCmd = ['app', 'versions', 'describe', '--format', 'json'];
223222
appVersionsDescribeCmd.push('--project', deployResponse.project);
224223
appVersionsDescribeCmd.push('--service', deployResponse.service);
225224
appVersionsDescribeCmd.push(deployResponse.versionID);
@@ -259,8 +258,6 @@ export async function run(): Promise<void> {
259258
const msg = errorMessage(err);
260259
setFailed(`google-github-actions/deploy-appengine failed with: ${msg}`);
261260
} finally {
262-
restoreEnv();
263-
264261
if (originalAppYamlPath && originalAppYamlContents) {
265262
logDebug(`Restoring original ${originalAppYamlPath} contents`);
266263
await fs.writeFile(originalAppYamlPath, originalAppYamlContents, { flag: 'w' });

0 commit comments

Comments
 (0)