diff options
| author | Zuul <zuul@review.opendev.org> | 2025-10-10 11:46:33 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2025-10-10 11:46:33 +0000 |
| commit | 8c9bd4bb30d35d8173efdf20e2f7d1ee8d76acbc (patch) | |
| tree | caa3a4cb5365ba0de74c090ebb2f4d1146002904 | |
| parent | 91edb47dd849badf22c5444a5fdd4f6b44142417 (diff) | |
| parent | 45e7b9ec4435d334c5757a1e5a6352b9f342567e (diff) | |
| download | kolla-ansible-8c9bd4bb30d35d8173efdf20e2f7d1ee8d76acbc.tar.gz kolla-ansible-8c9bd4bb30d35d8173efdf20e2f7d1ee8d76acbc.zip | |
Merge "CI: Rework test/deploy/upgrade-bifrost.sh into Ansible roles"
| -rw-r--r-- | roles/kolla-ansible-deploy-bifrost/tasks/main.yml | 9 | ||||
| -rw-r--r-- | roles/kolla-ansible-test-bifrost/tasks/main.yml | 35 | ||||
| -rw-r--r-- | roles/kolla-ansible-upgrade-bifrost/tasks/main.yml | 8 | ||||
| -rwxr-xr-x | tests/deploy-bifrost.sh | 23 | ||||
| -rw-r--r-- | tests/run.yml | 32 | ||||
| -rwxr-xr-x | tests/test-bifrost.sh | 31 | ||||
| -rwxr-xr-x | tests/upgrade-bifrost.sh | 24 | ||||
| -rw-r--r-- | zuul.d/scenarios/bifrost.yaml | 2 |
8 files changed, 62 insertions, 102 deletions
diff --git a/roles/kolla-ansible-deploy-bifrost/tasks/main.yml b/roles/kolla-ansible-deploy-bifrost/tasks/main.yml new file mode 100644 index 000000000..5b510da40 --- /dev/null +++ b/roles/kolla-ansible-deploy-bifrost/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Deploy Bifrost + ansible.builtin.shell: + cmd: > + . {{ kolla_ansible_venv_path }}/bin/activate && + kolla-ansible deploy-bifrost + -i /etc/kolla/inventory + >/tmp/logs/ansible/deploy-bifrost 2>&1 + diff --git a/roles/kolla-ansible-test-bifrost/tasks/main.yml b/roles/kolla-ansible-test-bifrost/tasks/main.yml new file mode 100644 index 000000000..431aed584 --- /dev/null +++ b/roles/kolla-ansible-test-bifrost/tasks/main.yml @@ -0,0 +1,35 @@ +--- +- name: Check baremetal driver list + become: true + ansible.builtin.command: + cmd: > + {{ container_engine }} exec bifrost_deploy + bash -c 'OS_CLOUD=bifrost baremetal driver list' + register: bdl + until: bdl.rc == 0 + retries: 5 + delay: 10 + +- name: Check baremetal node list + become: true + ansible.builtin.command: + cmd: > + {{ container_engine }} exec bifrost_deploy + bash -c 'OS_CLOUD=bifrost baremetal node list' + +- name: Create baremetal node + become: true + ansible.builtin.command: + cmd: > + {{ container_engine }} exec bifrost_deploy + bash -c 'OS_CLOUD=bifrost baremetal node create + --driver redfish --name test-node' + +- name: Delete baremetal node + become: true + ansible.builtin.command: + cmd: > + {{ container_engine }} exec bifrost_deploy + bash -c 'OS_CLOUD=bifrost baremetal node delete + test-node' + diff --git a/roles/kolla-ansible-upgrade-bifrost/tasks/main.yml b/roles/kolla-ansible-upgrade-bifrost/tasks/main.yml new file mode 100644 index 000000000..ac8d11c1c --- /dev/null +++ b/roles/kolla-ansible-upgrade-bifrost/tasks/main.yml @@ -0,0 +1,8 @@ +--- +- name: Upgrade Bifrost + ansible.builtin.shell: + cmd: > + . {{ kolla_ansible_venv_path }}/bin/activate && + kolla-ansible deploy-bifrost + -i /etc/kolla/inventory + >/tmp/logs/ansible/upgrade-bifrost 2>&1 diff --git a/tests/deploy-bifrost.sh b/tests/deploy-bifrost.sh deleted file mode 100755 index b06a6d769..000000000 --- a/tests/deploy-bifrost.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o errexit - -# Enable unbuffered output for Ansible in Jenkins. -export PYTHONUNBUFFERED=1 - - -function deploy_bifrost { - RAW_INVENTORY=/etc/kolla/inventory - - source $KOLLA_ANSIBLE_VENV_PATH/bin/activate - - # TODO(mgoddard): run prechecks. - # Deploy the bifrost container. - # TODO(mgoddard): add pull action when we have a local registry service in - # CI. - kolla-ansible deploy-bifrost -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/deploy-bifrost -} - - -deploy_bifrost diff --git a/tests/run.yml b/tests/run.yml index cf34cde86..c0021de33 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -781,31 +781,17 @@ when: is_upgrade # Bifrost testing. - - block: - - name: Run deploy-bifrost.sh script - shell: - cmd: tests/deploy-bifrost.sh - executable: /bin/bash - chdir: "{{ kolla_ansible_src_dir }}" - environment: - KOLLA_ANSIBLE_VENV_PATH: "{{ kolla_ansible_venv_path }}" + - name: Bifrost testing + when: scenario == "bifrost" + block: + - import_role: + name: kolla-ansible-deploy-bifrost - - name: Run test-bifrost.sh script - shell: - cmd: tests/test-bifrost.sh - executable: /bin/bash - chdir: "{{ kolla_ansible_src_dir }}" - environment: - CONTAINER_ENGINE: "{{ container_engine }}" + - import_role: + name: kolla-ansible-test-bifrost - - name: Run upgrade-bifrost.sh script - shell: - cmd: tests/upgrade-bifrost.sh - executable: /bin/bash - chdir: "{{ kolla_ansible_src_dir }}" - environment: - KOLLA_ANSIBLE_VENV_PATH: "{{ kolla_ansible_venv_path }}" - when: scenario == "bifrost" + - import_role: + name: kolla-ansible-upgrade-bifrost # NOTE(yoctozepto): each host checks itself - hosts: all diff --git a/tests/test-bifrost.sh b/tests/test-bifrost.sh deleted file mode 100755 index b8017c026..000000000 --- a/tests/test-bifrost.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o errexit - -# Enable unbuffered output for Ansible in Jenkins. -export PYTHONUNBUFFERED=1 - - -function test_bifrost { - container_engine="${1:-docker}" - - # TODO(mgoddard): More testing, deploy bare metal nodes. - # TODO(mgoddard): Use openstackclient when clouds.yaml works. See - # https://bugs.launchpad.net/bifrost/+bug/1754070. - attempts=0 - while [[ $(sudo ${container_engine} exec bifrost_deploy bash -c "OS_CLOUD=bifrost baremetal driver list -f value" | wc -l) -eq 0 ]]; do - attempts=$((attempts + 1)) - if [[ $attempts -gt 6 ]]; then - echo "Timed out waiting for ironic conductor to become active" - exit 1 - fi - sleep 10 - done - sudo $container_engine exec bifrost_deploy bash -c "OS_CLOUD=bifrost baremetal node list" - sudo $container_engine exec bifrost_deploy bash -c "OS_CLOUD=bifrost baremetal node create --driver redfish --name test-node" - sudo $container_engine exec bifrost_deploy bash -c "OS_CLOUD=bifrost baremetal node delete test-node" -} - - -test_bifrost $1 diff --git a/tests/upgrade-bifrost.sh b/tests/upgrade-bifrost.sh deleted file mode 100755 index a5d5c3682..000000000 --- a/tests/upgrade-bifrost.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o errexit - -# Enable unbuffered output for Ansible in Jenkins. -export PYTHONUNBUFFERED=1 - - -function upgrade_bifrost { - RAW_INVENTORY=/etc/kolla/inventory - - source $KOLLA_ANSIBLE_VENV_PATH/bin/activate - - # TODO(mgoddard): run prechecks. - # TODO(mgoddard): add pull action when we have a local registry service in - # CI. - # TODO(mgoddard): make some configuration file changes and trigger a real - # upgrade. - kolla-ansible deploy-bifrost -i ${RAW_INVENTORY} -vvv &> /tmp/logs/ansible/upgrade-bifrost -} - - -upgrade_bifrost diff --git a/zuul.d/scenarios/bifrost.yaml b/zuul.d/scenarios/bifrost.yaml index fb7abbb2c..958c5a69c 100644 --- a/zuul.d/scenarios/bifrost.yaml +++ b/zuul.d/scenarios/bifrost.yaml @@ -6,7 +6,7 @@ files: !inherit - ^ansible/group_vars/all/bifrost.yml - ^ansible/roles/bifrost/ - - ^tests/test-bifrost.sh + - ^roles/kolla-ansible-(deploy|test|upgrade)-bifrost/ vars: scenario: bifrost scenario_images_core: |
