Skip to content

Address review feedback on es default docker image #126330

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

Merged
merged 9 commits into from
Apr 10, 2025

Conversation

breskeby
Copy link
Contributor

@breskeby breskeby commented Apr 4, 2025

This addresses feedback we got for our default image at docker-library/official-images#18692

This also introduces separate docker source files to make maintaining those easier.

@breskeby breskeby requested a review from a team as a code owner April 4, 2025 16:52
@breskeby breskeby added >non-issue :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team auto-backport Automatically create backport pull requests when merged v8.19.0 v9.1.0 labels Apr 4, 2025
@breskeby breskeby self-assigned this Apr 4, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@breskeby breskeby added :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts v9.0.0 labels Apr 4, 2025
@breskeby breskeby force-pushed the rework-docker branch 4 times, most recently from 9a974b8 to 60b0be6 Compare April 7, 2025 16:36
Copy link
Contributor

@jozala jozala left a comment

Choose a reason for hiding this comment

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

I really like having Dockerfile.default as a separate definition. It makes it much easier to understand.
I have a few questions with possible improvements.

Comment on lines 47 to 49
DockerBase(String image, String suffix) {
this(image, suffix, "apt-get");
this(image, suffix, "apt-get", "dockerfile");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't found any usage of this constructor. Is it possible to remove it?

Comment on lines 204 to 207
from(projectDir.resolve("src/docker/${base.dockerfile}")) {
expand(varExpansions)
filter SquashNewlinesFilter
rename ~/Dockerfile\..+$/, 'Dockerfile'
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand that these files should by convention be named Dockerfile.*. However, there are no limitations in what will be set as DockerBase.dockerfile, so maybe it would be safer to do rename like this?

rename base.dockerfile, 'Dockerfile`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

if (details.name.equals("Dockerfile")) {
filter { String contents ->
return contents.replaceAll('^RUN *.*artifacts-no-kpi.*$', "COPY $distributionFolderName .")
.replaceAll('^RUN tar -zxf /tmp/elasticsearch.tar.gz --strip-components=1 &&', "RUN ")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we avoid this second replaceAll by changing the Dockerfile.default?

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'm not sure. it would come with the cost of another docker operatino. What we avoid when using a local distro is the unpackaging bit. not sure how to change the docker file to make this efficient to cover both scenarios

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I've missed the point here. I can see now that these two replaceAll operations are related.
What I still don't get is what is the condition (and where it is) which decides if this transformation for Dockerfile will be executed.
Could you please point me to it?

@breskeby
Copy link
Contributor Author

breskeby commented Apr 8, 2025

@breskeby breskeby merged commit ca19573 into elastic:main Apr 10, 2025
17 of 18 checks passed
@breskeby breskeby deleted the rework-docker branch April 10, 2025 15:14
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Apr 10, 2025
This addresses feedback we got for our default image at docker-library/official-images#18692
This also introduces separate docker source files to make maintaining those easier.

We cannot take over all suggested changes as we require certain settings to have our packaging tests pass as expected.
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.0
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 126330

elasticsearchmachine pushed a commit that referenced this pull request Apr 10, 2025
This addresses feedback we got for our default image at docker-library/official-images#18692
This also introduces separate docker source files to make maintaining those easier.

We cannot take over all suggested changes as we require certain settings to have our packaging tests pass as expected.
@breskeby
Copy link
Contributor Author

breskeby commented May 2, 2025

💚 All backports created successfully

Status Branch Result
8.19

Questions ?

Please refer to the Backport tool documentation

breskeby added a commit to breskeby/elasticsearch that referenced this pull request May 2, 2025
This addresses feedback we got for our default image at docker-library/official-images#18692
This also introduces separate docker source files to make maintaining those easier.

We cannot take over all suggested changes as we require certain settings to have our packaging tests pass as expected.

(cherry picked from commit ca19573)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DockerBase.java
#	distribution/docker/src/docker/Dockerfile
breskeby added a commit that referenced this pull request May 2, 2025
* Address review feedback on es default docker image (#126330)

This addresses feedback we got for our default image at docker-library/official-images#18692
This also introduces separate docker source files to make maintaining those easier.

We cannot take over all suggested changes as we require certain settings to have our packaging tests pass as expected.

(cherry picked from commit ca19573)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DockerBase.java
#	distribution/docker/src/docker/Dockerfile

* Adjust docker fips entrypoint and cmd (#127630)

Also extract docker fips configuration in explicit docker file

* Fix merge issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged backport pending :Delivery/Build Build or test infrastructure :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts >non-issue Team:Delivery Meta label for Delivery team v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants