Repository navigation
chore: migrate gsutil usage to gcloud storage - #190
gurusai-voleti wants to merge 2 commits into
Conversation
|
Hi @codelixir, Can we get your review on this PR? Thanks! |
There was a problem hiding this comment.
Code Review
This pull request updates various scripts and documentation to use gcloud storage instead of the legacy gsutil tool. Feedback on gcloud/init/gce-proxy-setup.sh highlights that since initialization scripts may run on older Dataproc images, gcloud storage might not be available or fully supported. It is recommended to provide a fallback to gsutil to ensure compatibility across all supported Dataproc image versions.
| proxy_ca_pem="${trusted_pem_dir}/proxy_ca.crt" | ||
| mkdir -p "${trusted_pem_dir}" | ||
| gsutil cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; } | ||
| gcloud storage cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; } |
There was a problem hiding this comment.
Since this initialization script can run on older Dataproc images (such as 1.5 or 2.0), gcloud storage might not be available or fully supported in the pre-installed Google Cloud SDK version. Additionally, running as root during initialization can sometimes lead to gcloud configuration or authentication issues. Providing a fallback to gsutil ensures compatibility across all supported Dataproc image versions.
| gcloud storage cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; } | |
| (gcloud storage cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || gsutil cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}") || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; } |
| proxy_ca_pem="${trusted_pem_dir}/proxy_ca.crt" | ||
| mkdir -p "${trusted_pem_dir}" | ||
| gsutil cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; } | ||
| gcloud storage cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; } |
There was a problem hiding this comment.
Since this initialization script can run on older Dataproc images (such as 1.5 or 2.0), gcloud storage might not be available or fully supported in the pre-installed Google Cloud SDK version. Additionally, running as root during initialization can sometimes lead to gcloud configuration or authentication issues. Providing a fallback to gsutil ensures compatibility across all supported Dataproc image versions.
| gcloud storage cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; } | |
| (gcloud storage cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}" || gsutil cp "${METADATA_HTTP_PROXY_PEM_URI}" "${proxy_ca_pem}") || { echo "ERROR: Failed to download proxy CA cert from GCS." ; exit 1 ; } |
4471c62 to
628fe3c
Compare
|
It looks like you're switching over to gcloud storage from gsutil with the assumption that the user has a sufficiently recent gcloud install. Can you please check if the version of gcloud is recent enough before doing so? Be sure to cover the use case of |
this check should be in all files or only in gcloud/init/gce-proxy-setup.sh @cjac |
Automated: Migrate {target_path} from gsutil to gcloud storage
This CL is part of the on going effort to migrate from the legacy
gsutiltool to the new and improvedgcloud storagecommand-line interface.gcloud storageis the recommended and modern tool for interacting with Google Cloud Storage, offering better performance, unified authentication, and a more consistent command structure with othergcloudcomponents. 🚀While we have based the automation on the migration guide, every use case is unique.
It is crucial that you thoroughly test these changes in environments appropriate to your use-case before merging.
Be aware of potential differences between
gsutilandgcloud storagethat could impact your workflows.For instance, the structure of command output may have changed, requiring updates to any scripts that parse it. Similarly, command behavior can differ subtly; the
gcloud storage rsynccommand has a different file deletion logic thangsutil rsync, which could lead to unintended file deletions.Our migration guides can help guide you through a list of mappings and some notable differences between the two tools.
Standard presubmit tests are run as part of this CL's workflow. If you need to target an additional test workflow or require assistance with testing, please let us know.
Please verify that all your Cloud Storage operations continue to work as expected to avoid any potential disruptions in production.
Automation Details
This change was generated automatically by an agent that targets users of
gsutil.The transformations applied are based on the gsutil to gcloud storage migration guide (external guide).
Support and Collaboration
The
GCS CLIteam is here to help! If you encounter any issues, have a complex use case that this automated change doesn't cover, or face any other blockers, please don't hesitate to reach out.We are happy to work with you to test and adjust these changes as needed.
Contact:
gcs-cli-hyd@google.comWe appreciate your partnership in this important migration effort!
#gsutil-migration