From e7ca74b44a44404f5bdcb55903e9c79c15ae85f6 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 4 Mar 2025 13:07:41 +1100 Subject: [PATCH 1/2] ci(iam): migrate to new CI --- .github/config/nodejs-dev.jsonc | 1 + .github/config/nodejs-prod.jsonc | 1 - iam/deny/test/deny.test.js | 6 +----- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/config/nodejs-dev.jsonc b/.github/config/nodejs-dev.jsonc index 088934266a..4006da2531 100644 --- a/.github/config/nodejs-dev.jsonc +++ b/.github/config/nodejs-dev.jsonc @@ -184,6 +184,7 @@ "healthcare/datasets", "healthcare/dicom", "healthcare/hl7v2", + "iam/deny", "kms", "media/livestream", "media/transcoder", diff --git a/.github/config/nodejs-prod.jsonc b/.github/config/nodejs-prod.jsonc index bee3b1d2ed..922579ed1a 100644 --- a/.github/config/nodejs-prod.jsonc +++ b/.github/config/nodejs-prod.jsonc @@ -94,7 +94,6 @@ "functions/slack", // TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type ... Received undefined "functions/v2/imagemagick", // (untested) Error: A bucket name is needed to use Cloud Storage. "healthcare/fhir", // Error: Cannot find module 'whatwg-url' - "iam/deny", // PERMISSION_DENIED: Permission iam.googleapis.com/denypolicies.create denied on resource cloudresourcemanager.googleapis.com/projects/long-door-651 "recaptcha_enterprise/snippets", // Cannot use import statement outside a module "run/idp-sql", // (untested) Error: Invalid contents in the credentials file "scheduler", // SyntaxError: Cannot use import statement outside a module diff --git a/iam/deny/test/deny.test.js b/iam/deny/test/deny.test.js index d4eee1438c..412a5f4385 100644 --- a/iam/deny/test/deny.test.js +++ b/iam/deny/test/deny.test.js @@ -24,14 +24,10 @@ const iamClient = new PoliciesClient(); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); describe('IAM deny samples', () => { - let projectId; + const {projectId} = process.env; const policyId = `gcloud-test-policy-${uuid.v4().split('-')[0]}`; const policyName = `policies/cloudresourcemanager.googleapis.com%2Fprojects%2F949737848314/denypolicies/${policyId}`; - before(async () => { - projectId = await iamClient.getProjectId(); - }); - it('should create IAM policy', async () => { const output = execSync(`node createDenyPolicy ${projectId} ${policyId}`); From 93a7acb56adc8db131c7e2f98434886c300c6158 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 4 Mar 2025 13:14:00 +1100 Subject: [PATCH 2/2] fix --- iam/deny/test/deny.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iam/deny/test/deny.test.js b/iam/deny/test/deny.test.js index 412a5f4385..a96b103ba4 100644 --- a/iam/deny/test/deny.test.js +++ b/iam/deny/test/deny.test.js @@ -17,14 +17,14 @@ const {assert} = require('chai'); const uuid = require('uuid'); const cp = require('child_process'); -const {describe, it, before} = require('mocha'); +const {describe, it} = require('mocha'); const {PoliciesClient} = require('@google-cloud/iam').v2; const iamClient = new PoliciesClient(); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); describe('IAM deny samples', () => { - const {projectId} = process.env; + const projectId = process.env.PROJECT_ID; const policyId = `gcloud-test-policy-${uuid.v4().split('-')[0]}`; const policyName = `policies/cloudresourcemanager.googleapis.com%2Fprojects%2F949737848314/denypolicies/${policyId}`;