Skip to content

Disable prompts and set additional metrics #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2024
Merged
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
15 changes: 6 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import {
parseKVString,
pinnedToHeadWarning,
presence,
stubEnv,
} from '@google-github-actions/actions-utils';

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

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

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

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

// Look up the new version to get metadata.
const appVersionsDescribeCmd = ['app', 'versions', 'describe', '--quiet', '--format', 'json'];
const appVersionsDescribeCmd = ['app', 'versions', 'describe', '--format', 'json'];
appVersionsDescribeCmd.push('--project', deployResponse.project);
appVersionsDescribeCmd.push('--service', deployResponse.service);
appVersionsDescribeCmd.push(deployResponse.versionID);
Expand Down Expand Up @@ -259,8 +258,6 @@ export async function run(): Promise<void> {
const msg = errorMessage(err);
setFailed(`google-github-actions/deploy-appengine failed with: ${msg}`);
} finally {
restoreEnv();

if (originalAppYamlPath && originalAppYamlContents) {
logDebug(`Restoring original ${originalAppYamlPath} contents`);
await fs.writeFile(originalAppYamlPath, originalAppYamlContents, { flag: 'w' });
Expand Down
Loading