Skip to content
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

[heartbeat] Add support for ubi8-complete image #28597

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ shared:
extra_vars:
image_name: '{{.BeatName}}-ubi8'
from: 'docker.elastic.co/ubi8/ubi-minimal'
variants: ["complete"]
Copy link
Contributor

@mdelapenya mdelapenya Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging this PR, please consider revisiting the variants attribute, as we suggest in #28526, where we define a new "variant" (the complete, or any other, such as the cloud one) directly in the declarative way (using packages.yml) Vs doing it in a programmatic manner (using dockerbuilder.go)


- &docker_arm_ubi_spec
extra_vars:
Expand Down
20 changes: 16 additions & 4 deletions dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ ENV ELASTIC_AGENT_IMAGE_VARIANT={{.Variant}}
ENV BEAT_SETUID_AS={{ .user }}

{{- if contains .from "ubi-minimal" }}
RUN for iter in {1..10}; do microdnf update -y && microdnf install -y shadow-utils jq && microdnf clean all && exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
RUN for iter in {1..10}; do rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && microdnf update -y && microdnf install -y shadow-utils jq && microdnf clean all && exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; done; (exit $exit_code)
RUN microdnf install -y jq
{{- else }}
# Installing jq needs to be installed after epel-release and cannot be in the same yum install command.
RUN case $(arch) in aarch64) YUM_FLAGS="-x bind-license";; esac; \
Expand All @@ -58,7 +59,8 @@ RUN case $(arch) in aarch64) YUM_FLAGS="-x bind-license";; esac; \
(exit $exit_code)
{{- end }}

{{- if (and (eq .Variant "complete") (not (contains .from "ubi-minimal"))) }}
{{- if (eq .Variant "complete") }}
{{- if (not (contains .from "ubi-minimal")) }}
RUN for iter in {1..10}; do \
yum -y install atk cups gtk gdk xrandr pango libXcomposite libXcursor libXdamage \
libXext libXi libXtst cups-libs libXScrnSaver libXrandr GConf2 \
Expand All @@ -68,6 +70,16 @@ RUN for iter in {1..10}; do \
exit_code=0 && break || exit_code=$? && echo "yum error: retry $iter in 10s" && sleep 10; \
done; \
(exit $exit_code)
{{- else }}
RUN for iter in {1..10}; do \
microdnf -y install atk cups xrandr pango libXcomposite libXcursor libXdamage \
libXext libXi libXtst cups-libs libXScrnSaver libXrandr GConf2 \
alsa-lib atk gtk3 findutils tar xz && \
microdnf clean all && \
exit_code=0 && break || exit_code=$? && echo "microdnf error: retry $iter in 10s" && sleep 10; \
done; \
(exit $exit_code)
{{- end }}
ENV NODE_PATH={{ $beatHome }}/.node
RUN echo \
$NODE_PATH \
Expand Down Expand Up @@ -156,7 +168,7 @@ RUN mkdir /app
{{- else }}
RUN groupadd --gid 1000 {{ .BeatName }}
RUN useradd -M --uid 1000 --gid 1000 --groups 0 --home {{ $beatHome }} {{ .user }}
{{- if (and (eq .Variant "complete") (not (contains .from "ubi-minimal"))) }}
{{- if (eq .Variant "complete") }}
RUN chown {{ .user }} $NODE_PATH
{{- end }}
{{- if contains .image_name "-cloud" }}
Expand All @@ -167,7 +179,7 @@ RUN chown {{ .user }} /app
{{- end }}
USER {{ .user }}

{{- if (and (eq .Variant "complete") (not (contains .from "ubi-minimal"))) }}
{{- if (eq .Variant "complete") }}
# Setup synthetics env vars
ENV ELASTIC_SYNTHETICS_CAPABLE=true
ENV SUITES_DIR={{ $beatHome }}/suites
Expand Down