From dda17c6a83639544d1745d7042931b0fd7181536 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 18 Aug 2025 16:16:56 +0200 Subject: [PATCH 1/7] Remove us-central1-c zone from ansible playbooks This zone does not have support for Arm VMs, which is causing it to fail the entire workflow when we rollover to it. --- ansible/ci/group_vars/all.yml | 1 - ansible/dev/group_vars/all.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/ansible/ci/group_vars/all.yml b/ansible/ci/group_vars/all.yml index 02bb350a7c..52de5d9923 100644 --- a/ansible/ci/group_vars/all.yml +++ b/ansible/ci/group_vars/all.yml @@ -7,7 +7,6 @@ gcp_instance_prefix: ci gcp_available_zones: - us-central1-a - us-central1-b - - us-central1-c - us-central1-f ansible_user: runner gcp_network_name: collector-ci diff --git a/ansible/dev/group_vars/all.yml b/ansible/dev/group_vars/all.yml index 51d7910f71..057085fe47 100644 --- a/ansible/dev/group_vars/all.yml +++ b/ansible/dev/group_vars/all.yml @@ -8,7 +8,6 @@ gcp_instance_prefix: "{{ lookup('env', 'USER') }}-dev" gcp_available_zones: - us-central1-a - us-central1-b - - us-central1-c - us-central1-f ansible_user: "{{ lookup('env', 'USER') }}" gcp_network_name: default From db576c17a3aef3fddb29f078cba2153a7ff6ccc2 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 18 Aug 2025 16:17:55 +0200 Subject: [PATCH 2/7] Use break_when when looping zones in ansible This is a newer approach to break out of loops in ansible which is closer to what we originally intended. --- ansible/requirements.txt | 4 ++-- ansible/roles/create-vm/tasks/create-gcp-vm.yml | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ansible/requirements.txt b/ansible/requirements.txt index 501495a4fc..5d3786b6e6 100644 --- a/ansible/requirements.txt +++ b/ansible/requirements.txt @@ -1,7 +1,7 @@ # TODO: unpin if RHEL 8 VMs on GCP update their python interpreter to 3.7+ # https://github.com/ansible/ansible/blob/v2.17.0/changelogs/CHANGELOG-v2.17.rst#removed-features-previously-deprecated -ansible-core==2.16.10 -ansible==9.7.0 +ansible-core==2.18.7 +ansible==11.6.0 # TODO: unpin after https://github.com/docker/docker-py gets a release with # https://github.com/docker/docker-py/commit/7785ad913ddf2d86478f08278bb2c488d05a29ff requests==2.31.0 diff --git a/ansible/roles/create-vm/tasks/create-gcp-vm.yml b/ansible/roles/create-vm/tasks/create-gcp-vm.yml index 90d4582a5e..4a98144897 100644 --- a/ansible/roles/create-vm/tasks/create-gcp-vm.yml +++ b/ansible/roles/create-vm/tasks/create-gcp-vm.yml @@ -80,9 +80,8 @@ loop: "{{ vm_available_zones }}" loop_control: loop_var: gcp_zone + break_when: + - (instance_result | default({'changed': false})).changed register: instance_result when: > - (vm_arch == "amd64" or vm_arch == "arm64") and not condition and excluded == false - vars: - condition: "{{ (instance_result | default({'changed': false})).changed }}" - + (vm_arch == "amd64" or vm_arch == "arm64") and not excluded From 163dc8cf2fab12fae3ec7e95d689b9cd7dfc6c6f Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 18 Aug 2025 16:33:07 +0200 Subject: [PATCH 3/7] Ensure VM is removed on failure --- .../create-vm/tasks/create-gcp-instance.yml | 34 +++++++++++++++++++ .../roles/create-vm/tasks/create-gcp-vm.yml | 22 ++---------- 2 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 ansible/roles/create-vm/tasks/create-gcp-instance.yml diff --git a/ansible/roles/create-vm/tasks/create-gcp-instance.yml b/ansible/roles/create-vm/tasks/create-gcp-instance.yml new file mode 100644 index 0000000000..64d6dec5a8 --- /dev/null +++ b/ansible/roles/create-vm/tasks/create-gcp-instance.yml @@ -0,0 +1,34 @@ +--- +- name: Safely create GCP compute instance + block: + - name: Create compute instance + google.cloud.gcp_compute_instance: + name: "{{ vm_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_auth_kind }}" + service_account_file: "{{ gcp_service_account_file }}" + zone: "{{ gcp_zone }}" + machine_type: "{{ vm_machine_type | default('e2-standard-2') }}" + disks: + - auto_delete: true + boot: true + initialize_params: + disk_size_gb: "{{ vm_disk_size | default(20) }}" + source_image: "{{ gcp_source_image }}" + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + type: ONE_TO_ONE_NAT + labels: "{{ gcp_default_labels | combine(gcp_extra_labels) }}" + metadata: "{{ gcp_meta_data | default({}) }}" + register: instance_result + rescue: + - name: Remove failed GCP compute instance + google.cloud.gcp_compute_instance: + name: "{{ vm_name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_auth_kind }}" + service_account_file: "{{ gcp_service_account_file }}" + zone: "{{ gcp_zone }}" + state: absent diff --git a/ansible/roles/create-vm/tasks/create-gcp-vm.yml b/ansible/roles/create-vm/tasks/create-gcp-vm.yml index 4a98144897..c9a6cf15fa 100644 --- a/ansible/roles/create-vm/tasks/create-gcp-vm.yml +++ b/ansible/roles/create-vm/tasks/create-gcp-vm.yml @@ -51,26 +51,8 @@ register: network - name: Create GCP VM - google.cloud.gcp_compute_instance: - name: "{{ vm_name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_auth_kind }}" - service_account_file: "{{ gcp_service_account_file }}" - zone: "{{ gcp_zone }}" - machine_type: "{{ vm_machine_type | default('e2-standard-2') }}" - disks: - - auto_delete: true - boot: true - initialize_params: - disk_size_gb: "{{ vm_disk_size | default(20) }}" - source_image: "{{ gcp_source_image }}" - network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - type: ONE_TO_ONE_NAT - labels: "{{ gcp_default_labels | combine(gcp_extra_labels) }}" - metadata: "{{ gcp_meta_data | default({}) }}" + ansible.builtin.include_tasks: + file: create-gcp-instance.yml # This looks like a lot, and its mostly because ansible support # for "breaking" from a loop is not all that great at the moment. From b42cb489d9a05c56b1139f1ed7397d9a2bb4945e Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 18 Aug 2025 16:53:33 +0200 Subject: [PATCH 4/7] Update Python version in integration tests --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/integration-tests-vm-type.yml | 2 +- .github/workflows/k8s-integration-tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index c46fa027f9..81b25ceeb0 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.13" - name: Authenticate with GCP uses: 'google-github-actions/auth@v2' diff --git a/.github/workflows/integration-tests-vm-type.yml b/.github/workflows/integration-tests-vm-type.yml index 8615924c9b..7a423a277e 100644 --- a/.github/workflows/integration-tests-vm-type.yml +++ b/.github/workflows/integration-tests-vm-type.yml @@ -57,7 +57,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.13" - name: Authenticate with GCP uses: 'google-github-actions/auth@v2' diff --git a/.github/workflows/k8s-integration-tests.yml b/.github/workflows/k8s-integration-tests.yml index 15ad95ff58..c127a1c3ee 100644 --- a/.github/workflows/k8s-integration-tests.yml +++ b/.github/workflows/k8s-integration-tests.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.13" - name: Install dependencies run: | From 5c46d2c602a7f1e1709040dbe71d52c48f987003 Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 18 Aug 2025 17:42:52 +0200 Subject: [PATCH 5/7] Revert "Update Python version in integration tests" This reverts commit b42cb489d9a05c56b1139f1ed7397d9a2bb4945e. --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/integration-tests-vm-type.yml | 2 +- .github/workflows/k8s-integration-tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 81b25ceeb0..c46fa027f9 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.10" - name: Authenticate with GCP uses: 'google-github-actions/auth@v2' diff --git a/.github/workflows/integration-tests-vm-type.yml b/.github/workflows/integration-tests-vm-type.yml index 7a423a277e..8615924c9b 100644 --- a/.github/workflows/integration-tests-vm-type.yml +++ b/.github/workflows/integration-tests-vm-type.yml @@ -57,7 +57,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.10" - name: Authenticate with GCP uses: 'google-github-actions/auth@v2' diff --git a/.github/workflows/k8s-integration-tests.yml b/.github/workflows/k8s-integration-tests.yml index c127a1c3ee..15ad95ff58 100644 --- a/.github/workflows/k8s-integration-tests.yml +++ b/.github/workflows/k8s-integration-tests.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.10" - name: Install dependencies run: | From ad194a6d052dd41f34c477eb69c0d5537a81766d Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 18 Aug 2025 17:43:05 +0200 Subject: [PATCH 6/7] Revert "Use break_when when looping zones in ansible" This reverts commit db576c17a3aef3fddb29f078cba2153a7ff6ccc2. --- ansible/requirements.txt | 4 ++-- ansible/roles/create-vm/tasks/create-gcp-vm.yml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ansible/requirements.txt b/ansible/requirements.txt index 5d3786b6e6..501495a4fc 100644 --- a/ansible/requirements.txt +++ b/ansible/requirements.txt @@ -1,7 +1,7 @@ # TODO: unpin if RHEL 8 VMs on GCP update their python interpreter to 3.7+ # https://github.com/ansible/ansible/blob/v2.17.0/changelogs/CHANGELOG-v2.17.rst#removed-features-previously-deprecated -ansible-core==2.18.7 -ansible==11.6.0 +ansible-core==2.16.10 +ansible==9.7.0 # TODO: unpin after https://github.com/docker/docker-py gets a release with # https://github.com/docker/docker-py/commit/7785ad913ddf2d86478f08278bb2c488d05a29ff requests==2.31.0 diff --git a/ansible/roles/create-vm/tasks/create-gcp-vm.yml b/ansible/roles/create-vm/tasks/create-gcp-vm.yml index c9a6cf15fa..76ed1a527a 100644 --- a/ansible/roles/create-vm/tasks/create-gcp-vm.yml +++ b/ansible/roles/create-vm/tasks/create-gcp-vm.yml @@ -62,8 +62,9 @@ loop: "{{ vm_available_zones }}" loop_control: loop_var: gcp_zone - break_when: - - (instance_result | default({'changed': false})).changed register: instance_result when: > - (vm_arch == "amd64" or vm_arch == "arm64") and not excluded + (vm_arch == "amd64" or vm_arch == "arm64") and not condition and excluded == false + vars: + condition: "{{ (instance_result | default({'changed': false})).changed }}" + From 031a34782ea45804688116066c478fa37962f25a Mon Sep 17 00:00:00 2001 From: Mauro Ezequiel Moltrasio Date: Mon, 18 Aug 2025 17:53:14 +0200 Subject: [PATCH 7/7] Remove unneeded register --- ansible/roles/create-vm/tasks/create-gcp-vm.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ansible/roles/create-vm/tasks/create-gcp-vm.yml b/ansible/roles/create-vm/tasks/create-gcp-vm.yml index 76ed1a527a..e11cb87569 100644 --- a/ansible/roles/create-vm/tasks/create-gcp-vm.yml +++ b/ansible/roles/create-vm/tasks/create-gcp-vm.yml @@ -62,9 +62,7 @@ loop: "{{ vm_available_zones }}" loop_control: loop_var: gcp_zone - register: instance_result when: > (vm_arch == "amd64" or vm_arch == "arm64") and not condition and excluded == false vars: condition: "{{ (instance_result | default({'changed': false})).changed }}" -