From 5bf1b35cb4bff5e2207bc408adff3604f5e3516f Mon Sep 17 00:00:00 2001 From: Ridwan Sharif Date: Wed, 19 Jun 2024 20:57:58 +0000 Subject: [PATCH 1/2] github: update workflow to use test project and updated workflows The presubmits were broken because it pointed to `master` which no longer exists. It is now `main`. See https://github.com/google-github-actions/setup-gcloud Upon fixing it, I discovered a few broken things that I also started fixing in this PR. --- .github/workflows/linux.yml | 11 ++++++----- .github/workflows/windows.yml | 11 ++++++----- test/packer/build.sh | 2 +- test/terraform/main.tf | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 1c5dd58..05e2197 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -52,12 +52,13 @@ jobs: PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} - - name: Install Gcloud SDK - uses: google-github-actions/setup-gcloud@master + - name: Authenticate using ServiceAccount + uses: 'google-github-actions/auth@v2' with: - project_id: ${{ secrets.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SA_KEY }} - export_default_credentials: true + credentials_json: '${{ secrets.GCP_SA_KEY }}' + + - name: Set up Cloud SDK + uses: 'google-github-actions/setup-gcloud@v2' - name: Deploy instance run: ../../.github/scripts/terraform-apply.sh ${{ matrix.distro }} ${{ matrix.agent_type }} ${{ matrix.version }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 70f73e2..c81b5ff 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -32,12 +32,13 @@ jobs: PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} - - name: Install Gcloud SDK - uses: google-github-actions/setup-gcloud@master + - name: Authenticate using ServiceAccount + uses: 'google-github-actions/auth@v2' with: - project_id: ${{ secrets.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SA_KEY }} - export_default_credentials: true + credentials_json: '${{ secrets.GCP_SA_KEY }}' + + - name: Set up Cloud SDK + uses: 'google-github-actions/setup-gcloud@v2' - name: Deploy instance run: ../../.github/scripts/terraform-apply.sh ${{ matrix.distro }} ${{ matrix.agent_type }} ${{ matrix.version }} diff --git a/test/packer/build.sh b/test/packer/build.sh index b24e582..99bfa3d 100755 --- a/test/packer/build.sh +++ b/test/packer/build.sh @@ -22,7 +22,7 @@ cat <packer.json "image_family": "puppet-${image_family}", "source_image_family": "${image_family}", "type": "googlecompute", - "project_id": "united-aura-313415", + "project_id": "stackdriver-test-143416", "ssh_username": "packer", "zone": "us-east1-b", "startup_script_file": "bootstrap.sh", diff --git a/test/terraform/main.tf b/test/terraform/main.tf index 8bf20e1..825696b 100644 --- a/test/terraform/main.tf +++ b/test/terraform/main.tf @@ -13,7 +13,7 @@ # limitations under the License. variable "project" { - default = "united-aura-313415" + default = "stackdriver-test-143416" } variable "preemptible" { From 977cfb492e1922fac1013f62ed78a4d648baaa86 Mon Sep 17 00:00:00 2001 From: Ridwan Sharif Date: Thu, 20 Jun 2024 18:33:48 -0400 Subject: [PATCH 2/2] packer: use pinned google sdk version --- test/packer/bootstrap.sh | 5 +++-- test/packer/build.sh | 1 + test/terraform/instance/instance.tf | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/packer/bootstrap.sh b/test/packer/bootstrap.sh index dbd9933..1b24d50 100644 --- a/test/packer/bootstrap.sh +++ b/test/packer/bootstrap.sh @@ -107,8 +107,9 @@ install_puppet() { install_gcloud() { if ! command -v COMMAND &> /dev/null then - curl https://sdk.cloud.google.com > install.sh - bash install.sh --disable-prompts + curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-481.0.0-linux-x86_64.tar.gz + tar -xzf google-cloud-cli-481.0.0-linux-x86_64.tar.gz + bash google-cloud-sdk/install.sh --quiet fi } diff --git a/test/packer/build.sh b/test/packer/build.sh index 99bfa3d..3be6007 100755 --- a/test/packer/build.sh +++ b/test/packer/build.sh @@ -26,6 +26,7 @@ cat <packer.json "ssh_username": "packer", "zone": "us-east1-b", "startup_script_file": "bootstrap.sh", + "wait_to_add_ssh_keys": "20s", "scopes": [ "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/compute", diff --git a/test/terraform/instance/instance.tf b/test/terraform/instance/instance.tf index fadbb6a..e0c8b85 100644 --- a/test/terraform/instance/instance.tf +++ b/test/terraform/instance/instance.tf @@ -66,6 +66,7 @@ resource "google_compute_instance" "instance" { metadata = { used_by = "github-actions" + enable_oslogin = "false" workspace = terraform.workspace ssh-keys = "ci:${file(var.ssh_public_key)}" }