From 9a051ab76ce8a17efc6be51a4f66a0248970f317 Mon Sep 17 00:00:00 2001 From: Bharath KKB Date: Fri, 26 Nov 2021 10:02:14 -0600 Subject: [PATCH] fix: export Google GHA creds env var (#57) * fix: export Google GHA creds env var * add comments for cred envvars * build --- dist/index.js | 6 ++++++ src/main.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/dist/index.js b/dist/index.js index f01f3826..70b6c7b9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -240,8 +240,14 @@ function run() { } const credentialsPath = yield client.createCredentialsFile(runnerTempDir); (0, core_1.setOutput)('credentials_file_path', credentialsPath); + // CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE is picked up by gcloud to use + // a specific credential file (subject to change and equivalent to auth/credential_file_override) (0, core_1.exportVariable)('CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE', credentialsPath); + // GOOGLE_APPLICATION_CREDENTIALS is used by Application Default Credentials + // in all GCP client libraries (0, core_1.exportVariable)('GOOGLE_APPLICATION_CREDENTIALS', credentialsPath); + // GOOGLE_GHA_CREDS_PATH is used by other Google GitHub Actions + (0, core_1.exportVariable)('GOOGLE_GHA_CREDS_PATH', credentialsPath); } // Set the project ID environment variables to the computed values. const computedProjectID = yield client.getProjectID(); diff --git a/src/main.ts b/src/main.ts index 1ca164e3..c3b46e9b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -88,8 +88,14 @@ async function run(): Promise { const credentialsPath = await client.createCredentialsFile(runnerTempDir); setOutput('credentials_file_path', credentialsPath); + // CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE is picked up by gcloud to use + // a specific credential file (subject to change and equivalent to auth/credential_file_override) exportVariable('CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE', credentialsPath); + // GOOGLE_APPLICATION_CREDENTIALS is used by Application Default Credentials + // in all GCP client libraries exportVariable('GOOGLE_APPLICATION_CREDENTIALS', credentialsPath); + // GOOGLE_GHA_CREDS_PATH is used by other Google GitHub Actions + exportVariable('GOOGLE_GHA_CREDS_PATH', credentialsPath); } // Set the project ID environment variables to the computed values.