Jetski failing on to build hammercli image with Failed to download metadata for repo 'appstream'
Issue - Jetski failing on to build hammercli image 'podman build --build-arg foreman_url=https://foreman.X.redhat.com/ -t hammercli ."
Ansible failure:
fatal: [localhost]: FAILED! => { "changed": true, "cmd": "podman build --build-arg foreman_url=https://foreman.X.redhat.com/ -t hammercli .", "delta": "0:00:01.631567", "end": "2022-09-06 08:02:13.450408", "invocation": { "module_args": { "_raw_params": "podman build --build-arg foreman_url=https://foreman.X.redhat.com/ -t hammercli .", "_uses_shell": true, "argv": null, "chdir": "/home/perf/git/JetSki/ansible-ipi-install/roles/bootstrap/files/", "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true, "warn": false } }, "msg": "non-zero return code", "rc": 1, "start": "2022-09-06 08:02:11.818841", "stderr": "Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist\nError: error building at STEP "RUN dnf install -y epel-release python3": error while running runtime: exit status 1", "stderr_lines": [ "Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist", "Error: error building at STEP "RUN dnf install -y epel-release python3": error while running runtime: exit status 1" ], "stdout": "STEP 1/9: FROM quay.io/centos/centos:8\nSTEP 2/9: ARG foreman_url=https://foreman.example.com/\n--> Using cache cbc42a7ea9e1714988294ffabfc6ca769a8a47cb1d6303ddda11e7411f034d20\n--> cbc42a7ea9e\nSTEP 3/9: RUN dnf install -y epel-release python3\nCentOS Linux 8 - AppStream 114 B/s | 38 B 00:00 ", "stdout_lines": [ "STEP 1/9: FROM quay.io/centos/centos:8", "STEP 2/9: ARG foreman_url=https://foreman.example.com/", "--> Using cache cbc42a7ea9e1714988294ffabfc6ca769a8a47cb1d6303ddda11e7411f034d20", "--> cbc42a7ea9e", "STEP 3/9: RUN dnf install -y epel-release python3", "CentOS Linux 8 - AppStream 114 B/s | 38 B 00:00 " ] }
To fix:
- Edit Dockerfile in ansible-ipi-install/roles/bootstrap/files
- Add repo changes for Appstream ` FROM quay.io/centos/centos:8 ARG foreman_url=https://foreman.example.com RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
RUN dnf install -y epel-release
python3
RUN dnf install -y --skip-broken https://yum.theforeman.org/releases/2.1/el8/x86_64/foreman-release.rpm
https://yum.theforeman.org/releases/2.1/el8/x86_64/rubygem-hammer_cli-2.1.0-1.el8.noarch.rpm
http://yum.theforeman.org/releases/2.1/el8/x86_64/rubygem-hammer_cli_foreman-2.1.0-2.el8.noarch.rpm
RUN dnf install -y rubygem-hammer_cli
rubygem-hammer_cli_foreman
RUN pip3 install j2cli RUN hammer --fetch-ca-cert ${foreman_url} COPY foreman.yml.j2 /root/ RUN j2 /root/foreman.yml.j2 > /etc/hammer/cli.modules.d/foreman.yml
`