diff --git a/hooks/playbooks/fetch_compute_facts.yml b/hooks/playbooks/fetch_compute_facts.yml index 1ec7fbcea7..df4be9c963 100644 --- a/hooks/playbooks/fetch_compute_facts.yml +++ b/hooks/playbooks/fetch_compute_facts.yml @@ -1,12 +1,11 @@ --- -- name: Sync repos for controller to compute for periodic jobs +- name: Sync repos for controller to compute hosts: computes gather_facts: true tasks: - name: Copy repositories from controller to computes when: - zuul is defined - - "'periodic' in zuul.job" become: true ansible.builtin.copy: dest: "/etc/yum.repos.d/" diff --git a/roles/build_openstack_packages/defaults/main.yml b/roles/build_openstack_packages/defaults/main.yml index 8fa6b93d45..efe32d0e91 100644 --- a/roles/build_openstack_packages/defaults/main.yml +++ b/roles/build_openstack_packages/defaults/main.yml @@ -60,6 +60,7 @@ cifmw_bop_timestamper_cmd: >- cifmw_bop_branchless_projects: - openstack-k8s-operators/tcib + - os-net-config/os-net-config cifmw_bop_change_list: [] diff --git a/roles/build_openstack_packages/tasks/create_repo.yml b/roles/build_openstack_packages/tasks/create_repo.yml index b0372d3f17..016fc3586d 100644 --- a/roles/build_openstack_packages/tasks/create_repo.yml +++ b/roles/build_openstack_packages/tasks/create_repo.yml @@ -51,6 +51,9 @@ priority=1 dest: "{{ cifmw_bop_gating_repo_dest }}/gating.repo" +- name: Serve gating repo + ansible.builtin.import_tasks: serve_gating_repo.yml + - name: Check for DLRN repo at the destination ansible.builtin.stat: path: "{{ cifmw_bop_gating_repo_dest }}/delorean.repo" diff --git a/roles/build_openstack_packages/tasks/serve_gating_repo.yml b/roles/build_openstack_packages/tasks/serve_gating_repo.yml new file mode 100644 index 0000000000..5928de0907 --- /dev/null +++ b/roles/build_openstack_packages/tasks/serve_gating_repo.yml @@ -0,0 +1,37 @@ +--- +- name: Install python-psutil + become: true + ansible.builtin.package: + name: python-psutil + +- name: Getting process IDs of the process + community.general.pids: + pattern: "python -m http.server" + register: pids_of_python + +- name: Printing the process IDs obtained + ansible.builtin.debug: + msg: "{{ pids_of_python.pids }}" + +- name: Force kill the running process + ansible.builtin.command: "kill -9 {{ item }}" + loop: "{{ pids_of_python.pids }}" + +- name: Open port 8766 to serve repos + become: true + ansible.builtin.command: "{{ item }}" + with_items: + - "nft add table ip filter" + - "nft add chain ip filter INPUT { type filter hook input priority 0 \\; }" + - "nft insert rule ip filter INPUT tcp dport 8766 counter accept" + changed_when: true + +- name: Serve gating repos + become: true + ansible.builtin.shell: + cmd: >- + nohup python3 -m http.server 8766 1>{{ ansible_user_dir }}/pkg_mgr_mirror.log 2>{{ ansible_user_dir }}/pkg_mgr_mirror_error.log & + args: + chdir: "{{ cifmw_bop_gating_repo_dest }}" + + diff --git a/roles/repo_setup/tasks/main.yml b/roles/repo_setup/tasks/main.yml index 7c12827c9c..d61b53352a 100644 --- a/roles/repo_setup/tasks/main.yml +++ b/roles/repo_setup/tasks/main.yml @@ -29,5 +29,8 @@ when: cifmw_repo_setup_enable_rhos_release | bool - name: Update generated repos with mirror repos ansible.builtin.import_tasks: ci_mirror.yml +- name: Add gating repo + ansible.builtin.import_tasks: populate_gating_repo.yml + when: content_provider_registry_ip is defined - name: Sync generated repos to yum.repos.d ansible.builtin.import_tasks: sync_repos.yml diff --git a/roles/repo_setup/tasks/populate_gating_repo.yml b/roles/repo_setup/tasks/populate_gating_repo.yml new file mode 100644 index 0000000000..11a03e306e --- /dev/null +++ b/roles/repo_setup/tasks/populate_gating_repo.yml @@ -0,0 +1,31 @@ +--- +- name: Check for gating.repo file on content provider + ansible.builtin.uri: + url: "http://{{ content_provider_registry_ip }}:8766/gating.repo" + register: _url_status + ignore_errors: true + +- name: Construct gating repo + when: _url_status.status == 200 + block: + - name: Populate gating repo from content provider ip + ansible.builtin.copy: + content: | + [gating-repo] + baseurl=http://{{ content_provider_registry_ip }}:8766/ + enabled=1 + gpgcheck=0 + priority=1 + dest: "{{ cifmw_repo_setup_output }}/gating.repo" + + - name: Check for DLRN repo at the destination + ansible.builtin.stat: + path: "{{ cifmw_repo_setup_output }}/delorean.repo" + register: _dlrn_repo + + - name: Lower the priority of DLRN repos to allow installation from gating repo + when: _dlrn_repo.stat.exists + ansible.builtin.replace: + path: "{{ cifmw_repo_setup_output }}/delorean.repo" + regexp: "priority=1" + replace: "priority=20"