Skip to content

Commit 2841336

Browse files
committed
Remove dep on cifmw
Copy the oc install tasks directly into pre-run-tasks instead.
1 parent 3d038fc commit 2841336

File tree

2 files changed

+58
-14
lines changed

2 files changed

+58
-14
lines changed

ci/pre-test-steps.yml

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
- name: Run pre-test steps
2-
ansible.builtin.import_playbook: pre-test-steps.yml
3-
1+
---
42
- name: Run telemetry tests to verify metrics on osp18
53
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
64
gather_facts: true
@@ -10,15 +8,67 @@
108
vars_files:
119
- vars/common.yml
1210
- 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'
1317
tasks:
1418
#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
1941
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
2161

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+
2272
- name: Log into openshift
2373
ansible.builtin.shell:
2474
cmd: |

requirements.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)