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

Build cloud docker images for elastic-agent #28134

Merged
merged 21 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 3 additions & 1 deletion .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,12 @@ def tagAndPush(Map args = [:]) {
}
// supported image flavours
def variants = ["", "-oss", "-ubi8"]
//

if(beatName == 'elastic-agent'){
variants.add("-complete")
variants.add("-cloud")
}

variants.each { variant ->
tags.each { tag ->
// TODO:
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@ def tagAndPush(Map args = [:]) {
// supported image flavours
def variants = ["", "-oss", "-ubi8"]

// only add complete variant for the elastic-agent
if(beatName == 'elastic-agent'){
variants.add("-complete")
variants.add("-cloud")
}

variants.each { variant ->
Expand Down
16 changes: 14 additions & 2 deletions dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,16 @@ shared:
from: 'arm64v8/centos:7'
buildFrom: 'arm64v8/centos:7'

- &cloud_agent_docker_spec
v1v marked this conversation as resolved.
Show resolved Hide resolved
<<: *agent_docker_spec
extra_vars:
image_name: '{{.BeatName}}-cloud'

- &cloud_agent_docker_arm_spec
<<: *agent_docker_arm_spec
extra_vars:
image_name: '{{.BeatName}}-cloud'
v1v marked this conversation as resolved.
Show resolved Hide resolved

v1v marked this conversation as resolved.
Show resolved Hide resolved
# Deb/RPM spec for community beats.
- &deb_rpm_spec
<<: *common
Expand Down Expand Up @@ -998,10 +1008,11 @@ specs:
types: [docker]
spec:
<<: *agent_docker_spec
<<: *cloud_agent_docker_spec
v1v marked this conversation as resolved.
Show resolved Hide resolved
<<: *elastic_docker_spec
<<: *elastic_license_for_binaries
# This image gets a 'complete' variant for synthetics and other large
# packages too big to fit in the main image
# packages too big to fit in the main image.
v1v marked this conversation as resolved.
Show resolved Hide resolved
variants: ["complete"]
files:
'{{.BeatName}}{{.BinaryExt}}':
Expand All @@ -1024,10 +1035,11 @@ specs:
types: [docker]
spec:
<<: *agent_docker_arm_spec
<<: *cloud_agent_docker_arm_spec
v1v marked this conversation as resolved.
Show resolved Hide resolved
<<: *elastic_docker_spec
<<: *elastic_license_for_binaries
# This image gets a 'complete' variant for synthetics and other large
# packages too big to fit in the main image
# packages too big to fit in the main image.
v1v marked this conversation as resolved.
Show resolved Hide resolved
variants: ["complete"]
files:
'{{.BeatName}}{{.BinaryExt}}':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ RUN mkdir -p {{ $beatHome }}/data {{ $beatHome }}/data/elastic-agent-{{ commit_s
{{- end }}
{{- range $i, $modulesd := .ModulesDirs }}
chmod 0775 {{ $beatHome}}/{{ $modulesd }} && \
{{- end }}
{{- if contains .from "-cloud" }}
tar -xvf {{ $beatHome }}/data/elastic-agent-*/downloads/metricbeat-*.tar.gz --strip-components 1 --directory /opt --wildcards "*metricbeat" && \
tar -xvf {{ $beatHome }}/data/elastic-agent-*/downloads/filebeat-*.tar.gz --strip-components 1 --directory /opt --wildcards "*filebeat" && \
{{- end }}
true

Expand All @@ -41,7 +45,6 @@ RUN case $(arch) in aarch64) YUM_FLAGS="-x bind-license";; esac; \
yum install -y epel-release && \
yum update -y $YUM_FLAGS && \
yum install -y jq && \

Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated to this particular change, but let's keep it tidy

yum clean all && \
exit_code=0 && break || exit_code=$? && echo "yum error: retry $iter in 10s" && sleep 10; \
done; \
Expand Down Expand Up @@ -134,6 +137,11 @@ RUN mkdir /licenses
COPY --from=home {{ $beatHome }}/LICENSE.txt /licenses
COPY --from=home {{ $beatHome }}/NOTICE.txt /licenses

{{- if contains .from "-cloud" }}
COPY --from=home /opt/filebeat /opt/filebeat
COPY --from=home /opt/metricbeat /opt/metricbeat
{{- end }}

{{- if ne .user "root" }}
RUN groupadd --gid 1000 {{ .BeatName }}
RUN useradd -M --uid 1000 --gid 1000 --groups 0 --home {{ $beatHome }} {{ .user }}
Expand Down