Skip to content
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

Add support for setting gcp endpoint for easier testing #3785

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,10 @@ export async function parseCommandLine() {
describe: 'Name of the Google Cloud storage bucket',
group: 'GoogleCloudStorage'
})
.option('gcs.apiEndpoint', {
describe: 'The URL to the API endpoint, good for using fake-gcs-server',
group: 'GoogleCloudStorage'
})
.option('gcs.public', {
describe:
'Make uploaded results to Google Cloud storage publicly readable.',
Expand Down
12 changes: 10 additions & 2 deletions lib/plugins/gcs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@
}

async function uploadLatestFiles(dir, gcsOptions, prefix) {
const storage = new Storage({

Check failure on line 18 in lib/plugins/gcs/index.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Delete `⏎`

Check failure on line 18 in lib/plugins/gcs/index.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Delete `⏎`
const config = {
projectId: gcsOptions.projectId,
keyFilename: gcsOptions.key
});
}

Check failure on line 22 in lib/plugins/gcs/index.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Insert `;`

Check failure on line 22 in lib/plugins/gcs/index.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Insert `;`

if (gcsOptions.apiEndpoint) {
config.apiEndpoint = gcsOptions.apiEndpoint;
}

Check failure on line 26 in lib/plugins/gcs/index.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Delete `⏎`

Check failure on line 26 in lib/plugins/gcs/index.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Delete `⏎`


const storage = new Storage(config);
const bucket = storage.bucket(gcsOptions.bucketname);

const files = await readdir(dir, [ignoreDirectories]);
Expand Down
Loading