diff --git a/.zuul.yaml b/.zuul.yaml index 234061d5..8cbb9e74 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -32,8 +32,8 @@ override-checkout: main - name: github.com/openstack-k8s-operators/openstack-must-gather override-checkout: main - pre-run: - - ci/pre-2node.yml + # pre-run: + # - ci/pre-2node.yml vars: cifmw_deploy_edpm: false podified_validation: true @@ -87,6 +87,8 @@ - name: github.com/infrawatch/sg-bridge - name: github.com/infrawatch/sg-core - name: github.com/infrawatch/prometheus-webhook-snmp + # I think this should be included here, and needs to have the crc credentials passed in. + # ... eventually pre-run: - ci/prepare.yml run: @@ -202,10 +204,33 @@ - stf-crc-ocp_416-nightly_bundles-index_deploy - stf-crc-ocp_418-nightly_bundles-index_deploy +- job: + name: stf-crc-deployment + parent: stf-base-2node + description: | + A provider job that provisions CRC. + pre-run: + - ci/pre-2node.yml + run: + # It might be better to remove this later, since this does some stf-specific things. + - ci/prepare.yml + - ci/pause-the-job.yml + # Keep scenario for now, it sets some vars, which are set again once STF runs. + # This can get removed later + vars: + scenario: local_build + - project: name: infrawatch/service-telemetry-operator - templates: - - stf-crc-jobs + # templates: + # - stf-crc-jobs + github-check: + jobs: + - stf-crc-deployment: + override-checkout: main + - stf-crc-ocp_416-local_build: + dependencies: stf-crc-deployment + - noop periodic: jobs: - stf-crc-ocp_416-nightly_bundles diff --git a/ci/common-tasks.yml b/ci/common-tasks.yml index 40ff4ad1..c1556ecd 100644 --- a/ci/common-tasks.yml +++ b/ci/common-tasks.yml @@ -8,6 +8,7 @@ ansible.builtin.include_vars: file: "vars-zuul-common.yml" + # TODO: if using prepare for crc-provider, remove dependency on scenario - name: "Get scenario-specific vars" ansible.builtin.include_vars: file: "vars-{{ scenario }}.yml" diff --git a/ci/pause-the-job.yml b/ci/pause-the-job.yml new file mode 100644 index 00000000..ef3314ef --- /dev/null +++ b/ci/pause-the-job.yml @@ -0,0 +1,16 @@ +--- +- hosts: controller + tasks: + #- name: Get credentials + # import_role: + # + - zuul_return: + data: + zuul: + pause: true + # need to return the login informatin for the crc + # this is needed by stf to access the cluster + # TODO: Change the names of the vars once we know they are set correctly. + provider_openshift_login_api: "https://api.crc.testing:6443" + provider_openshift_login_user: "kubeadmin" + provider_openshift_login_password: "12345678 diff --git a/ci/pre-2node.yml b/ci/pre-2node.yml index 1d44b5f4..6241b309 100644 --- a/ci/pre-2node.yml +++ b/ci/pre-2node.yml @@ -28,6 +28,12 @@ chdir: '{{ ansible_env.HOME }}/{{ zuul.projects["github.com/openstack-k8s-operators/ci-framework"].src_dir }}' target: "{{ item }}" with_items: + - setup_tests - setup_molecule +# Need to know what vars have been set. +# openshift_login role needs username/password +# cifmw_openshift_login_user and cifmw_openshift_login_password +# it also needs cifmw_openshift_login_api <- I think this should be returned from a provisioning job, unless it's a fixed value. +# diff --git a/ci/prepare.yml b/ci/prepare.yml index 20558798..2f74801b 100644 --- a/ci/prepare.yml +++ b/ci/prepare.yml @@ -2,6 +2,9 @@ - name: "Prepare the environment for running stf" hosts: controller tasks: + # NOTE: maybe this prepare isn't required in the CRC provider, since it is for STF... + # I can probably split this up into two playbooks, prepare and prepare STF. + # Prepare will run these tasks, common-tasks needs to remove the scenario-specific vars file, and it should be explicitly be included in the STF play - name: "Setup play vars" ansible.builtin.include_tasks: "common-tasks.yml" @@ -35,16 +38,43 @@ - "kubernetes.core:5.0.0" - "community.general" + - name: "Show the openshift cluster information from the provider" + ansible.builtin.debug: + msg: | + The provider_openshift_login_api value is {{ provider_openshift_login_api | default('unset')}}. + The provider_openshift_login_user is {{ provider_openshift_login_user | default('unset') }} + The provider_openshift_login_password is {{ provider_openshift_login_password | default('unset')}} + + + - name: Use creds to log in + shell: + cmd: | + oc login -u {{ provider_openshift_login_user }} -p {{ provider_openshift_login_password }} -s {{ provider_openstack_login_api }} + + + # this won't succeed, since it needs kubeconfig to be set + # Try using openshift_login instead, since the vars are already set from the provider job. - name: "Log into the cluster" ansible.builtin.import_role: name: rhol_crc tasks_from: add_crc_creds.yml - - name: "Create the service-telemetry project" - kubernetes.core.k8s: - api_version: v1 - kind: Namespace - name: "{{ namespace }}" - state: present - retries: 3 - delay: 30 + ## The vars are hardcoded for now, but will become vars later. + #- name: "Log into the cluster" + # ansible.builtin.import_role: + # name: openshift_login + # vars: + # cifmw_openshift_login_api: "https://api.crc.testing:6443" + # cifmw_openshift_login_user: "kubeadmin" + # cifmw_openshift_login_password: "12345678" + + # After this point is specifically STF, which can be removed for now. + # This won't let STF pass, but it will be fine. +# - name: "Create the service-telemetry project" +# kubernetes.core.k8s: +# api_version: v1 +# kind: Namespace +# name: "{{ namespace }}" +# state: present +# retries: 3 +# delay: 30 diff --git a/ci/vars-zuul-common.yml b/ci/vars-zuul-common.yml index de0f1761..7e59534e 100644 --- a/ci/vars-zuul-common.yml +++ b/ci/vars-zuul-common.yml @@ -9,4 +9,4 @@ sgo_dir: "{{ ansible_env.HOME }}/{{ zuul.projects['github.com/infrawatch/smart-g sg_core_dir: "{{ ansible_env.HOME }}/{{ zuul.projects['github.com/infrawatch/sg-core'].src_dir }}" sg_bridge_dir: "{{ ansible_env.HOME }}/{{ zuul.projects['github.com/infrawatch/sg-bridge'].src_dir }}" prometheus_webhook_snmp_dir: "{{ ansible_env.HOME }}/{{ zuul.projects['github.com/infrawatch/prometheus-webhook-snmp'].src_dir }}" -__service_telemetry_storage_persistent_storage_class: "crc-csi-hostpath-provisioner" \ No newline at end of file +__service_telemetry_storage_persistent_storage_class: "crc-csi-hostpath-provisioner"