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 3 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
10 changes: 6 additions & 4 deletions dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,9 @@ specs:
<<: *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
variants: ["complete"]
# packages too big to fit in the main image. In addition, the 'cloud'
# variant for the specific cloud requirements.
variants: ["complete", "cloud"]
files:
'{{.BeatName}}{{.BinaryExt}}':
source: ./build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}}
Expand All @@ -1027,8 +1028,9 @@ specs:
<<: *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
variants: ["complete"]
# packages too big to fit in the main image. In addition, the 'cloud'
# variant for the specific cloud requirements.
variants: ["complete", "cloud"]
files:
'{{.BeatName}}{{.BinaryExt}}':
source: ./build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.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 (and (eq .Variant "cloud") (not (contains .from "ubi-minimal"))) }}
tar -xvf {{ $beatHome }}/data/elastic-agent-*/downloads/metricbeat-*.tar.gz --strip-components 1 --directory /opt --wildcards "*metricbeat" --directory && \
v1v marked this conversation as resolved.
Show resolved Hide resolved
tar -xvf {{ $beatHome }}/data/elastic-agent-*/downloads/filebeat-*.tar.gz --strip-components 1 --directory /opt --wildcards "*filebeat" --directory && \
v1v marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}
true

Expand All @@ -41,7 +45,7 @@ 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 +138,11 @@ RUN mkdir /licenses
COPY --from=home {{ $beatHome }}/LICENSE.txt /licenses
COPY --from=home {{ $beatHome }}/NOTICE.txt /licenses

{{- if (and (eq .Variant "cloud") (not (contains .from "ubi-minimal"))) }}
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