-
Notifications
You must be signed in to change notification settings - Fork 132
chore: Migrate gsutil usage to gcloud storage #184
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 all commits
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 |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ def upload_results(): | |
| for file in os.listdir('/Big-Data-Benchmark-for-Big-Bench/logs/'): | ||
| if file.__contains__(".csv") or file.__contains__(".zip"): | ||
| output_path = "{}/{}/{}/".format(sys.argv[1], sys.argv[2], cluster_name) | ||
| command = "gsutil cp /Big-Data-Benchmark-for-Big-Bench/logs/{} {}{}" \ | ||
| command = "gcloud storage cp /Big-Data-Benchmark-for-Big-Bench/logs/{} {}{}" \ | ||
| .format(file, output_path, file) | ||
|
Comment on lines
+51
to
52
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. The command string is constructed using |
||
| execute_shell(command) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,7 @@ def upload_results(): | |
| attributes/dataproc-cluster-name") \ | ||
| .read() | ||
| output_path = "{}/{}/{}/hibench.report".format(sys.argv[1], sys.argv[2], cluster_name) | ||
| cmd = "gsutil cp /HiBench/report/hibench.report {}".format(output_path) | ||
| cmd = "gcloud storage cp /HiBench/report/hibench.report {}".format(output_path) | ||
|
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. The command string is constructed using |
||
| execute_shell(cmd) | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,8 +108,8 @@ check_exists "Main Subnet ${SUBNET}" "gcloud compute networks subnets describe ' | |
| check_exists "Service Account ${GSA}" "gcloud iam service-accounts describe '${GSA}' --project='${PROJECT_ID}'" | ||
|
|
||
| # 4. GCS Buckets | ||
| check_exists "GCS Staging Bucket gs://${BUCKET}" "gsutil ls -b 'gs://${BUCKET}'" | ||
| check_exists "GCS Temp Bucket gs://${TEMP_BUCKET}" "gsutil ls -b 'gs://${TEMP_BUCKET}'" | ||
| check_exists "GCS Staging Bucket gs://${BUCKET}" "gcloud storage ls --buckets 'gs://${BUCKET}'" | ||
| check_exists "GCS Temp Bucket gs://${TEMP_BUCKET}" "gcloud storage ls --buckets 'gs://${TEMP_BUCKET}'" | ||
|
Comment on lines
+111
to
+112
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. The script calls |
||
|
|
||
| # 5. Cloud Router | ||
| check_exists "Cloud Router ${ROUTER_NAME}" "gcloud compute routers describe '${ROUTER_NAME}' --region='${REGION}' --project='${PROJECT_ID}'" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,8 +63,8 @@ check_resource "Main Subnet" \ | |
| check_resource_exact "VPC Network ${NETWORK}" "gcloud compute networks describe \"${NETWORK}\" --project=\"${PROJECT_ID}\"" | ||
|
|
||
| # 8. GCS Buckets (Optional without --force) | ||
| check_resource_exact "GCS Staging Bucket gs://${BUCKET}" "gsutil ls -b 'gs://${BUCKET}'" true | ||
| check_resource_exact "GCS Temp Bucket gs://${TEMP_BUCKET}" "gsutil ls -b 'gs://${TEMP_BUCKET}'" true | ||
| check_resource_exact "GCS Staging Bucket gs://${BUCKET}" "gcloud storage ls --buckets 'gs://${BUCKET}'" true | ||
| check_resource_exact "GCS Temp Bucket gs://${TEMP_BUCKET}" "gcloud storage ls --buckets 'gs://${TEMP_BUCKET}'" true | ||
|
Comment on lines
+66
to
+67
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. The script calls |
||
|
|
||
| echo -e "\nAudit complete." | ||
| echo -e "[${YELLOW}Pass*${NC}] indicates the resource was not found (which is expected after destroy)." | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,8 +38,8 @@ check_exists "SWP Subnet ${SWP_SUBNET}" "gcloud compute networks subnets describ | |
| check_exists "Service Account ${GSA}" "gcloud iam service-accounts describe '${GSA}' --project='${PROJECT_ID}'" | ||
|
|
||
| # 4. GCS Buckets | ||
| check_exists "GCS Staging Bucket gs://${BUCKET}" "gsutil ls -b 'gs://${BUCKET}'" | ||
| check_exists "GCS Temp Bucket gs://${TEMP_BUCKET}" "gsutil ls -b 'gs://${TEMP_BUCKET}'" | ||
| check_exists "GCS Staging Bucket gs://${BUCKET}" "gcloud storage ls --buckets 'gs://${BUCKET}'" | ||
| check_exists "GCS Temp Bucket gs://${TEMP_BUCKET}" "gcloud storage ls --buckets 'gs://${TEMP_BUCKET}'" | ||
|
Comment on lines
+41
to
+42
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. The script calls |
||
|
|
||
| # 5. SWP Certificate Components | ||
| SUFFIX=${RESOURCE_SUFFIX} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,8 +131,8 @@ check_resource "Main Subnet" \ | |
| check_resource_exact "VPC Network ${NETWORK}" "gcloud compute networks describe \"${NETWORK}\" --project=\"${PROJECT_ID}\"" | ||
|
|
||
| # 14. GCS Buckets (Optional without --force) | ||
| check_resource_exact "GCS Staging Bucket gs://${BUCKET}" "gsutil ls -b 'gs://${BUCKET}'" true | ||
| check_resource_exact "GCS Temp Bucket gs://${TEMP_BUCKET}" "gsutil ls -b 'gs://${TEMP_BUCKET}'" true | ||
| check_resource_exact "GCS Staging Bucket gs://${BUCKET}" "gcloud storage ls --buckets 'gs://${BUCKET}'" true | ||
| check_resource_exact "GCS Temp Bucket gs://${TEMP_BUCKET}" "gcloud storage ls --buckets 'gs://${TEMP_BUCKET}'" true | ||
|
Comment on lines
+134
to
+135
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. The script calls |
||
|
|
||
| echo -e "\nAudit complete." | ||
| echo -e "[${YELLOW}Pass*${NC}] indicates the resource was not found (which is expected after destroy)." | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ source lib/env.sh | |
| source lib/gke.sh # Assuming gke functions are here | ||
|
|
||
| # Copy latest initialization action scripts | ||
| gsutil -m cp -r init/* gs://${BUCKET}/dataproc-initialization-actions | ||
| gcloud storage cp --recursive init/* gs://${BUCKET}/dataproc-initialization-actions | ||
|
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. |
||
|
|
||
| # re-create normal dataproc cluster | ||
| delete_gke_cluster | ||
|
|
@@ -28,4 +28,3 @@ create_gke_cluster | |
| echo "========================" | ||
| echo "DPGKE Cluster re-created" | ||
| echo "========================" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command string is constructed using
.format()with variablesscenario.config_file_nameandscenario_destination_bucket_path, which are derived from YAML configuration files. Since this command is executed viaexecute_shell(which usessubprocess.Popen(cmd, shell=True)), it is vulnerable to command injection if the YAML content or scenario names contain shell metacharacters. It is recommended to avoidshell=Trueand pass arguments as a list.