|
| 1 | +--- |
| 2 | +- name: Run ci_framework bootstrap playbook |
| 3 | + ansible.builtin.import_playbook: "../../../playbooks/01-bootstrap.yml" |
| 4 | + |
| 5 | +- hosts: "{{ cifmw_target_host | default('localhost') }}" |
| 6 | + name: Install dev tools |
| 7 | + tasks: |
| 8 | + - name: Assert that operator_name is set |
| 9 | + ansible.builtin.assert: |
| 10 | + that: |
| 11 | + - operator_name is defined |
| 12 | + |
| 13 | + - name: Download install_yamls deps |
| 14 | + ansible.builtin.include_role: |
| 15 | + name: 'install_yamls_makes' |
| 16 | + tasks_from: 'make_download_tools' |
| 17 | + |
| 18 | +- name: Run ci_framework infra playbook |
| 19 | + ansible.builtin.import_playbook: "../../../playbooks/02-infra.yml" |
| 20 | + |
| 21 | +- name: Build dataset hook |
| 22 | + hosts: "{{ cifmw_target_host | default('localhost') }}" |
| 23 | + gather_facts: false |
| 24 | + connection: local |
| 25 | + tasks: |
| 26 | + - name: Load parameters |
| 27 | + ansible.builtin.include_vars: |
| 28 | + dir: "{{ item }}" |
| 29 | + loop: |
| 30 | + - "{{ cifmw_basedir }}/artifacts/parameters" |
| 31 | + - "/etc/ci/env" |
| 32 | + loop_control: |
| 33 | + label: "{{ item }}" |
| 34 | + |
| 35 | + - name: Ensure that the isolated net was configured for crc |
| 36 | + ansible.builtin.assert: |
| 37 | + that: |
| 38 | + - crc_ci_bootstrap_networks_out is defined |
| 39 | + - "'crc' in crc_ci_bootstrap_networks_out" |
| 40 | + - "'default' in crc_ci_bootstrap_networks_out['crc']" |
| 41 | + |
| 42 | + - name: Set facts for further usage within the framework |
| 43 | + ansible.builtin.set_fact: |
| 44 | + cifmw_edpm_prepare_extra_vars: |
| 45 | + NNCP_INTERFACE: "{{ crc_ci_bootstrap_networks_out.crc.default.iface }}" |
| 46 | + NETWORK_MTU: "{{ crc_ci_bootstrap_networks_out.crc.default.mtu }}" |
| 47 | + |
| 48 | +- hosts: "{{ cifmw_target_host | default('localhost') }}" |
| 49 | + name: Deploy Openstack Operators |
| 50 | + tasks: |
| 51 | + |
| 52 | + - name: Use the locally built operators if any |
| 53 | + ansible.builtin.set_fact: |
| 54 | + _local_operators_indexes: >- |
| 55 | + {{ |
| 56 | + _local_operators_indexes|default({}) | |
| 57 | + combine({ item.key.split('-')[0]|upper+'_IMG': |
| 58 | + cifmw_operator_build_output['operators'][item.key].image_catalog}) |
| 59 | + }} |
| 60 | + loop: "{{ cifmw_operator_build_output['operators'] | dict2items }}" |
| 61 | + when: |
| 62 | + - cifmw_operator_build_output is defined |
| 63 | + - "'operators' in cifmw_operator_build_output" |
| 64 | + |
| 65 | + - name: Set install_yamls Makefile environment variables |
| 66 | + vars: |
| 67 | + operators_build_output: "{{ (cifmw_operator_build_output | default({'operators':{}})).operators }}" |
| 68 | + _openstack_operator_images: |
| 69 | + OPENSTACK_IMG: "{{ cifmw_operator_build_output.operators['openstack-operator']['image_catalog'] | default(omit) }}" |
| 70 | + OPENSTACK_BUNDLE_IMG: "{{ cifmw_operator_build_output.operators['openstack-operator']['image_bundle'] | default(omit) }}" |
| 71 | + ansible.builtin.set_fact: |
| 72 | + cifmw_edpm_prepare_common_env: >- |
| 73 | + {{ |
| 74 | + cifmw_install_yamls_environment | |
| 75 | + combine({'PATH': cifmw_path}) | |
| 76 | + combine(cifmw_edpm_prepare_extra_vars | default({})) |
| 77 | + }} |
| 78 | + cifmw_edpm_prepare_operators_build_output: "{{ operators_build_output }}" |
| 79 | + cifmw_edpm_prepare_make_openstack_env: "{{ _local_operators_indexes | combine(_openstack_operator_images) }}" |
| 80 | + |
| 81 | + - name: Deploy openstack Operators |
| 82 | + environment: |
| 83 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 84 | + PATH: "{{ cifmw_path | default(ansible_env.PATH) }}" |
| 85 | + block: |
| 86 | + - name: detect if openstack operator is installed |
| 87 | + ansible.builtin.command: |
| 88 | + cmd: "oc get sub --ignore-not-found=true -n openstack-operators -o name openstack-operator" |
| 89 | + ignore_errors: true |
| 90 | + register: openstack_operator_subscription |
| 91 | + |
| 92 | + - name: Install openstack operator |
| 93 | + when: openstack_operator_subscription.stdout == "" |
| 94 | + vars: |
| 95 | + make_openstack_env: "{{ cifmw_edpm_prepare_common_env | |
| 96 | + combine(cifmw_edpm_prepare_make_openstack_env) }}" |
| 97 | + make_openstack_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" |
| 98 | + ansible.builtin.include_role: |
| 99 | + name: 'install_yamls_makes' |
| 100 | + tasks_from: 'make_openstack' |
| 101 | + |
| 102 | + - name: Wait for OpenStack subscription creation |
| 103 | + when: openstack_operator_subscription.stdout == "" |
| 104 | + ansible.builtin.command: |
| 105 | + cmd: >- |
| 106 | + oc get sub openstack-operator |
| 107 | + --namespace=openstack-operators |
| 108 | + -o=jsonpath='{.status.installplan.name}' |
| 109 | + register: cifmw_edpm_prepare_wait_installplan_out |
| 110 | + until: cifmw_edpm_prepare_wait_installplan_out.rc == 0 and cifmw_edpm_prepare_wait_installplan_out.stdout != "" |
| 111 | + retries: 30 |
| 112 | + delay: 10 |
| 113 | + |
| 114 | + - name: Wait for OpenStack operator to get installed |
| 115 | + when: openstack_operator_subscription.stdout == "" |
| 116 | + ansible.builtin.command: |
| 117 | + cmd: >- |
| 118 | + oc wait InstallPlan {{ cifmw_edpm_prepare_wait_installplan_out.stdout }} |
| 119 | + --namespace=openstack-operators |
| 120 | + --for=jsonpath='{.status.phase}'=Complete --timeout=20m |
| 121 | +
|
| 122 | + - name: install kuttl test_suite dependencies |
| 123 | + vars: |
| 124 | + project_name: "github.com/openstack-k8s-operators/{{ operator_name }}" |
| 125 | + operator_basedir: >- |
| 126 | + {{ |
| 127 | + zuul.projects[project_name].src_dir |
| 128 | + }} |
| 129 | + ansible.builtin.command: |
| 130 | + cmd: make kuttl-test-prep |
| 131 | + chdir: "{{ ansible_user_dir }}/{{ operator_basedir }}" |
| 132 | + register: result |
| 133 | + until: result.rc == 0 |
| 134 | + retries: 3 |
| 135 | + delay: 10 |
| 136 | + changed_when: true |
0 commit comments