-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
automate the ironbank docker context generation #32251
Conversation
mage: use BeatName
even though they are not subscribed to the ironbank releases this should help the calls in the package to just run it
…tomation * upstream/main: [main](backport elastic#32235) docs: Prepare Changelog for 8.3.2 (elastic#32253) Revert "Fix flags for dev build (elastic#31955)" (elastic#32250) [Automation] Update elastic stack version to 8.4.0-d0a4da44 for testing (elastic#32243) x-pack/filebeat/module/cisco: fix handling of user parsing with sgt fields (elastic#32196) packetbeat/route: make use of newly added GetBestInterfaceEx in x/sys/windows (elastic#32180)
There are some issues with the |
/test |
CMD ["-environment", "container"] | ||
|
||
# see https://www.elastic.co/guide/en/beats/auditbeat/current/http-endpoint.html | ||
HEALTHCHECK --interval=10s --timeout=5s --start-period=1m --retries=5 CMD curl -I -f --max-time 5 --unix-socket '/usr/share/auditbeat/data/auditbeat.sock' 'http:/stats?pretty' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this come from originally? I am surprised by the single slash in the final string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Dockerfile
is exactly the one published in ironbank: https://repo1.dso.mil/dsop/elastic/beats/auditbeat/-/blob/development/Dockerfile#L81
dev-tools/packaging/templates/ironbank/auditbeat/hardening_manifest.yaml
Show resolved
Hide resolved
/test |
Test➜ beats gsutil cp gs://beats-ci-artifacts/beats/pull-requests/pr-32251/auditbeat/auditbeat-ironbank-8.4.0-SNAPSHOT-docker-build-context.tar.gz .
Copying gs://beats-ci-artifacts/beats/pull-requests/pr-32251/auditbeat/auditbeat-ironbank-8.4.0-SNAPSHOT-docker-build-context.tar.gz...
/ [1 files][ 11.8 KiB/ 11.8 KiB]
Operation completed over 1 objects/11.8 KiB
➜ beats tar xvf auditbeat-ironbank-8.4.0-SNAPSHOT-docker-build-context.tar.gz
x Dockerfile
x LICENSE
x README.md
x config
x config/auditbeat.yml
x hardening_manifest.yaml
➜ beats grep 8.4 *
Dockerfile:ARG ELASTIC_STACK=8.4.0
README.md:License](https://github.com/elastic/beats/blob/8.4/licenses/ELASTIC-LICENSE.txt),
README.md:[here](https://www.elastic.co/guide/en/beats/libbeat/current/release-notes-8.4.0.html).
auditbeat-ironbank-8.4.0-SNAPSHOT-docker-build-context.tar.gz.sha512:544fbef4e3fe6c4fd5495446211d42cb3e26ba2bcace54b932ab9f887a1b683eb3b368f94878e46ea5bebdb0a9b300c26171a548fe177d1a56e845f56eb6467a auditbeat-ironbank-8.4.0-SNAPSHOT-docker-build-context.tar.gz
grep: config: Is a directory
hardening_manifest.yaml: - "8.4.0"
hardening_manifest.yaml: ELASTIC_STACK: "8.4.0"
hardening_manifest.yaml: org.opencontainers.image.version: "8.4.0"
hardening_manifest.yaml: - filename: "auditbeat-8.4.0-linux-x86_64.tar.gz"
hardening_manifest.yaml: url: "<artifact_path>/auditbeat-8.4.0-linux-x86_64.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(cherry picked from commit e41dc18) # Conflicts: # .ci/packaging.groovy # dev-tools/mage/pkg.go # x-pack/winlogbeat/magefile.go
(cherry picked from commit e41dc18) # Conflicts: # x-pack/winlogbeat/magefile.go
Motivation/summary
Automate the docker context generation for the IronBank releases, this will allow us to move away from creating those docker context manually in a different repository, since the Platform Release team already provide the automation.
Implementation details
A similar approach was done for Kibana and Elasticsearch
I don't know if other teams are actually building those docker, but for now this is the very first iteration to move away from the manual steps required.
What projects are the ones?
DoD build context content
As required the build context contains the following files:
Dockerfile
with specific requirements for DoD (registry args, no internet dependencies, healthcheck, ...)hardening_manifest.yaml
with all required dependenciesLICENSE
specific for DoDREADME.md
with specific content for DoDconfig/
(optional) directory containing all config files to include into the Docker imagescripts/
directory containing all scripts to include into the Docker image (example: entrypoint...)Tasks
Test
if you
mage ironbank
then you will see the.tar.gz
in thebuild/distributions
folder for each subscribed beat, for instance:If it's not supported then
mage ironbank
will print a message:$ mage ironbank >> Ironbank: this module is not subscribed to the IronBank releases.
CI
ironbank
is now enabled in the package stage and artifacts are generated:executed the
ironbank
step:$ gsutil list gs://beats-ci-artifacts/beats/pull-requests/pr-32251/metricbeat | grep ironban gs://beats-ci-artifacts/beats/pull-requests/pr-32251/metricbeat/metricbeat-ironbank-8.4.0-SNAPSHOT-docker-build-context.tar.gz gs://beats-ci-artifacts/beats/pull-requests/pr-32251/metricbeat/metricbeat-ironbank-8.4.0-SNAPSHOT-docker-build-context.tar.gz.sha512
Issue
Similar to:
Requires #32274
Follow ups
heartbeats
one, this is one is a bit more special since all the package dependencies need to be declared, and we might need to figure a way to automate this earlier than failing when generating the package.elastic-agent
too.