⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Fully migrate gsutil module to gcloud storage#5122

Open
ViniciustCosta wants to merge 25 commits intomasterfrom
chore/fully_migrate_gsutil_module
Open

Fully migrate gsutil module to gcloud storage#5122
ViniciustCosta wants to merge 25 commits intomasterfrom
chore/fully_migrate_gsutil_module

Conversation

@ViniciustCosta
Copy link
Collaborator

@ViniciustCosta ViniciustCosta commented Jan 14, 2026

Fully migrate the gsutil module to use gcloud storage by:

  • Removing the feature flags used during the migration;
  • Migrating the name for the gcloud storage runner;
  • Fixing some inconsistencies in the gcloud storage runner to match the behavior used by gsutil (e.g., add --recursive to rsync, add quiet flag -q, etc);
  • Adjusting the unit tests

Temporarily retained the gsutil.py filename to facilitate revision, as changing the filename would highlight all the code and not only the actual changes (to be done in a follow-up PR). Temporarily retained the GSUTIL_PATH as a fallback, since changing this to GCLOUD_PATH would depend on landing changes on infra init/setup scripts.

Tests

@ViniciustCosta ViniciustCosta marked this pull request as ready for review January 15, 2026 19:33
@ViniciustCosta ViniciustCosta requested a review from decoNR January 22, 2026 13:40
self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil', '-m', '-o', 'GSUtil:parallel_thread_count=16',
'-q', 'rsync', '-r', '-d', 'gs://bucket/', '/dir'
'/gcloud_path/gcloud', 'storage', '--no-user-output-enabled', '-q',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the -q flag, was this placement tested ?
Also, the original command does not seem to have the equivalent of --no-user-output-enabled ?

self.assertEqual(self.mock.Popen.call_args[0][0], [
'/gsutil_path/gsutil', '-m', '-o', 'GSUtil:parallel_thread_count=16',
'cp', '-I', 'gs://bucket/'
'/gcloud_path/gcloud', 'storage', '--user-output-enabled', '-q', 'cp',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious since previous commands were --(no)-user-output-enabled, but this one is enabling it and agai with a -q option when the original gsutil command did not seem to specify that.
This is intentional and tested ?

"""Test remote rsync."""
self.gcloud_runner_obj.rsync('gs://source_bucket/source_path',
'gs://target_bucket/target_path')
expected_args = [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original gsutil command had the -q option as well.

cp_command.append('--gzip-local-all')
cp_command.extend([file_path, _filter_path(gcs_url, write=True)])

result = self.run_gcloud_storage(cp_command, timeout=timeout)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to put some checks on the stdout/stderr prints as well.

f'Output: {result.output}')
return False

# For gcloud, setting metadata is a separate step after uploading.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not perfectly sure of the use-case here, but that is not necessarily true.
You could set customer metadata along with the cp command - https://docs.cloud.google.com/sdk/gcloud/reference/storage/cp#--custom-metadata

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants