Skip to content

Commit 41d64d5

Browse files
committed
wip
1 parent 810182a commit 41d64d5

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ substitutions:
88

99

1010
steps:
11-
# Step 0: Generate a persistent SSH key for this build run.
12-
# This prevents gcloud from adding a new key to the OS Login profile on every ssh/scp command.
13-
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
14-
id: "generate-ssh-key"
15-
entrypoint: "bash"
16-
args:
17-
- "-c"
18-
- |
19-
mkdir -p /workspace/.ssh
20-
# Generate the SSH key
21-
ssh-keygen -t rsa -f /workspace/.ssh/google_compute_engine -N '' -C gcb
22-
# Save the public key content to a file for the cleanup step
23-
cat /workspace/.ssh/google_compute_engine.pub > /workspace/gcb_ssh_key.pub
24-
waitFor: ["-"]
25-
2611
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
2712
id: "cleanup-old-keys"
2813
entrypoint: "bash"
@@ -57,6 +42,24 @@ steps:
5742
5843
echo "---------------------------------------------------------------------"
5944
echo "Cleanup complete."
45+
waitFor: ["-"]
46+
47+
# Step 0: Generate a persistent SSH key for this build run.
48+
# This prevents gcloud from adding a new key to the OS Login profile on every ssh/scp command.
49+
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
50+
id: "generate-ssh-key"
51+
entrypoint: "bash"
52+
args:
53+
- "-c"
54+
- |
55+
mkdir -p /workspace/.ssh
56+
# Generate the SSH key
57+
ssh-keygen -t rsa -f /workspace/.ssh/google_compute_engine -N '' -C gcb
58+
# Save the public key content to a file for the cleanup step
59+
cat /workspace/.ssh/google_compute_engine.pub > /workspace/gcb_ssh_key.pub
60+
# Register the key with OS Login
61+
gcloud compute os-login ssh-keys add --key-file=/workspace/.ssh/google_compute_engine.pub
62+
waitFor: ["cleanup-old-keys"]
6063

6164
# Step 1 Create a GCE VM to run the tests.
6265
# The VM is created in the same zone as the buckets to test rapid storage features.
@@ -77,7 +80,7 @@ steps:
7780
- "--service-account=${_ZONAL_VM_SERVICE_ACCOUNT}"
7881
- "--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"
7982
- "--metadata=enable-oslogin=TRUE"
80-
waitFor: ["-"]
83+
waitFor: ["cleanup-old-keys"]
8184

8285
# Step 2: Run the integration tests inside the newly created VM and cleanup.
8386
# This step uses 'gcloud compute ssh' to execute a remote script.
@@ -115,7 +118,6 @@ steps:
115118
waitFor:
116119
- "create-vm"
117120
- "generate-ssh-key"
118-
- "cleanup-old-keys"
119121

120122
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
121123
id: "cleanup-ssh-key"

0 commit comments

Comments
 (0)