Skip to content

Commit

Permalink
fix: parse the service-account passed in and use it to avoid gcloud c…
Browse files Browse the repository at this point in the history
…onfusion
  • Loading branch information
genisd committed Apr 17, 2024
1 parent 9f8101b commit 20309e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ function deleteCmd(helm, namespace, release) {
async function setupClusterAuthentication(project, location, name, sa_json) {
core.info('Setting up GKE authentication');
await writeFile("sa.json", sa_json);
const account = JSON.parse(sa_json).client_email; // get the account passed in. this will prevent issues when multiple accounts have been activated
await exec.exec(GCLOUD_BINARY, ['auth', 'activate-service-account', '--key-file=sa.json']);
await exec.exec(GCLOUD_BINARY, ['container', 'clusters', 'get-credentials', name, '--zone', location, '--project', project], { env: { GOOGLE_APPLICATION_CREDENTIALS: 'sa.json' } });
await exec.exec(GCLOUD_BINARY, ['container', 'clusters', 'get-credentials', name, '--zone', location, '--project', project, '--account', account]);
await deleteFile("sa.json");
}

Expand Down

0 comments on commit 20309e3

Please sign in to comment.