From fd154d9c6dd3b51014d55f5437efc3a863154583 Mon Sep 17 00:00:00 2001 From: jgilaber Date: Wed, 29 May 2024 15:42:15 +0200 Subject: [PATCH] [WIP] Prepare crc job for architecture repo --- ci/playbooks/run-architecture-crc.yml | 98 ++++++++++++++++++++++++ scenarios/reproducers/va-hci-base.yml | 17 ++++ scenarios/reproducers/va-hci-reduced.yml | 8 ++ scenarios/reproducers/va-hci.yml | 18 +---- zuul.d/architecture-jobs.yaml | 24 ++++++ zuul.d/projects.yaml | 1 + 6 files changed, 149 insertions(+), 17 deletions(-) create mode 100644 ci/playbooks/run-architecture-crc.yml create mode 100644 scenarios/reproducers/va-hci-base.yml create mode 100644 scenarios/reproducers/va-hci-reduced.yml diff --git a/ci/playbooks/run-architecture-crc.yml b/ci/playbooks/run-architecture-crc.yml new file mode 100644 index 0000000000..bb62c315bc --- /dev/null +++ b/ci/playbooks/run-architecture-crc.yml @@ -0,0 +1,98 @@ +--- +# Usage and expected parameters +# $ ansible-playbook run-architecture.yml \ +# -e cifmw_architecture_repo=$HOME/architecture \ +# -e cifmw_architecture_scenario=hci \ +# -e cifmw_networking_mapper_networking_env_def_path=$HOME/net-env.yml +# [any other parameter/files your VA/DT might need] +# +# cifmw_architecture_repo: location of the architecture repository. +# cifmw_architecture_scenario: the scenario you want to test. +# cifmw_networking_mapper_networking_env_def_path: path to the +# networking-mapper environment definition file. +# +# Special parameters set in the playbook (you can override them) +# cifmw_basedir: defaults to ~/ci-framework-data +# cifmw_zuul_target_host: target host. Defaults to localhost + +- name: Test architecture automations + hosts: "{{ cifmw_zuul_target_host | default('controller') }}" + gather_facts: true + vars: + _homedir: "{{ ansible_user_dir | default(lookup('env', 'HOME')) }}" + cifmw_basedir: >- + {{ + (_homedir, + 'ci-framework-data') | + path_join + }} + cifmw_path: >- + {{ + ['~/bin', + ansible_env.PATH] | join(':') + }} + pre_tasks: + # This allows to create a custom scenario file that would + # just override some parts of an existing one. + # For example, you create a DT based on the va-hci.yml. + # You will then just add + # `cifmw_parent_scenario: scenarios/reproducers/va-hci.yml` + # in the file, and override/extend the scenario to match your + # needs. + # The parameter also supports a list of files if needed. + # + # File path are relative to the root of the ci-framework repository. + - name: Inherit from parent parameter file if instructed + vars: + _file_list: >- + {% if cifmw_parent_scenario is defined and + cifmw_parent_scenario is string -%} + {{ [cifmw_parent_scenario] }} + {% elif cifmw_parent_scenario is defined and + cifmw_parent_scenario is not string and + cifmw_parent_scenario is iterable -%} + {{ cifmw_parent_scenario }} + {% else %} + {{ [] }} + {% endif %} + when: + - item is exists + ansible.builtin.include_vars: + file: "{{ item }}" + loop: "{{ _file_list }}" + + - name: Assert we have the bare minimum to run + ansible.builtin.assert: + quiet: true + that: + - cifmw_architecture_repo is defined + - cifmw_architecture_scenario is defined + - cifmw_networking_mapper_networking_env_def_path is defined + + - name: Deploy basic dependencies + ansible.builtin.import_role: + name: 'ci_setup' + + - name: Create needed directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: "0755" + loop: + - "{{ cifmw_basedir }}/logs" + - "{{ cifmw_basedir }}/artifacts" + tasks: + - name: Load networking mapper environment + ansible.builtin.import_role: + name: "networking_mapper" + tasks_from: "load_env_definition.yml" + +- name: Run reproducer to deploy VA + ansible.builtin.import_playbook: >- + {{ + [ + ansible_user_dir, + zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir, + 'reproducer.yml' + ] | ansible.builtin.path_join + }} diff --git a/scenarios/reproducers/va-hci-base.yml b/scenarios/reproducers/va-hci-base.yml new file mode 100644 index 0000000000..bb23b50972 --- /dev/null +++ b/scenarios/reproducers/va-hci-base.yml @@ -0,0 +1,17 @@ +--- +cifmw_architecture_scenario: hci + +# Automation section. Most of those parameters will be passed to the +# controller-0 as-is and be consumed by the `deploy-va.sh` script. +# Please note, all paths are on the controller-0, meaning managed by the +# Framework. Please do not edit them! +_arch_repo: "/home/zuul/src/github.com/openstack-k8s-operators/architecture" +cifmw_ceph_client_vars: /tmp/ceph_client.yml +cifmw_ceph_client_values_post_ceph_path_src: >- + {{ _arch_repo }}/examples/va/hci/values.yaml +cifmw_ceph_client_values_post_ceph_path_dst: >- + {{ cifmw_ceph_client_values_post_ceph_path_src }} +cifmw_ceph_client_service_values_post_ceph_path_src: >- + {{ _arch_repo }}/examples/va/hci/service-values.yaml +cifmw_ceph_client_service_values_post_ceph_path_dst: >- + {{ cifmw_ceph_client_service_values_post_ceph_path_src }} diff --git a/scenarios/reproducers/va-hci-reduced.yml b/scenarios/reproducers/va-hci-reduced.yml new file mode 100644 index 0000000000..e11975554d --- /dev/null +++ b/scenarios/reproducers/va-hci-reduced.yml @@ -0,0 +1,8 @@ +--- +cifmw_parent_scenario: "scenarios/reproducers/va-hci-base.yml" + +# Test Ceph file and object storage (block is enabled by default) +cifmw_ceph_daemons_layout: + rgw_enabled: true + dashboard_enabled: false + cephfs_enabled: true diff --git a/scenarios/reproducers/va-hci.yml b/scenarios/reproducers/va-hci.yml index 9b79741e2d..c0ade2591a 100644 --- a/scenarios/reproducers/va-hci.yml +++ b/scenarios/reproducers/va-hci.yml @@ -1,21 +1,5 @@ --- -cifmw_architecture_scenario: hci - -# Automation section. Most of those parameters will be passed to the -# controller-0 as-is and be consumed by the `deploy-va.sh` script. -# Please note, all paths are on the controller-0, meaning managed by the -# Framework. Please do not edit them! -_arch_repo: "/home/zuul/src/github.com/openstack-k8s-operators/architecture" -cifmw_ceph_client_vars: /tmp/ceph_client.yml -cifmw_ceph_client_values_post_ceph_path_src: >- - {{ _arch_repo }}/examples/va/hci/values.yaml -cifmw_ceph_client_values_post_ceph_path_dst: >- - {{ cifmw_ceph_client_values_post_ceph_path_src }} -cifmw_ceph_client_service_values_post_ceph_path_src: >- - {{ _arch_repo }}/examples/va/hci/service-values.yaml -cifmw_ceph_client_service_values_post_ceph_path_dst: >- - {{ cifmw_ceph_client_service_values_post_ceph_path_src }} - +cifmw_parent_scenario: "scenarios/reproducers/va-hci-base.yml" # HERE if you want to overload kustomization, you can uncomment this parameter # and push the data structure you want to apply. # cifmw_architecture_user_kustomize: diff --git a/zuul.d/architecture-jobs.yaml b/zuul.d/architecture-jobs.yaml index 401284c7c7..e134bb11e3 100644 --- a/zuul.d/architecture-jobs.yaml +++ b/zuul.d/architecture-jobs.yaml @@ -36,3 +36,27 @@ - zuul.d/architecture-jobs.yaml - ^roles/ci_gen_kustomize_values/(?!meta|README).* - ^roles/kustomize_deploy/(?!meta|README).* + +- job: + name: cifmw-architecture-crc-base + parent: cifmw-architecture-validate-base + nodeset: centos-9-medium-3x-centos-9-crc-extracted-2-30-0-xxl + vars: + cifmw_libvirt_manager_pub_net: public + cifmw_use_devscripts: false + cifmw_use_uefi: true + cifmw_root_partition_id: 4 + cifmw_libvirt_manager_compute_amount: 3 + cifmw_libvirt_manager_compute_cpus: 4 + cifmw_openshift_setup_skip_internal_registry_tls_verify: true + cifmw_deploy_architecture: true + run: + - ci/playbooks/run-architecture-crc.yml + +- job: + name: cifmw-architecture-crc-hci + parent: cifmw-architecture-crc-base + vars: + cifmw_architecture_scenario: va-hci-reduced + files: + - ci/playbooks/run-architecture-crc.yml diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 37b98855b5..1da377219a 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -2,6 +2,7 @@ github-check: jobs: - noop + - cifmw-architecture-crc-hci - cifmw-pod-ansible-test - cifmw-pod-k8s-snippets-source - cifmw-pod-pre-commit