-
Notifications
You must be signed in to change notification settings - Fork 520
chore: Migrate gsutil usage to gcloud storage #1377
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
base: main
Are you sure you want to change the base?
Changes from 10 commits
038c722
1bf5dc7
1ee1781
0b155f1
ca2b328
4a6c2b5
eaa011b
ad553fb
a5bc40c
af0a60c
e6db087
7b54073
403c1fd
7985e1c
4efb686
fc91057
b026e0c
56fc0b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,11 +15,11 @@ def setUp(self): | |||||||||||||||||
| super().setUp() | ||||||||||||||||||
| self.GCS_BUCKET = "test-hbase-{}-{}".format(self.datetime_str(), | ||||||||||||||||||
| self.random_str()) | ||||||||||||||||||
| self.assert_command('gsutil mb -c regional -l {} gs://{}'.format( | ||||||||||||||||||
| self.assert_command('gcloud storage buckets create --default-storage-class=regional --location {} gs://{}'.format( | ||||||||||||||||||
| self.REGION, self.GCS_BUCKET)) | ||||||||||||||||||
|
Comment on lines
+18
to
19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command string is getting long. To improve readability, you could break it into multiple lines and assign it to a variable before passing it to
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| def tearDown(self): | ||||||||||||||||||
| self.assert_command('gsutil -m rm -rf gs://{}'.format(self.GCS_BUCKET)) | ||||||||||||||||||
| self.assert_command('gcloud storage rm --recursive --continue-on-error gs://{}'.format(self.GCS_BUCKET)) | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||
| super().tearDown() | ||||||||||||||||||
|
|
||||||||||||||||||
| def verify_instance(self, name): | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,15 @@ readonly HEAD="$1" | |
| readonly MODULE="$2" | ||
| readonly GCS_FOLDER=gs://dataproc-initialization-actions/${MODULE}/ | ||
|
|
||
| function version_le() { [[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]]; } | ||
| function version_lt() { [[ "$1" = "$2" ]] && return 1 || version_le "$1" "$2"; } | ||
|
|
||
| GCLOUD_SDK_VERSION="$(gcloud --version | awk -F'SDK ' '/Google Cloud SDK/ {print $2}')" | ||
| GSUTIL="gcloud storage" | ||
| if version_lt "${GCLOUD_SDK_VERSION}" "402.0.0"; then | ||
| GSUTIL="gsutil" | ||
| fi | ||
|
|
||
| [[ -n "${HEAD}" && -n "${MODULE}" ]] | ||
|
|
||
| # Verify the repo has no uncommitted changes. | ||
|
|
@@ -51,6 +60,6 @@ for file in "${MODULE}/"*.sh; do | |
| fi | ||
| done | ||
|
|
||
| gsutil -m rsync -R -x "__pycache__/.*" "${MODULE}/" "${GCS_FOLDER}" | ||
| ${GSUTIL} rsync -r --exclude "__pycache__/.*" "${MODULE}/" "${GCS_FOLDER}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this needs to be backward compatible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whether older But I could see So I suggest to keep these options as before. Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. restored to -R and -x
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still -m is missing from gsutil There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -m is not valid for gcloud storage |
||
|
|
||
| echo "Pushed ${MODULE}/ to ${GCS_FOLDER}." | ||
Uh oh!
There was an error while loading. Please reload this page.