Skip to content

Commit 5b3e089

Browse files
committed
wip
1 parent 810182a commit 5b3e089

1 file changed

Lines changed: 7 additions & 51 deletions

File tree

packages/google-cloud-storage/cloudbuild/zb-system-tests-cloudbuild.yaml

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,6 @@ steps:
2323
cat /workspace/.ssh/google_compute_engine.pub > /workspace/gcb_ssh_key.pub
2424
waitFor: ["-"]
2525

26-
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
27-
id: "cleanup-old-keys"
28-
entrypoint: "bash"
29-
args:
30-
- "-c"
31-
- |
32-
#!/bin/bash
33-
set -e
34-
35-
echo "Fetching OS Login SSH keys..."
36-
echo "Removing all keys."
37-
echo "---------------------------------------------------------------------"
38-
39-
FINGERPRINTS_TO_DELETE=$$(gcloud compute os-login ssh-keys list \
40-
--format="value(fingerprint)")
41-
42-
echo "Keys to delete: $$FINGERPRINTS_TO_DELETE"
43-
44-
if [ -z "$$FINGERPRINTS_TO_DELETE" ]; then
45-
echo "No keys found to delete. Nothing to do."
46-
exit 0
47-
fi
48-
49-
while IFS= read -r FINGERPRINT; do
50-
if [ -n "$$FINGERPRINT" ]; then
51-
echo "Deleting key with fingerprint: $$FINGERPRINT"
52-
gcloud compute os-login ssh-keys remove \
53-
--key="$$FINGERPRINT" \
54-
--quiet || true
55-
fi
56-
done <<< "$$FINGERPRINTS_TO_DELETE"
57-
58-
echo "---------------------------------------------------------------------"
59-
echo "Cleanup complete."
60-
6126
# Step 1 Create a GCE VM to run the tests.
6227
# The VM is created in the same zone as the buckets to test rapid storage features.
6328
# It's given the 'cloud-platform' scope to allow it to access GCS and other services.
@@ -76,7 +41,8 @@ steps:
7641
- "--image-project=debian-cloud"
7742
- "--service-account=${_ZONAL_VM_SERVICE_ACCOUNT}"
7843
- "--scopes=https://www.googleapis.com/auth/devstorage.full_control,https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/devstorage.read_write,https://www.googleapis.com/auth/cloudkms"
79-
- "--metadata=enable-oslogin=TRUE"
44+
- # Disable OS Login for this VM to bypass the 32KB profile limit
45+
- "--metadata=enable-oslogin=FALSE"
8046
waitFor: ["-"]
8147

8248
# Step 2: Run the integration tests inside the newly created VM and cleanup.
@@ -91,19 +57,21 @@ steps:
9157
set -e
9258
# Wait for the VM to be fully initialized and SSH to be ready.
9359
for i in {1..10}; do
94-
if gcloud compute ssh ${_VM_NAME} --zone=${_ZONE} --internal-ip --ssh-key-file=/workspace/.ssh/google_compute_engine --command="echo VM is ready"; then
60+
# Using --ssh-flag="-o StrictHostKeyChecking=no" forces gcloud into a different mode
61+
# and --quiet prevents interactive prompts that trigger profile checks.
62+
if gcloud compute ssh ${_VM_NAME} --zone=${_ZONE} --internal-ip --ssh-key-file=/workspace/.ssh/google_compute_engine --quiet --ssh-flag="-o StrictHostKeyChecking=no" --command="echo VM is ready"; then
9563
break
9664
fi
9765
echo "Waiting for VM to become available... (attempt $i/10)"
9866
sleep 15
9967
done
10068
# copy the script to the VM
101-
gcloud compute scp packages/google-cloud-storage/cloudbuild/run_zonal_tests.sh ${_VM_NAME}:~ --zone=${_ZONE} --internal-ip --ssh-key-file=/workspace/.ssh/google_compute_engine
69+
gcloud compute scp packages/google-cloud-storage/cloudbuild/run_zonal_tests.sh ${_VM_NAME}:~ --zone=${_ZONE} --internal-ip --ssh-key-file=/workspace/.ssh/google_compute_engine --quiet
10270
10371
# Execute the script on the VM via SSH.
10472
# Capture the exit code to ensure cleanup happens before the build fails.
10573
set +e
106-
gcloud compute ssh ${_VM_NAME} --zone=${_ZONE} --internal-ip --ssh-key-file=/workspace/.ssh/google_compute_engine --command="ulimit -n ${_ULIMIT}; COMMIT_SHA=${COMMIT_SHA} _ZONAL_BUCKET=${_ZONAL_BUCKET} CROSS_REGION_BUCKET=${_CROSS_REGION_BUCKET} _PR_NUMBER=${_PR_NUMBER} bash run_zonal_tests.sh"
74+
gcloud compute ssh ${_VM_NAME} --zone=${_ZONE} --internal-ip --ssh-key-file=/workspace/.ssh/google_compute_engine --command="ulimit -n ${_ULIMIT}; COMMIT_SHA=${COMMIT_SHA} _ZONAL_BUCKET=${_ZONAL_BUCKET} CROSS_REGION_BUCKET=${_CROSS_REGION_BUCKET} _PR_NUMBER=${_PR_NUMBER} bash run_zonal_tests.sh" --quiet
10775
EXIT_CODE=$?
10876
set -e
10977
@@ -115,19 +83,7 @@ steps:
11583
waitFor:
11684
- "create-vm"
11785
- "generate-ssh-key"
118-
- "cleanup-old-keys"
11986

120-
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
121-
id: "cleanup-ssh-key"
122-
entrypoint: "bash"
123-
args:
124-
- "-c"
125-
- |
126-
echo "--- Removing SSH key from OS Login profile to prevent accumulation ---"
127-
gcloud compute os-login ssh-keys remove \
128-
--key-file=/workspace/gcb_ssh_key.pub || true
129-
waitFor:
130-
- "run-tests-and-delete-vm"
13187

13288
timeout: "3600s" # 60 minutes
13389

0 commit comments

Comments
 (0)