From d797214322ee6490b9413833377f5ff23735b362 Mon Sep 17 00:00:00 2001 From: "Brad P. Crochet" Date: Mon, 7 Aug 2023 14:01:15 -0400 Subject: [PATCH] Add the ability to install operands Installs all operands from ALM examples. Fixes #17 Signed-off-by: Brad P. Crochet --- audits.yml | 2 ++ install.yml | 6 ++++++ operand_install.yml | 15 +++++++++++++++ operator_install.yml | 2 ++ requirements.txt | 1 + vars.yml.example | 1 + 6 files changed, 27 insertions(+) create mode 100644 operand_install.yml diff --git a/audits.yml b/audits.yml index c8c98e7..29682a6 100644 --- a/audits.yml +++ b/audits.yml @@ -37,6 +37,8 @@ list }}" - name: Execute operator_install.yml for each opernshift_sub_info ansible.builtin.include_tasks: operator_install.yml + vars: + install_operands: install_operands | default(false) loop: "{{ openshift_sub_info }}" loop_control: loop_var: manifest_data diff --git a/install.yml b/install.yml index 64ecdcb..93857ca 100644 --- a/install.yml +++ b/install.yml @@ -68,6 +68,12 @@ until: result.resources[0] is defined and result.resources[0].status.phase == "Succeeded" retries: 10 delay: 10 +- name: Install operands + ansible.builtin.include_tasks: operand_install.yml + vars: + csv: "{{ result.resources[0] }}" + namespace: "{{ full_namespace }}" + when: install_operands | default(false) - name: Run FIPS enabled tests ansible.builtin.include_tasks: fips_assessment.yml when: fips_assessment is defined and fips_assessment diff --git a/operand_install.yml b/operand_install.yml new file mode 100644 index 0000000..7ebda76 --- /dev/null +++ b/operand_install.yml @@ -0,0 +1,15 @@ +--- +- name: Extract ALM examples from CSV + ansible.builtin.set_fact: + alm_examples: "{{ csv.metadata.annotations['alm-examples'] }}" +- name: Print it out + ansible.builtin.debug: + var: alm_examples +- name: Install operands from ALM examples + kubernetes.core.k8s: + state: present + definition: "{{ alm_item }}" + namespace: "{{ namespace }}" + loop: "{{ alm_examples }}" + loop_control: + loop_var: alm_item diff --git a/operator_install.yml b/operator_install.yml index fadd34e..f90a3c5 100644 --- a/operator_install.yml +++ b/operator_install.yml @@ -13,4 +13,6 @@ namespace: "{{ manifest_data.packageName | replace('.', '-') | lower | truncate(40) }}" - name: Install Operator with each install type ansible.builtin.include_tasks: install.yml + vars: + install_operands: install_operands loop: "{{ install_modes }}" diff --git a/requirements.txt b/requirements.txt index 9c6d83f..a5a8950 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ ansible-lint==6.17.2 ansible-navigator==3.4.0 ansible-runner==2.3.2 kubernetes==26.1.0 + diff --git a/vars.yml.example b/vars.yml.example index 097586a..0923ef4 100644 --- a/vars.yml.example +++ b/vars.yml.example @@ -13,3 +13,4 @@ cleanup: true # 1. list only packages that have corresponding tests on packages var # 2. uncomment and set fips_assessment to true below # fips_assessment: true +install_operands: false