From 369a2dba2ca26fc96e930682cb4143f637cfd8e5 Mon Sep 17 00:00:00 2001 From: Pablo Rodriguez Nava Date: Wed, 24 May 2023 05:54:28 -0400 Subject: [PATCH] Make OUT variable of install_yamls a global default --- ci_framework/roles/edpm_deploy/tasks/main.yml | 1 - .../molecule/default/converge.yml | 1 + .../roles/edpm_prepare/tasks/main.yml | 25 ++++++++++--------- .../roles/install_yamls/defaults/main.yml | 4 ++- .../roles/install_yamls/tasks/main.yml | 14 ++++++----- scenarios/centos-9/ci.yml | 2 +- scenarios/centos-9/edpm_ci.yml | 5 +--- scenarios/centos-9/kuttl.yml | 3 +-- scenarios/centos-9/local-env.yml | 5 ++-- 9 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ci_framework/roles/edpm_deploy/tasks/main.yml b/ci_framework/roles/edpm_deploy/tasks/main.yml index 862cb01c..ecdbe93f 100644 --- a/ci_framework/roles/edpm_deploy/tasks/main.yml +++ b/ci_framework/roles/edpm_deploy/tasks/main.yml @@ -17,7 +17,6 @@ - name: Set EDPM related vars ansible.builtin.set_fact: cifmw_edpm_deploy_env: | - OUT: "{{ cifmw_edpm_deploy_manifests_dir }}" PATH: "{{ cifmw_path }}" cacheable: true diff --git a/ci_framework/roles/edpm_prepare/molecule/default/converge.yml b/ci_framework/roles/edpm_prepare/molecule/default/converge.yml index 593e7f87..efa20b0c 100644 --- a/ci_framework/roles/edpm_prepare/molecule/default/converge.yml +++ b/ci_framework/roles/edpm_prepare/molecule/default/converge.yml @@ -18,6 +18,7 @@ - name: Converge hosts: all vars: + cifmw_path: "{{ ansible_user_dir }}/.crc/bin:{{ ansible_user_dir }}/.crc/bin/oc:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}" cifmw_use_crc: true cifmw_operator_build_meta_name: openstack cifmw_edpm_prepare_dry_run: true diff --git a/ci_framework/roles/edpm_prepare/tasks/main.yml b/ci_framework/roles/edpm_prepare/tasks/main.yml index ae6a65a9..5c2355fa 100644 --- a/ci_framework/roles/edpm_prepare/tasks/main.yml +++ b/ci_framework/roles/edpm_prepare/tasks/main.yml @@ -1,20 +1,9 @@ -- name: Prepare storage in CRC - vars: - make_crc_storage_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" - when: - - cifmw_use_crc is defined - - cifmw_use_crc | bool - - not cifmw_edpm_prepare_skip_crc_storage_creation | bool - ansible.builtin.include_role: - name: 'install_yamls_makes' - tasks_from: 'make_crc_storage' - - name: Set install_yamls Makefile environment variables vars: operators_build_output: "{{ (cifmw_operator_build_output | default({'operators':{}})).operators }}" ansible.builtin.set_fact: cifmw_edpm_prepare_common_env: - OUT: "{{ cifmw_edpm_prepare_manifests_dir }}" + PATH: "{{ cifmw_path }}" cifmw_edpm_prepare_make_openstack_env: | {% if cifmw_operator_build_meta_name is defined and cifmw_operator_build_meta_name in operators_build_output %} OPENSTACK_IMG: {{ operators_build_output[cifmw_operator_build_meta_name].image_catalog }} @@ -27,6 +16,18 @@ {% endif %} cifmw_edpm_prepare_operators_build_output: "{{ operators_build_output }}" +- name: Prepare storage in CRC + vars: + make_crc_storage_env: "{{ cifmw_edpm_prepare_common_env }}" + make_crc_storage_dryrun: "{{ cifmw_edpm_prepare_dry_run }}" + when: + - cifmw_use_crc is defined + - cifmw_use_crc | bool + - not cifmw_edpm_prepare_skip_crc_storage_creation | bool + ansible.builtin.include_role: + name: 'install_yamls_makes' + tasks_from: 'make_crc_storage' + - name: Get internal OpenShift registry route ansible.builtin.command: cmd: "oc get route default-route -n openshift-image-registry -o jsonpath='{.spec.host}'" diff --git a/ci_framework/roles/install_yamls/defaults/main.yml b/ci_framework/roles/install_yamls/defaults/main.yml index 2114543d..b2cfdf20 100644 --- a/ci_framework/roles/install_yamls/defaults/main.yml +++ b/ci_framework/roles/install_yamls/defaults/main.yml @@ -18,7 +18,9 @@ # All variables intended for modification should be placed in this file. # All variables within this role should have a prefix of "cifmw_install_yamls" cifmw_install_yamls_envfile: "install_yamls.sh" -cifmw_install_yamls_out_dir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework') }}/artifacts" +cifmw_install_yamls_out_dir_basedir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework') }}" +cifmw_install_yamls_out_dir: "{{ cifmw_install_yamls_out_dir_basedir }}/artifacts" +cifmw_install_yamls_manifests_dir: "{{ cifmw_manifests | default(cifmw_install_yamls_out_dir_basedir ~ '/artifacts/manifests') }}" # A list of Install_yamls makefile vars that needs to be exported # cifmw_install_yamls_vars: # MICROSHIFT: 1 diff --git a/ci_framework/roles/install_yamls/tasks/main.yml b/ci_framework/roles/install_yamls/tasks/main.yml index 54dd9c62..317ba51a 100644 --- a/ci_framework/roles/install_yamls/tasks/main.yml +++ b/ci_framework/roles/install_yamls/tasks/main.yml @@ -44,14 +44,11 @@ cifmw_install_yamls_vars.keys() | map('upper') | zip(cifmw_install_yamls_vars.values()) | - items2dict(key_name=0, value_name=1) + items2dict(key_name=0, value_name=1) | + combine({'OUT': cifmw_install_yamls_manifests_dir}) }} cacheable: true - - name: Show the env structure - ansible.builtin.debug: - var: edpm_env - - name: Ensure user cifmw_install_yamls_vars contains existing Makefile variables ansible.builtin.assert: that: >- @@ -77,7 +74,8 @@ when: - cifmw_install_yamls_vars is not defined ansible.builtin.set_fact: - edpm_env: {} + edpm_env: + OUT: "{{ cifmw_install_yamls_manifests_dir }}" cacheable: true - name: Set install_yamls default values @@ -85,6 +83,10 @@ cifmw_install_yamls_defaults: "{{ get_makefiles_env_output.makefiles_values | combine(edpm_env) }}" cacheable: true +- name: Show the env structure + ansible.builtin.debug: + var: edpm_env + - name: "Generate make targets" register: cifmw_generate_makes generate_make_tasks: diff --git a/scenarios/centos-9/ci.yml b/scenarios/centos-9/ci.yml index ee690d15..f93e5fc0 100644 --- a/scenarios/centos-9/ci.yml +++ b/scenarios/centos-9/ci.yml @@ -21,7 +21,7 @@ post_ctlplane_deploy: type: playbook source: rabbitmq_tuning.yml -edpm_env: +cifmw_install_yamls_vars: BMO_SETUP: false # The actual ceph_make task understands "make_ceph_environment". diff --git a/scenarios/centos-9/edpm_ci.yml b/scenarios/centos-9/edpm_ci.yml index 76e6a0bb..9f482b77 100644 --- a/scenarios/centos-9/edpm_ci.yml +++ b/scenarios/centos-9/edpm_ci.yml @@ -6,18 +6,15 @@ cifmw_install_yamls_vars: OUTPUT_DIR: "{{ cifmw_basedir }}/artifacts/edpm_compute" # used by gen-ansibleee-ssh-key.sh OUTPUT_BASEDIR: "{{ cifmw_basedir }}/artifacts/edpm_compute" # used by gen-edpm-compute-node.sh SSH_KEY: "{{ cifmw_basedir }}/artifacts/edpm_compute/ansibleee-ssh-key-id_rsa" + STORAGE_CLASS: crc-csi-hostpath-provisioner # edpm_deploy role vars cifmw_edpm_deploy_run_validation: true # edpm_prepare role vars cifmw_edpm_prepare_skip_crc_storage_creation: true cifmw_edpm_prepare_skip_openstack_operator: true -cifmw_edpm_prepare_make_openstack_deploy_env: - STORAGE_CLASS: crc-csi-hostpath-provisioner cifmw_operator_build_meta_name: "openstack-operator" -edpm_env: - STORAGE_CLASS: crc-csi-hostpath-provisioner # edpm_deploy role vars cifmw_edpm_deploy_manifests_dir: "{{ cifmw_installyamls_repos }}/out" diff --git a/scenarios/centos-9/kuttl.yml b/scenarios/centos-9/kuttl.yml index bba5879c..fb7642d3 100644 --- a/scenarios/centos-9/kuttl.yml +++ b/scenarios/centos-9/kuttl.yml @@ -1,4 +1,3 @@ --- -edpm_env: - OUT: "{{ cifmw_installyamls_repos }}/out" +cifmw_install_yamls_vars: STORAGE_CLASS: crc-csi-hostpath-provisioner diff --git a/scenarios/centos-9/local-env.yml b/scenarios/centos-9/local-env.yml index 3c7c9ac0..17d78017 100644 --- a/scenarios/centos-9/local-env.yml +++ b/scenarios/centos-9/local-env.yml @@ -1,4 +1,7 @@ cifmw_installyamls_repos: "{{ ansible_user_dir }}/src/install_yamls" +cifmw_install_yamls_vars: + BMO_SETUP: false + cifmw_use_libvirt: true cifmw_use_crc: true cifmw_operator_build_push_registry: "default-route-openshift-image-registry.apps-crc.testing" @@ -15,5 +18,3 @@ pre_infra: inventory: "{{ cifmw_installyamls_repos }}/devsetup/hosts" type: playbook source: "{{ cifmw_installyamls_repos }}/devsetup/download_tools.yaml" -edpm_env: - BMO_SETUP: false