github-actions[bot] commented on code in PR #41628:
URL: https://github.com/apache/beam/pull/41628#discussion_r4684310367
##########
.test-infra/dataproc/flink_cluster.sh:
##########
@@ -207,7 +208,10 @@ function restart() {
# Deletes a Flink cluster.
function delete() {
- gcloud dataproc clusters delete $CLUSTER_NAME --region=$GCLOUD_REGION --quiet
+ local rc=0
+ gcloud dataproc clusters delete "$CLUSTER_NAME" --region="$GCLOUD_REGION"
--quiet || rc=$?
+ gcloud storage rm -r "${INIT_ACTIONS_GCS_DIR}" || true
Review Comment:
**🟢 Low**: If `CLUSTER_NAME` is ever set to an empty string
(`CLUSTER_NAME=""`), `set -u` will not trigger and `INIT_ACTIONS_GCS_DIR` will
evaluate to `${GCS_BUCKET%/}/${INIT_ACTIONS_FOLDER_NAME}/`, causing `gcloud
storage rm -r` to delete the entire `init-actions` folder across all active
clusters. Guarding against an empty `CLUSTER_NAME` (e.g., `[[ -n
"${CLUSTER_NAME}" ]] && gcloud storage rm -r "${INIT_ACTIONS_GCS_DIR}" || true`
or validating `CLUSTER_NAME` at the top of the script) would make this teardown
safer.
```suggestion
[[ -n "${CLUSTER_NAME}" ]] && gcloud storage rm -r
"${INIT_ACTIONS_GCS_DIR}" || true
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]