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

Change default container image to be based on UBI minimal instead of Ubuntu #116739

Merged
merged 6 commits into from
Nov 22, 2024

Conversation

jozala
Copy link
Contributor

@jozala jozala commented Nov 13, 2024

Previously default Docker image was based on Ubuntu. This changes the base image for default to be UBI minimal.

@jozala jozala added >non-issue :Delivery/Cloud Cloud-specific packaging and deployment labels Nov 13, 2024
@jozala jozala added :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts >enhancement and removed >non-issue labels Nov 13, 2024

<% if (docker_base == 'ubi') { %>
LABEL name="Elasticsearch" \\
maintainer="infra@elastic.co" \\
vendor="Elastic" \\
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@breskeby I've tried to keep the logic unchanged, but here I have decided to change it to simplify the logic a bit.
Is it OK that wolfi Docker image will also have these labels?

@@ -117,27 +115,6 @@ RUN sed -i -e 's/ES_DISTRIBUTION_TYPE=tar/ES_DISTRIBUTION_TYPE=docker/' bin/elas
chmod 0775 bin config config/jvm.options.d data logs plugins && \\
find config -type f -exec chmod 0664 {} +

<% if (docker_base == "cloud") { %>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed the blocks for cloud from Dockerfile template, because I believe it is no longer used. I couldn't see any code which would use that. Please let me know if I am missing something here.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for cleaning that up

Copy link
Contributor

Choose a reason for hiding this comment

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

yes it was removed here: #115357

@@ -23,14 +22,7 @@ the [DockerBase] enum.
software (FOSS) and Commercial off-the-shelf (COTS). In practice, this is
another UBI build, this time on the regular UBI image, with extra
hardening. See below for more details.
* Cloud - this is mostly the same as the default image, with some notable differences:
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for cleaning up

* <li>Another UBI image for Iron Bank</li>
* <li>A WOLFI-based image</li>
* <li>Images for Cloud</li>
* <li>Image for Cloud ESS</li>
Copy link
Contributor

Choose a reason for hiding this comment

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

its a mess. but we should just name that "Image for Cloud" sorry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

public void test200UbiImagesHaveLicenseDirectory() {
assumeTrue(distribution.packaging == Packaging.DOCKER_UBI);
public void test200ImagesHaveLicenseDirectory() {
assumeTrue(distribution.packaging != Packaging.DOCKER_IRON_BANK);
Copy link
Contributor

Choose a reason for hiding this comment

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

these tests haven't run before for wolfi or cloud-less right? If they now pass also for those even better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. They should run for more images now. This is also the reason I've changed the Dockerfile to add license for all images.

Copy link
Contributor

@breskeby breskeby left a comment

Choose a reason for hiding this comment

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

lgtm.

Copy link
Contributor

@breskeby breskeby left a comment

Choose a reason for hiding this comment

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

Actually I noticed our test coverage for docker in PRs could be better here. Can you tweak our pr packaging tests to test against cloud-ess and against our default docker image?

command: ./.ci/scripts/packaging-test.sh destructiveDistroTest.docker-cloud-ess

Comment on lines 6 to 32
- label: "{{matrix.image}} / docker / packaging-tests-unix"
key: "packaging-tests-unix-docker"
command: ./.ci/scripts/packaging-test.sh destructiveDistroTest.docker
timeout_in_minutes: 300
matrix:
setup:
image:
- debian-11
- opensuse-leap-15
- oraclelinux-7
- oraclelinux-8
- sles-12
- sles-15
- ubuntu-1804
- ubuntu-2004
- ubuntu-2204
- rocky-8
- rocky-9
- rhel-7
- rhel-8
- rhel-9
- almalinux-8
agents:
provider: gcp
image: family/elasticsearch-{{matrix.image}}
diskSizeGb: 350
machineType: custom-16-32768
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added the testing for default Docker image here. Done by copying the whole step to keep the steps naming.
I was trying to do it with matrix with 2 params (similar to this), but AFAIK that would require changing names of all steps. I am not sure how much we are attached to these names.
Let me know what you think about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

We're not attached to the names. I think using a 2 axis matrix makes the most sense vs duplicating the step.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on using matrix with changed names we usually don't care about.

@jozala jozala requested a review from breskeby November 14, 2024 20:08
@jozala jozala marked this pull request as ready for review November 14, 2024 20:09
@jozala jozala requested a review from a team as a code owner November 14, 2024 20:09
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@elasticsearchmachine elasticsearchmachine added the Team:Delivery Meta label for Delivery team label Nov 14, 2024
Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

LGTM. FYI, we want to also move to UBI9, but that can be done in a follow up.

@jozala jozala force-pushed the ubi-as-default-docker-image branch 2 times, most recently from 3970ce5 to a67269d Compare November 22, 2024 08:58
Previously default Docker image was based on Ubuntu. This changes the
base image for default to be UBI minimal.
Removed switch expression from Gradle as it is not supported in this
version of Groovy
@jozala jozala force-pushed the ubi-as-default-docker-image branch from a67269d to 718971a Compare November 22, 2024 12:52
@jozala jozala changed the title Make UBI a default Docker image base Change default container image to be based on UBI minimal instead of Ubuntu Nov 22, 2024
@jozala jozala removed the >breaking label Nov 22, 2024
@jozala jozala merged commit bd18787 into elastic:main Nov 22, 2024
17 checks passed
smalyshev pushed a commit to smalyshev/elasticsearch that referenced this pull request Nov 22, 2024
…Ubuntu (elastic#116739)

Previously default Docker image was based on Ubuntu. This changes the
base image for default to be UBI minimal.
jozala added a commit to jozala/elasticsearch that referenced this pull request Nov 25, 2024
jozala added a commit to jozala/elasticsearch that referenced this pull request Nov 25, 2024
jozala added a commit to jozala/elasticsearch that referenced this pull request Nov 26, 2024
jozala added a commit that referenced this pull request Nov 26, 2024
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this pull request Nov 27, 2024
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
…Ubuntu (elastic#116739)

Previously default Docker image was based on Ubuntu. This changes the
base image for default to be UBI minimal.
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Cloud Cloud-specific packaging and deployment :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts >enhancement Team:Delivery Meta label for Delivery team v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants