|
1 | | -- name: Run pre-test steps |
2 | | - ansible.builtin.import_playbook: pre-test-steps.yml |
3 | | - |
| 1 | +--- |
4 | 2 | - name: Run telemetry tests to verify metrics on osp18 |
5 | 3 | hosts: "{{ cifmw_target_hook_host | default('localhost') }}" |
6 | 4 | gather_facts: true |
|
10 | 8 | vars_files: |
11 | 9 | - vars/common.yml |
12 | 10 | - vars/osp18_env.yml |
| 11 | + vars: |
| 12 | + cifmw_ci_setup_oc_install_path: "{{ ansible_user_dir ~ '/bin' }}" |
| 13 | + # openshift client |
| 14 | + cifmw_ci_setup_openshift_client_download_uri: "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp" |
| 15 | + cifmw_ci_setup_openshift_minimum_version: 4 |
| 16 | + cifmw_ci_setup_openshift_client_version: 'stable-4.16' |
13 | 17 | tasks: |
14 | 18 | #TODO: Add this as a common playbook so it can be added to the other tests as well. |
15 | | - - name: Install oc |
16 | | - ansible.builtin.include_role: |
17 | | - name: cifmw.general.ci_setup |
18 | | - tasks_from: packages |
| 19 | + #- name: Install oc |
| 20 | + # ansible.builtin.include_role: |
| 21 | + # name: cifmw.general.ci_setup |
| 22 | + # tasks_from: packages |
| 23 | + # vars: |
| 24 | + # cifmw_ci_setup_packages: [] |
| 25 | + #TODO: use ci_setup one deps installation is sorted |
| 26 | + - name: Ensure openshift client install path is present |
| 27 | + ansible.builtin.file: |
| 28 | + path: "{{ cifmw_ci_setup_oc_install_path }}" |
| 29 | + state: directory |
| 30 | + mode: "0755" |
| 31 | + |
| 32 | + - name: Install openshift client |
| 33 | + ansible.builtin.unarchive: |
| 34 | + src: "{{ cifmw_ci_setup_openshift_client_download_uri }}/{{ cifmw_ci_setup_openshift_client_version }}/openshift-client-linux.tar.gz" |
| 35 | + dest: "{{ cifmw_ci_setup_oc_install_path }}" |
| 36 | + remote_src: true |
| 37 | + mode: "0755" |
| 38 | + creates: "{{ cifmw_ci_setup_oc_install_path }}/oc" |
| 39 | + |
| 40 | + - name: Add the OC path to cifmw_path if needed |
19 | 41 | vars: |
20 | | - cifmw_ci_setup_packages: [] |
| 42 | + _cifmw_paths_list: >- |
| 43 | + {{ |
| 44 | + cifmw_path | split(':') |
| 45 | + if cifmw_path is defined else [] |
| 46 | + }} |
| 47 | + when: cifmw_ci_setup_oc_install_path not in _cifmw_paths_list |
| 48 | + ansible.builtin.set_fact: |
| 49 | + cifmw_path: "{{ cifmw_ci_setup_oc_install_path }}:{{ ansible_env.PATH }}" |
| 50 | + cacheable: true |
| 51 | + |
| 52 | + - name: Inject oc completion in local profile |
| 53 | + block: |
| 54 | + - name: Create completion file |
| 55 | + ansible.builtin.shell: # noqa: risky-shell-pipe |
| 56 | + cmd: >- |
| 57 | + {{ cifmw_ci_setup_oc_install_path }}/oc completion bash | |
| 58 | + tee -a ~/.oc_completion |
| 59 | + creates: "{{ ansible_user_dir }}/.oc_completion" |
| 60 | + no_log: true |
21 | 61 |
|
| 62 | + - name: Source completion from within .bashrc |
| 63 | + ansible.builtin.blockinfile: |
| 64 | + create: true |
| 65 | + mode: "0644" |
| 66 | + path: "{{ ansible_user_dir }}/.bashrc" |
| 67 | + block: |- |
| 68 | + if [ -f ~/.oc_completion ]; then |
| 69 | + source ~/.oc_completion |
| 70 | + fi |
| 71 | + |
22 | 72 | - name: Log into openshift |
23 | 73 | ansible.builtin.shell: |
24 | 74 | cmd: | |
|
0 commit comments