Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Adjust e2e test after the repo structure has changed #134

Merged
merged 8 commits into from
Jul 22, 2024
4 changes: 2 additions & 2 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
parent: openstack-e2e-abstract
description: |
Run e2e tests of cluster-stacks project using
[sonobuoy](https://sonobuoy.io/) with mode conformance and
[sonobuoy](https://sonobuoy.io/) with mode non-disruptive conformance and
SCS compliance checks meaning it will test if the Kubernetes
cluster is conformant to the CNCF and to the SCS.
timeout: 10800 # 3h
vars:
wait_for_cluster: 1200 # 20min
sonobouy:
enabled: true
mode: conformance
mode: certified-conformance
scs_compliance:
enabled: true

Expand Down
33 changes: 23 additions & 10 deletions playbooks/openstack/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
- name: Cluster stack OpenStack E2E test
hosts: all
vars:
cluster_stack: "providers/openstack/alpha/1-29"
cluster_stack_name: "openstack-alpha-1-29"
cluster_stack_version_name: alpha
cluster_stack_path: "providers/openstack/scs"
project_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
cluster_stack_release_dir: "{{ ansible_user_dir }}/.release"
cluster_manifest_dir: "{{ ansible_user_dir }}/cluster_manifest"
Expand Down Expand Up @@ -39,19 +37,18 @@
ansible.builtin.set_fact:
zuul_config: "{{ zuul_config | first | split('/n') | map('trim') | join('\n') }}"
when: zuul_config is defined and zuul_config is not none and zuul_config != ''
- name: Extract cluster stack from Zuul config
- name: Extract cluster_stack_folder from Zuul config
ansible.builtin.set_fact:
cluster_stack_name: "{{ zuul_config | regex_search('cluster_stack\\s*=\\s*\"([^\"]+)\"', '\\1') | first }}"
cluster_stack_folder: "{{ zuul_config | regex_search('cluster_stack_folder\\s*=\\s*\"([^\"]+)\"', '\\1') | first }}"
when:
- zuul_config is defined and zuul_config is not none and zuul_config != ''
- zuul_config | regex_search('cluster_stack\\s*=\\s*\"([^\"]+)\"') is defined
- name: Override cluster stack if extracted
- name: Override cluster_stack_path if the cluster_stack_folder extracted
ansible.builtin.set_fact:
cluster_stack: "{{ cluster_stack_name | regex_replace('^openstack-([a-zA-Z0-9]+)-([0-9]+-[0-9]+)$', 'providers/openstack/\\1/\\2') }}"
cluster_stack_version_name: "{{ cluster_stack_name | regex_replace('^openstack-([a-zA-Z0-9]+)-([0-9]+-[0-9]+)$', '\\1') }}"
when: cluster_stack_name is defined
cluster_stack_path: "providers/openstack/{{ cluster_stack_folder }}"
when: cluster_stack_folder is defined
- name: Create cluster stack
ansible.builtin.command: "csctl create {{ project_dir }}/{{ cluster_stack }} --output {{ cluster_stack_release_dir }} --mode hash"
ansible.builtin.command: "csctl create {{ project_dir }}/{{ cluster_stack_path }} --output {{ cluster_stack_release_dir }} --mode hash"
args:
chdir: "{{ project_dir }}"
changed_when: true
Expand Down Expand Up @@ -126,6 +123,22 @@
ansible.builtin.set_fact:
k8s_version_major_minor: "{{ k8s_version | regex_replace('^v?([0-9]+\\.[0-9]+)\\..*', '\\1') }}"
when: k8s_version is defined
- name: Read the csctl.yaml file
ansible.builtin.slurp:
src: "{{ project_dir }}/{{ cluster_stack_path }}/csctl.yaml"
register: csctl_file_content
- name: Parse the csctl.yaml content
ansible.builtin.set_fact:
csctl_data: "{{ csctl_file_content.content | b64decode | from_yaml }}"
- name: Register cluster_stack_version_name
ansible.builtin.set_fact:
cluster_stack_version_name: "{{ csctl_data.config.clusterStackName }}"
- name: Format the kubernetesVersion for cluster_stack_name
ansible.builtin.set_fact:
k8s_version_formatted: "{{ k8s_version_major_minor | regex_replace('\\.', '-') }}"
- name: Create the cluster_stack_name
ansible.builtin.set_fact:
cluster_stack_name: "{{ csctl_data.config.provider.type }}-{{ csctl_data.config.clusterStackName }}-{{ k8s_version_formatted }}"
- name: Extract cloud name from clouds_yaml_full
ansible.builtin.set_fact:
cloud_name: "{{ clouds_yaml_full.clouds.keys() | first }}"
Expand Down