Skip to content

Commit e941489

Browse files
committed
create-gaarf-wf@1.11.4: Fix: before GCS bucket creating check for its existence and skip if one exists, it partly helps in cases when multi-regional regions aren't available for users (they have to manually create a bucket in a supported location beforehand)
Change-Id: I24b2dc411c73fd8c3301ba56a27ee744237b3676
1 parent 3ab2769 commit e941489

File tree

6 files changed

+34
-23
lines changed

6 files changed

+34
-23
lines changed

gcp/create-gaarf-wf/build/index.js

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gcp/create-gaarf-wf/build/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gcp/create-gaarf-wf/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gcp/create-gaarf-wf/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-gaarf-wf",
3-
"version": "1.11.3",
3+
"version": "1.11.4",
44
"description": "Interactive generator for Gaarf (Google Ads API Report Fetcher) Workflow",
55
"type": "module",
66
"bin": {

gcp/create-gaarf-wf/src/index.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -916,21 +916,29 @@ async function init() {
916916

917917
const gcp_region = await ask_for_gcp_region(answers);
918918

919-
// create a bucket
920-
const res = await exec_cmd(
921-
`gsutil mb -l ${getMultiRegion(gcp_region)} -b on gs://${gcs_bucket}`,
922-
new clui.Spinner(`Creating a GCS bucket ${gcs_bucket}`),
919+
// create a bucket if it doesn't exist
920+
let res = await exec_cmd(
921+
`gsutil ls gs://${gcs_bucket}`,
922+
new clui.Spinner(`Checking if GCS bucket ${gcs_bucket} exists`),
923923
{silent: true}
924924
);
925-
if (
926-
res.code !== 0 &&
927-
!res.stderr.includes(
928-
`ServiceException: 409 A Cloud Storage bucket named '${gcs_bucket}' already exists`
929-
)
930-
) {
931-
console.log(chalk.red(`Could not create a bucket ${gcs_bucket}`));
932-
console.log(res.stderr || res.stdout);
925+
if (res.code !== 0) {
926+
// bucket doesn't exist
927+
res = await exec_cmd(
928+
`gsutil mb -l ${getMultiRegion(gcp_region)} -b on gs://${gcs_bucket}`,
929+
new clui.Spinner(`Creating a GCS bucket ${gcs_bucket}`),
930+
{silent: true}
931+
);
932+
if (res.code !== 0) {
933+
console.log(
934+
chalk.red(
935+
`Could not create a bucket ${gcs_bucket}. Most likely the installation will fail`
936+
)
937+
);
938+
console.log(res.stderr || res.stdout);
939+
}
933940
}
941+
934942
const gcs_base_path = `gs://${gcs_bucket}/${name}`;
935943

936944
// Create deploy-queries.sh

js/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Node.js version of Google Ads API Report Fetcher tool a.k.a. `gaarf`.
33
Please see the full documentation in the root [README](https://github.com/google/ads-api-report-fetcher/README.md).
44

5-
Supports [Ads API v16](https://developers.google.com/google-ads/api/docs/release-notes#v16).
5+
Supports [Ads API v17.1](https://developers.google.com/google-ads/api/docs/release-notes#v17).
66

77
<p align="center">
88
<a href="https://developers.google.com/google-ads/api/docs/release-notes">

0 commit comments

Comments
 (0)