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 docker images based on Red Hat UBI #20576

Merged
merged 15 commits into from
Aug 24, 2020

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Aug 12, 2020

What does this PR do?

Add an additional docker build that builds images based on Red Hat UBI, following Red Hat requirements for certified images.

Additional checks have been added to packaging tests for labels and licenses.

Additional changes done to support it also in Elastic Agent images:

NOTE: Some of the changes for Elastic Agent could be actually moved to separate PRs, but they are quite intertwined and I would like to test them together. I decided to do them on this PR to don't have to conditionally disable package tests, and to be able to test everything together. But happy to move them to other PRs if preferred.

Why is it important?

To build images that can be certified for Red Hat OpenShift.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • Move licenses to /licenses
    • Add the proper licenses to x-pack and OSS images
  • Add labels
  • Add test to check that licenses are in place
  • Add test to check that required labels are present
  • Add build for Elastic Agent

Possibly to be done in a follow up PR

  • Refactor how files are prepared and copied, so it is not needed to change permissions in Dockerfile
  • Unify Dockerfiles for Agent and the rest of beats, as they are quite similar
  • Add checks for the included packages in Agent image

How to test this PR locally

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 12, 2020
@jsoriano jsoriano added Team:Integrations Label for the Integrations team Team:Platforms Label for the Integrations - Platforms team labels Aug 12, 2020
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 12, 2020
@jsoriano jsoriano self-assigned this Aug 12, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 12, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #20576 updated]

  • Start Time: 2020-08-17T09:46:57.159+0000

  • Duration: 74 min 33 sec

Test stats 🧪

Test Results
Failed 0
Passed 18002
Skipped 1827
Total 19829

Steps errors

Expand to view the steps failures

  • Name: Install Go 1.14.7
    • Description: .ci/scripts/install-go.sh

    • Duration: 1 min 47 sec

    • Start Time: 2020-08-17T10:11:56.253+0000

    • log

@urso
Copy link

urso commented Aug 13, 2020

/packaging

@jsoriano
Copy link
Member Author

/packaging

@jsoriano jsoriano marked this pull request as ready for review August 17, 2020 09:52
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

@jsoriano
Copy link
Member Author

/packaging

@jsoriano jsoriano requested review from urso and axw August 17, 2020 09:53
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

I don't know enough to review the agent bits, but the rest looks good. Thanks!

Just one minor question around the labels, which we might not want in non-UBI images. Probably doesn't matter though.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM.


var requiredPackages []string
for _, p := range platformPackages {
if _, enabled := devtools.Platforms.Get(p.platform); enabled {
Copy link
Member

Choose a reason for hiding this comment

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

👍

@ph
Copy link
Contributor

ph commented Aug 19, 2020

@blakerouse can you take a look?

@jsoriano jsoriano requested review from a team and removed request for urso August 20, 2020 08:27
Copy link
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

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

Looks good

if err != nil {
// specific missing fallback to generic
dockerfile = "Dockerfile.tmpl"
dockerfile := "Dockerfile.tmpl"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@jsoriano jsoriano merged commit e31794d into elastic:master Aug 24, 2020
@jsoriano jsoriano deleted the ubi-docker-images branch August 24, 2020 09:06
jsoriano added a commit to jsoriano/beats that referenced this pull request Aug 24, 2020
Add an additional docker build that builds images based on Red Hat UBI, following
Red Hat requirements for certified images.
Additional checks have been added to packaging tests for labels and licenses.
Additional changes done to support it also in Elastic Agent images:
* Home directory is prepared in a different stage (elastic#20356).
* Allow the docker image to be run with random user ids (elastic#18873).
* Explicitly select a Dockerfile and entry point template.
* Add NOTICE.txt file to all agent packages.
* Actually run package tests after building packages, added flag to allow root user.
* Improved checks on required packages, so they are not re-built if they already are.

(cherry picked from commit e31794d)
jsoriano added a commit that referenced this pull request Aug 24, 2020
Add an additional docker build that builds images based on Red Hat UBI, following
Red Hat requirements for certified images.
Additional checks have been added to packaging tests for labels and licenses.
Additional changes done to support it also in Elastic Agent images:
* Home directory is prepared in a different stage (#20356).
* Allow the docker image to be run with random user ids (#18873).
* Explicitly select a Dockerfile and entry point template.
* Add NOTICE.txt file to all agent packages.
* Actually run package tests after building packages, added flag to allow root user.
* Improved checks on required packages, so they are not re-built if they already are.

(cherry picked from commit e31794d)
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
Add an additional docker build that builds images based on Red Hat UBI, following
Red Hat requirements for certified images.
Additional checks have been added to packaging tests for labels and licenses.
Additional changes done to support it also in Elastic Agent images:
* Home directory is prepared in a different stage (elastic#20356).
* Allow the docker image to be run with random user ids (elastic#18873).
* Explicitly select a Dockerfile and entry point template.
* Add NOTICE.txt file to all agent packages.
* Actually run package tests after building packages, added flag to allow root user.
* Improved checks on required packages, so they are not re-built if they already are.
v1v added a commit to v1v/beats that referenced this pull request Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement :Packaging Team:Integrations Label for the Integrations team Team:Platforms Label for the Integrations - Platforms team v7.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants