Skip to content

Rework Agent containers build #2607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions agent/containers/images/Dockerfile.base.j2
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# {{ distro_image_name }} pbench-agent base image
FROM docker.io/library/{{ distro_image }}
{% set is_centos_8 = true if image_name == 'centos' and image_rev == '8' else false %}
{% set image_tag = 'stream' + image_rev if image_name == 'centos' else image_rev %}
# {{ distro_name }} pbench-agent base image
FROM {{ image_repo }}/{{ image_name }}:{{ image_tag }}

# Install the appropriate pbench repository file for {{ distro_image_name }}.
# Install the appropriate pbench repository file for {{ distro_name }}.
COPY ./{{ pbench_repo_file }} /etc/yum.repos.d/pbench.repo

# Install the pbench-agent RPM, which should have all its dependencies enumerated;
# ... and make sure we have a proper pbench-agent.cfg file in place;
# ... and finally, ensure the proper pbench-agent environment variables are set up.
RUN \
{% if distro_image == 'centos:8' %}
{% if is_centos_8 %}
{{ pkgmgr }} module -y enable python36 && \
{{ pkgmgr }} module -y disable python38 && \
{% endif %}
{% if distro_image.startswith('centos') %}
{{ pkgmgr }} install -y --setopt=tsflags=nodocs https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ distro_image.split(':', 1)[1] }}.noarch.rpm && \
{% if image_name == 'centos' %}
{{ pkgmgr }} install -y --setopt=tsflags=nodocs https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ image_rev }}.noarch.rpm && \
{% endif %}
{{ pkgmgr }} install -y --setopt=tsflags=nodocs {% if distro_image == 'centos:8' %}--enablerepo powertools glibc-locale-source {% endif %} pbench-agent && \
{% if distro_image == 'centos:8' %}
{{ pkgmgr }} install -y --setopt=tsflags=nodocs {% if is_centos_8 %}--enablerepo powertools glibc-locale-source {% endif %} pbench-agent && \
{% if is_centos_8 %}
localedef -i en_US -f UTF-8 en_US.UTF-8 && \
{% endif %}
{{ pkgmgr }} -y clean all && \
Expand Down
12 changes: 9 additions & 3 deletions agent/containers/images/Dockerfile.layered.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ FROM pbench-agent-base-{{ distro }}:{{ tag }}

{% if kind in ('tools', 'all') %}
COPY ./{{ distro }}-pcp.repo /etc/yum.repos.d/pcp.repo
{% if distro.startswith('centos') %}
COPY ./{{ distro }}-prometheus.repo /etc/yum.repos.d/prometheus.repo
{% endif %}
{% endif %}

# Install all the RPMs required for this image.
#
# FIXME: this is not exhaustive, it does not include RPMs to support
# Kubernetes or RHV environments.
RUN {% if distro == 'centos-7' %}yum{% else %}dnf{% endif %} install -y --setopt=tsflags=nodocs {% if distro == 'centos-8' %}--enablerepo powertools {% endif %}{% if kind in ('tools', 'all') %}--enablerepo pcp-rpm-release {% endif %}{{ rpms }} && \
{% if distro == 'centos-7' %}yum{% else %}dnf{% endif %} -y clean all && \
rm -rf /var/cache/{% if distro == 'centos-7' %}yum{% else %}dnf{% endif %}
{% set pkgmgr = 'yum' if distro == 'centos-7' else 'dnf' %}
RUN {{ pkgmgr }} install -y --setopt=tsflags=nodocs \
{% if distro == 'centos-8' %}--enablerepo powertools {% endif %} \
{% if kind in ('tools', 'all') %}--enablerepo pcp-rpm-release {% endif %}{{ rpms }} && \
{{ pkgmgr }} -y clean all && \
rm -rf /var/cache/{{ pkgmgr }}
Loading