mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-05-31 06:59:46 +00:00
Automated: Migrate gerrit/git-repo from gsutil to gcloud storage
Bug: 486536908 Change-Id: I248b093e189a3784b8959e837a5d66857f1ce0fc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/577201 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Guru sai rama subbarao Voleti (xWF) <gvoleti@google.com> Commit-Queue: Guru sai rama subbarao Voleti (xWF) <gvoleti@google.com>
This commit is contained in:
committed by
gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
51021fb209
commit
a94c9e2b52
@@ -34,7 +34,7 @@ def fetch_file(url, verbose=False):
|
|||||||
"""
|
"""
|
||||||
scheme = urlparse(url).scheme
|
scheme = urlparse(url).scheme
|
||||||
if scheme == "gs":
|
if scheme == "gs":
|
||||||
cmd = ["gsutil", "cat", url]
|
cmd = ["gcloud", "storage", "cat", url]
|
||||||
errors = []
|
errors = []
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
@@ -42,7 +42,7 @@ def fetch_file(url, verbose=False):
|
|||||||
)
|
)
|
||||||
if result.stderr and verbose:
|
if result.stderr and verbose:
|
||||||
print(
|
print(
|
||||||
'warning: non-fatal error running "gsutil": %s'
|
'warning: non-fatal error running "gcloud storage": %s'
|
||||||
% result.stderr,
|
% result.stderr,
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
@@ -50,7 +50,8 @@ def fetch_file(url, verbose=False):
|
|||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
errors.append(e)
|
errors.append(e)
|
||||||
print(
|
print(
|
||||||
'fatal: error running "gsutil": %s' % e.stderr, file=sys.stderr
|
'fatal: error running "gcloud storage": %s' % e.stderr,
|
||||||
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
raise FetchFileError(aggregate_errors=errors)
|
raise FetchFileError(aggregate_errors=errors)
|
||||||
with urlopen(url) as f:
|
with urlopen(url) as f:
|
||||||
|
|||||||
@@ -85,18 +85,18 @@ Repo launcher bucket:
|
|||||||
gs://git-repo-downloads/
|
gs://git-repo-downloads/
|
||||||
|
|
||||||
You should first upload it with a specific version:
|
You should first upload it with a specific version:
|
||||||
gsutil cp -a public-read {opts.launcher} gs://git-repo-downloads/repo-{version}
|
gcloud storage cp --predefined-acl=publicRead {opts.launcher} gs://git-repo-downloads/repo-{version}
|
||||||
gsutil cp -a public-read {opts.launcher}.asc gs://git-repo-downloads/repo-{version}.asc
|
gcloud storage cp --predefined-acl=publicRead {opts.launcher}.asc gs://git-repo-downloads/repo-{version}.asc
|
||||||
|
|
||||||
Then to make it the public default:
|
Then to make it the public default:
|
||||||
gsutil cp -a public-read gs://git-repo-downloads/repo-{version} gs://git-repo-downloads/repo
|
gcloud storage cp --predefined-acl=publicRead gs://git-repo-downloads/repo-{version} gs://git-repo-downloads/repo
|
||||||
gsutil cp -a public-read gs://git-repo-downloads/repo-{version}.asc gs://git-repo-downloads/repo.asc
|
gcloud storage cp --predefined-acl=publicRead gs://git-repo-downloads/repo-{version}.asc gs://git-repo-downloads/repo.asc
|
||||||
|
|
||||||
NB: If a rollback is necessary, the GS bucket archives old versions, and may be
|
NB: If a rollback is necessary, the GS bucket archives old versions, and may be
|
||||||
accessed by specifying their unique id number.
|
accessed by specifying their unique id number.
|
||||||
gsutil ls -la gs://git-repo-downloads/repo gs://git-repo-downloads/repo.asc
|
gcloud storage ls --long --all-versions gs://git-repo-downloads/repo gs://git-repo-downloads/repo.asc
|
||||||
gsutil cp -a public-read gs://git-repo-downloads/repo#<unique id> gs://git-repo-downloads/repo
|
gcloud storage cp --predefined-acl=publicRead gs://git-repo-downloads/repo#<unique id> gs://git-repo-downloads/repo
|
||||||
gsutil cp -a public-read gs://git-repo-downloads/repo.asc#<unique id> gs://git-repo-downloads/repo.asc
|
gcloud storage cp --predefined-acl=publicRead gs://git-repo-downloads/repo.asc#<unique id> gs://git-repo-downloads/repo.asc
|
||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user