Skip to content

Commit ba9afbd

Browse files
chore: Migrate gsutil usage to gcloud storage (#2150)
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 554b8ba commit ba9afbd

9 files changed

Lines changed: 29 additions & 32 deletions

File tree

synthtool/gcp/templates/python_library/.kokoro/trampoline_v2.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
# To run this script, first download few files from gcs to /dev/shm.
2727
# (/dev/shm is passed into the container as KOKORO_GFILE_DIR).
2828
#
29-
# gsutil cp gs://cloud-devrel-kokoro-resources/python-docs-samples/secrets_viewer_service_account.json /dev/shm
30-
# gsutil cp gs://cloud-devrel-kokoro-resources/python-docs-samples/automl_secrets.txt /dev/shm
29+
# gcloud storage cp gs://cloud-devrel-kokoro-resources/python-docs-samples/secrets_viewer_service_account.json /dev/shm
30+
# gcloud storage cp gs://cloud-devrel-kokoro-resources/python-docs-samples/automl_secrets.txt /dev/shm
3131
#
3232
# Then run the script.
3333
# .kokoro/trampoline_v2.sh

synthtool/gcp/templates/python_notebooks_testing_pipeline/.cloud-build/execute_changed_notebooks_helper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _process_notebook(
8484
resources,
8585
) = remove_no_execute_cells_preprocessor.preprocess(nb)
8686

87-
(nb, resources) = update_variables_preprocessor.preprocess(nb, resources)
87+
nb, resources = update_variables_preprocessor.preprocess(nb, resources)
8888

8989
with open(notebook_path, mode="w", encoding="utf-8") as new_file:
9090
nbformat.write(nb, new_file)
@@ -172,7 +172,8 @@ def process_and_execute_notebook(
172172
# Use gcloud to get tail
173173
try:
174174
result.error_message = subprocess.check_output(
175-
["gsutil", "cat", "-r", "-1000", log_file_uri], encoding="UTF-8"
175+
["gcloud", "storage", "cat", "--range=-1000", log_file_uri],
176+
encoding="UTF-8",
176177
)
177178
except Exception as error:
178179
result.error_message = str(error)

synthtool/gcp/templates/python_notebooks_testing_pipeline/.cloud-build/utils/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def download_file(bucket_name: str, blob_name: str, destination_file: str) -> st
2525
remote_file_path = "".join(["gs://", "/".join([bucket_name, blob_name])])
2626

2727
subprocess.check_output(
28-
["gsutil", "cp", remote_file_path, destination_file], encoding="UTF-8"
28+
["gcloud", "storage", "cp", remote_file_path, destination_file],
29+
encoding="UTF-8",
2930
)
3031

3132
return destination_file
@@ -37,7 +38,7 @@ def upload_file(
3738
) -> str:
3839
"""Copies a local file to a GCS path"""
3940
subprocess.check_output(
40-
["gsutil", "cp", local_file_path, remote_file_path], encoding="UTF-8"
41+
["gcloud", "storage", "cp", local_file_path, remote_file_path], encoding="UTF-8"
4142
)
4243

4344
return remote_file_path

tests/fixtures/php/php_asset/expected/Asset/src/V1/GcsDestination.php

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

tests/fixtures/php/php_asset/expected/Asset/src/V1/IamPolicyAnalysisOutputConfig/GcsDestination.php

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

tests/fixtures/php/php_asset/src/Asset/src/V1/GcsDestination.php

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

tests/fixtures/php/php_asset/src/Asset/src/V1/IamPolicyAnalysisOutputConfig/GcsDestination.php

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

tests/fixtures/php/php_asset/src/owl-bot-staging/Asset/V1/proto/src/Google/Cloud/Asset/V1/GcsDestination.php

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

tests/fixtures/php/php_asset/src/owl-bot-staging/Asset/V1/proto/src/Google/Cloud/Asset/V1/IamPolicyAnalysisOutputConfig/GcsDestination.php

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

0 commit comments

Comments
 (0)