From 0607f5cc511a3033c5db7b8e7312dcdf629219e3 Mon Sep 17 00:00:00 2001 From: Valerii Svydenko Date: Tue, 4 Jun 2024 18:00:19 +0300 Subject: [PATCH] remove oc_install playbook; use oc provided by tool-container (#30) (#31) Signed-off-by: Valeriy Svydenko --- .../extensions/molecule/default/molecule.yml | 4 +- .../extensions/molecule/default/prepare.yml | 6 --- devfile.yaml | 14 +------ playbooks/install_oc.yml | 39 ------------------- 4 files changed, 3 insertions(+), 60 deletions(-) delete mode 100644 playbooks/install_oc.yml diff --git a/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/molecule.yml b/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/molecule.yml index 0275cd2..3c9dd3f 100644 --- a/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/molecule.yml +++ b/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/molecule.yml @@ -10,8 +10,8 @@ driver: ansible_connection_options: connection: local platforms: - - name: molecule-ubi8-init-1 - image: registry.access.redhat.com/ubi8/ubi-init@sha256:75cb1eb60b9636f8daa584c231db552c1de94006778e7224643804a696f04fad + - name: molecule-ubi8-python-1 + image: registry.access.redhat.com/ubi8/python-39@sha256:301fec66443f80c3cc507ccaf72319052db5a1dc56deb55c8f169011d4bbaacb workingDir: '/tmp' provisioner: name: ansible diff --git a/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/prepare.yml b/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/prepare.yml index 7c0e9bc..4503338 100644 --- a/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/prepare.yml +++ b/collections/ansible_collections/sample_namespace/sample_collection/extensions/molecule/default/prepare.yml @@ -17,12 +17,6 @@ state: directory mode: 0770 - - name: Download oc binary from OCP downloads svc endpoint - ansible.builtin.get_url: - url: http://downloads.openshift-console.svc.cluster.local/amd64/linux/oc - dest: "{{ molecule_user_home_dir }}/bin/oc" - mode: '0770' - - name: Add another bin dir to system-wide $PATH. ansible.builtin.lineinfile: path: "{{ molecule_user_home_dir }}/.bashrc" diff --git a/devfile.yaml b/devfile.yaml index fed9275..ec9faaa 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -4,7 +4,7 @@ metadata: components: - name: tooling-container container: - image: ghcr.io/ansible/ansible-workspace-env-reference@sha256:f02448b3b8423cfedf2773bb2dc8c21e2bf3a00c3df6e501916af2c5467a93f2 + image: ghcr.io/ansible/ansible-workspace-env-reference@sha256:03d7f0fe6caaae62ff2266906b63d67ebd9cf6e4a056c7c0a0c1320e6cfbebce memoryRequest: 256M memoryLimit: 6Gi cpuRequest: 250m @@ -15,15 +15,6 @@ components: value: '~/.ansible/collections:/usr/share/ansible/collections:/projects/ansible-devspaces-demo/collections' commands: - - id: oc-install - exec: - commandLine: '/usr/local/bin/ansible-playbook ${PROJECT_SOURCE}/playbooks/install_oc.yml' - workingDir: ${PROJECT_SOURCE} - group: - kind: build - isDefault: true - component: tooling-container - - id: molecule-create exec: label: "1.Molecule: start a test pod for the automation" @@ -95,6 +86,3 @@ commands: ansible-navigator --ee false workingDir: ${PROJECTS_ROOT}/ansible-devspaces-demo component: tooling-container -events: - postStart: - - "oc-install" diff --git a/playbooks/install_oc.yml b/playbooks/install_oc.yml deleted file mode 100644 index d94e8cf..0000000 --- a/playbooks/install_oc.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- name: Create - hosts: localhost - connection: local - gather_facts: false - no_log: false - vars: - molecule_pip_dependencies: - - kubernetes - tasks: - - - name: Store user ENVs - ansible.builtin.set_fact: - molecule_user_home_dir: "{{ lookup('ansible.builtin.env', 'HOME') }}" - molecule_user_path: "{{ lookup('ansible.builtin.env', 'PATH') }}" - - - name: Create local bin directory - ansible.builtin.file: - path: "{{ molecule_user_home_dir }}/bin" - state: directory - mode: a+x - - - name: Download oc binary from OCP downloads svc endpoint - ansible.builtin.get_url: - url: http://downloads.openshift-console.svc.cluster.local/amd64/linux/oc - dest: "{{ molecule_user_home_dir }}/bin/oc" - mode: a+x - - - name: Add another bin dir to system-wide $PATH. - ansible.builtin.lineinfile: - path: "{{ molecule_user_home_dir }}/.bashrc" - line: 'PATH=$PATH:{{ molecule_user_home_dir }}/bin' - state: present - - - name: Ensure python dependencies are installed - ansible.builtin.pip: - name: "{{ molecule_pip_dependencies }}" - state: present - when: molecule_pip_dependencies is defined