Skip to content

Commit e673bb7

Browse files
Migrate gsutil usage to gcloud storage (#976)
1 parent df479ba commit e673bb7

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ upload-e2e-client-binaries: build-grpc-echo build-grpc-interop
132132
@cp -n bin/stress_test /tmp/apiproxy-test-presubmit-binaries/stress_test
133133
@cp -n bin/grpc_echo_client /tmp/apiproxy-test-presubmit-binaries/grpc_echo_client
134134
@cp -n tests/endpoints/grpc_echo/proto/api_descriptor.pb /tmp/apiproxy-test-presubmit-binaries/api_descriptor.pb
135-
@gsutil cp -Z -r /tmp/apiproxy-test-presubmit-binaries/* "gs://apiproxy-testing-presubmit-binaries/"
135+
@gcloud storage cp --gzip-local-all --recursive /tmp/apiproxy-test-presubmit-binaries/* "gs://apiproxy-testing-presubmit-binaries/"
136136

137137

138138
#-----------------------------------------------------------------------------

prow/gcpproxy-coverage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ case "${JOB_TYPE}" in
7373
esac
7474

7575
# Upload folder.
76-
gsutil -m rsync -r -d "${ROOT}/generated" "gs://esp-v2-coverage/${PUBLIC_DIRECTORY}"
76+
gcloud storage rsync --recursive --delete-unmatched-destination-objects "${ROOT}/generated" "gs://esp-v2-coverage/${PUBLIC_DIRECTORY}"
7777

7878
# No browser cache since some directories change often and that would be misleading.
79-
gsutil -m setmeta -h "Cache-Control:private, max-age=0, no-transform" "gs://esp-v2-coverage/${PUBLIC_DIRECTORY}/**"
79+
gcloud storage objects update --cache-control="private, max-age=0, no-transform" "gs://esp-v2-coverage/${PUBLIC_DIRECTORY}/**"
8080

8181
echo '======================================================='
8282
echo '==================== View Coverage ===================='

scripts/all-utilities.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function retry() {
131131
# Download api Keys from Cloud storage and source the file.
132132
function set_api_keys() {
133133
local api_key_directory="$(mktemp -d)"
134-
$GSUTIL cp gs://apiproxy-testing-client-secret-files/api_keys \
134+
gcloud storage cp gs://apiproxy-testing-client-secret-files/api_keys \
135135
"${api_key_directory}/api_keys" \
136136
|| error_exit "Failed to download API key file."
137137

@@ -142,7 +142,7 @@ function set_api_keys() {
142142
function get_test_client_key() {
143143
local remote_file_name=$1
144144
local key_path=$2
145-
$GSUTIL cp "gs://apiproxy-testing-client-secret-files/$remote_file_name" "$key_path"
145+
gcloud storage cp "gs://apiproxy-testing-client-secret-files/$remote_file_name" "$key_path"
146146
echo -n "$key_path"
147147
return 0
148148
}
@@ -279,7 +279,7 @@ function update_tool() {
279279

280280
[[ -z "${TOOLS_BUCKET}" ]] && return 1
281281
echo "Uploading ${local_path} to ${remote_path}."
282-
${GSUTIL} cp "${local_path}" "${remote_path}" \
282+
gcloud storage cp "${local_path}" "${remote_path}" \
283283
|| { echo "Failed to upload ${tool_name} to ${TOOLS_BUCKET}";
284284
return 1; }
285285
return 0
@@ -293,7 +293,7 @@ function get_tool() {
293293

294294
[[ -z "${TOOLS_BUCKET}" ]] && return 1
295295
echo "Downloading ${remote_path} to ${local_path}."
296-
${GSUTIL} cp "${remote_path}" "${local_path}" \
296+
gcloud storage cp "${remote_path}" "${local_path}" \
297297
|| { echo "Failed to upload ${tool_name} to ${TOOLS_BUCKET}";
298298
return 1; }
299299
return 0

scripts/release/release-qualify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function count_stress_failures() {
114114
mkdir -p "${LOGS}/${SHA}"
115115

116116
echo "Downloading prow logs to '${LOGS}' directory."
117-
${GSUTIL} -m -q cp -r "gs://apiproxy-continuous-long-run/${SHA}/logs/*" "${LOGS}/${SHA}/" 2>&1 \
117+
gcloud -q storage cp --recursive "gs://apiproxy-continuous-long-run/${SHA}/logs/*" "${LOGS}/${SHA}/" 2>&1 \
118118
|| error_exit "Failed to download logs from gs://apiproxy-continuous-long-run/${SHA}/logs/*"
119119

120120
python3 "${ROOT}/scripts/release/validate_release.py" \

src/go/gcsrunner/main/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// Fetches from the bucket at `BUCKET` at the path `CONFIG_FILE_NAME`,
2222
// Behavior is similar to running:
2323
//
24-
// `gsutil cp "gs://${BUCKET}/${CONFIG_FILE_NAME}" envoy.json`
24+
// `gcloud storage cp "gs://${BUCKET}/${CONFIG_FILE_NAME}" envoy.json`
2525
//
2626
// without needing `gsutil` in the image.
2727
//

tests/e2e/scripts/linux-test-kb-long-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fi
5656
# Download api Keys with restrictions from Cloud storage.
5757
TEMP_DIR="$(mktemp -d)"
5858
API_RESTRICTION_KEYS_FILE="${TEMP_DIR}/apiproxy-e2e-key-restriction.json"
59-
gsutil cp gs://apiproxy-testing-client-secret-files/restricted_api_keys.json \
59+
gcloud storage cp gs://apiproxy-testing-client-secret-files/restricted_api_keys.json \
6060
"${API_RESTRICTION_KEYS_FILE}" \
6161
|| error_exit "Failed to download API key with restrictions file."
6262

tests/e2e/scripts/prow-utilities.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ function upload_logs() {
257257
local log_dir="${2}"
258258

259259
echo "Uploading content of ${log_dir} to ${remote_dir}"
260-
retry -n 3 ${GSUTIL} -h 'Content-Type:text/plain' -m cp -r \
260+
# The gsutil top-level flag `-h` is not supported in `gcloud storage`.
261+
retry -n 3 gcloud storage cp --recursive \
261262
"${log_dir}" "${remote_dir}" \
262263
|| echo "Failed to upload ${log_dir}"
263264
}
@@ -297,7 +298,7 @@ function wait_apiproxy_image() {
297298
}
298299

299300
function download_client_binaries() {
300-
gsutil -m cp "gs://apiproxy-testing-presubmit-binaries/*" ${ROOT}/bin/
301+
gcloud storage cp "gs://apiproxy-testing-presubmit-binaries/*" ${ROOT}/bin/
301302
mv ${ROOT}/bin/api_descriptor.pb ${ROOT}/tests/endpoints/grpc_echo/proto/api_descriptor.pb
302303
chmod +x ${ROOT}/bin/*
303304
}

0 commit comments

Comments
 (0)