-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3416 from RachaelSTamakloe/ansible-os-test
Adding integration test for ansible OS coverage
- Loading branch information
Showing
5 changed files
with
208 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tools/cloud-build/daily-tests/ansible_playbooks/test-validation/test-ansible-vm.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
- name: Check if Ansible is installed | ||
ansible.builtin.shell: | | ||
command -v ansible >/dev/null 2>&1 && echo "Ansible is installed" || echo "Ansible is not installed" | ||
register: ansible_check_result | ||
|
||
- name: Assert Ansible is installed | ||
ansible.builtin.assert: | ||
that: | ||
- ansible_check_result.stdout == "Ansible is installed" |
115 changes: 115 additions & 0 deletions
115
tools/cloud-build/daily-tests/blueprints/ansible-vm.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
|
||
blueprint_name: test-workstation-ansible | ||
|
||
vars: | ||
project_id: ## Set GCP Project ID Here ## | ||
deployment_name: test-workstation-ansible | ||
region: us-central1 | ||
zone: us-central1-a | ||
machine_type: n2-standard-2 | ||
disk_type: pd-ssd | ||
instance_count: 1 | ||
|
||
deployment_groups: | ||
- group: primary | ||
modules: | ||
|
||
- id: network1 | ||
source: modules/network/pre-existing-vpc | ||
|
||
- id: startup-script | ||
source: modules/scripts/startup-script | ||
settings: | ||
install_ansible: true | ||
runners: | ||
- type: shell | ||
destination: startup.sh | ||
content: | | ||
#!/bin/bash | ||
set -ex | ||
echo \$(ansible --version) | ||
- id: workstation-centos | ||
source: modules/compute/vm-instance | ||
use: | ||
- network1 | ||
- startup-script | ||
settings: | ||
name_prefix: centos | ||
add_deployment_name_before_prefix: true | ||
instance_image: | ||
name: centos-7-v20240611 | ||
project: centos-cloud | ||
|
||
- id: workstation-ubuntu-2004 | ||
source: modules/compute/vm-instance | ||
use: | ||
- network1 | ||
- startup-script | ||
settings: | ||
name_prefix: ubuntu2004 | ||
add_deployment_name_before_prefix: true | ||
instance_image: | ||
family: ubuntu-2004-lts | ||
project: ubuntu-os-cloud | ||
|
||
- id: workstation-ubuntu-2204 | ||
source: modules/compute/vm-instance | ||
use: | ||
- network1 | ||
- startup-script | ||
settings: | ||
name_prefix: ubuntu2204 | ||
add_deployment_name_before_prefix: true | ||
instance_image: | ||
family: ubuntu-2204-lts | ||
project: ubuntu-os-cloud | ||
|
||
- id: workstation-debian | ||
source: modules/compute/vm-instance | ||
use: | ||
- network1 | ||
- startup-script | ||
settings: | ||
name_prefix: debian | ||
instance_image: | ||
family: debian-11 | ||
project: debian-cloud | ||
|
||
- id: workstation-rocky-8 | ||
source: modules/compute/vm-instance | ||
use: | ||
- network1 | ||
- startup-script | ||
settings: | ||
name_prefix: rocky8 | ||
add_deployment_name_before_prefix: true | ||
instance_image: | ||
family: rocky-linux-8-optimized-gcp | ||
project: rocky-linux-cloud | ||
|
||
- id: wait-for-startup | ||
source: community/modules/scripts/wait-for-startup | ||
settings: | ||
instance_names: | ||
- $(workstation-centos.name[0]) | ||
- $(workstation-ubuntu-2004.name[0]) | ||
- $(workstation-ubuntu-2204.name[0]) | ||
- $(workstation-debian.name[0]) | ||
- $(workstation-rocky-8.name[0]) | ||
timeout: 7200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
tags: | ||
- m.pre-existing-vpc | ||
- m.startup-script | ||
- m.vm-instance | ||
- m.wait-for-startup | ||
- vm | ||
|
||
timeout: 14400s # 4hr | ||
steps: | ||
- id: anisble-vm | ||
name: us-central1-docker.pkg.dev/$PROJECT_ID/hpc-toolkit-repo/test-runner | ||
entrypoint: /bin/bash | ||
env: | ||
- "ANSIBLE_HOST_KEY_CHECKING=false" | ||
- "ANSIBLE_CONFIG=/workspace/tools/cloud-build/ansible.cfg" | ||
args: | ||
- -c | ||
- | | ||
set -x -e | ||
cd /workspace && make | ||
BUILD_ID_FULL=$BUILD_ID | ||
BUILD_ID_SHORT=$${BUILD_ID_FULL:0:6} | ||
ansible-playbook tools/cloud-build/daily-tests/ansible_playbooks/base-integration-test.yml \ | ||
--user=sa_106486320838376751393 --extra-vars="project=${PROJECT_ID} build=$${BUILD_ID_SHORT}" \ | ||
--extra-vars="@tools/cloud-build/daily-tests/tests/ansible-vm.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- | ||
|
||
test_name: test-workstation-ansible | ||
deployment_name: "ansible-vm-{{ build }}" | ||
zone: us-central1-a | ||
workspace: /workspace | ||
blueprint_yaml: "{{ workspace }}/tools/cloud-build/daily-tests/blueprints/ansible-vm.yaml" | ||
network: "default" | ||
remote_node: "{{ deployment_name }}-centos-0" | ||
post_deploy_tests: | ||
- test-validation/test-ansible-vm.yml |