Skip to content

Conversation

Copy link

Copilot AI commented Dec 4, 2025

Docker builds were emitting warnings for InvalidDefaultArgInFrom, LegacyKeyValueFormat, and FromAsCasing across all Dockerfile templates.

Changes

  • Added default values to ARG declarations before FROM statements to satisfy InvalidDefaultArgInFrom lint rule:

    # Before
    ARG DEBIAN_VERSION
    FROM debian:${DEBIAN_VERSION}
    
    # After
    ARG DEBIAN_VERSION=9
    FROM debian:${DEBIAN_VERSION}

    Defaults are DEBIAN_VERSION=9, REPOSITORY=docker.elastic.co/beats-dev, VERSION=1.25.5. Build-time overrides via --build-arg remain unchanged.

  • Converted ENV statements to key=value format to satisfy LegacyKeyValueFormat lint rule:

    # Before
    ENV GOPATH /go
    ENV PATH $PATH:/usr/local/go/bin
    
    # After
    ENV GOPATH=/go
    ENV PATH=$PATH:/usr/local/go/bin
  • Uppercased AS keyword in multi-stage builds to satisfy FromAsCasing lint rule:

    # Before
    FROM base as stage-amd64
    
    # After
    FROM base AS stage-amd64
  • Updated .github/updatecli.d/bump-go-version.sh to maintain consistency with the new ARG VERSION= defaults:

    • Added sed command to update ARG VERSION=x.y.z in all Dockerfile.tmpl files when bumping Go versions
    • Ensures Dockerfile template defaults stay in sync with version updates from updatecli automation

All 15 Dockerfile templates updated. No functional changes—purely syntax corrections for Docker best practices and automation compatibility.

Original prompt

This section details on the original issue you should resolve

<issue_title>docker warnings in this project</issue_title>
<issue_description>```
3 warnings found (use docker --debug to expand):

  | - InvalidDefaultArgInFrom: Default value for ARG debian:${DEBIAN_VERSION} results in empty or invalid base image name (line 2)
  | - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 28)
  | - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 29)




and

;t=1723240878886 => WARN: InvalidDefaultArgInFrom: Default value for ARG ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} results in empty or invalid base 0.0s
bk;t=1723240879036 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 4) 0.0s
bk;t=1723240879036 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 39) 0.0s
bk;t=1723240879036 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 71)


<img width="1258" alt="image" src="https://github.com/user-attachments/assets/096a6c62-28c6-4ccf-9093-753468416d79">


https://buildkite.com/elastic/golang-crossbuild/builds/444#01915219-283e-4703-9997-919f05eda82f/6-50
https://buildkite.com/elastic/golang-crossbuild/builds/446#019154e7-1840-4764-bab2-3f12b6165e2a/6-10</issue_description>

<agent_instructions>You are an expert on Docker.
Do only the required changes.
Do not delete anything to pass the validation.
Investigate the different alternatives.
Make the changes simple.
</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@v1v</author><body>
@pazone , any updates?</body></comment_new>
<comment_new><author>@v1v</author><body>
@pazone , I've noticed that this issue has been open for quite some time. Could you please provide any updates?</body></comment_new>
<comment_new><author>@v1v</author><body>
> What is the severity?

I took the lead to use `P2` as something to consider, not urgent and important in case those warnings are certainly not warnings once a particular docker version is released. 

While P3 is certainly nice to have (not urgent, not important) However If I actually use the wrong assumptions please change the priority, It was not intended to enforce but a way to figure out what's critical, urgent and important while  I groomed a few dozens of GH issues</body></comment_new>
<comment_new><author>@v1v</author><body>
> Should we add it to the next sprint?

I was thinking about it, but I wanna double check our velocity, regardless, I'm in favour of low-hanging-fruit to be sorted when possible, without the burden of going through the planning board, but we can discuss about it together - like planing 70% of our work and leave some room for other things </body></comment_new>
<comment_new><author>@v1v</author><body>
@pazone , I've just unassigned you so we can revisit if you want to take a stab in the upcoming iterations</body></comment_new>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@mergify
Copy link

mergify bot commented Dec 4, 2025

This pull request does not have a backport label. Could you fix it @Copilot? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d is the label to automatically backport to the 1./d branch. /d is the digit
    NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip label Dec 4, 2025
…nd FromAsCasing

Co-authored-by: v1v <2871786+v1v@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix docker warnings in project Fix Docker build warnings in Dockerfile templates Dec 4, 2025
Copilot AI requested a review from v1v December 4, 2025 16:09
@v1v
Copy link
Member

v1v commented Dec 4, 2025

@copilot since the version is now defaulted here, update github/updatecli.d/bump-go-version.sh to change the ARG VERSION= with the new version for all the Dockefile.tmpl files.
Do the minimal changes and keep things compatible as they were

Co-authored-by: v1v <2871786+v1v@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 4, 2025

@copilot since the version is now defaulted here, update github/updatecli.d/bump-go-version.sh to change the ARG VERSION= with the new version for all the Dockefile.tmpl files.
Do the minimal chan...

Updated .github/updatecli.d/bump-go-version.sh to include ARG VERSION= updates. The script now replaces ARG VERSION=x.y.z with the new GO_RELEASE_VERSION for all Dockerfile.tmpl files. (121c9ad)

Copilot AI requested a review from v1v December 4, 2025 16:21
@v1v
Copy link
Member

v1v commented Dec 4, 2025

@copilot, confirm if running .github/updatecli.d/bump-go-version.sh 1.25.2-1 works as expected

@v1v
Copy link
Member

v1v commented Dec 4, 2025

$ .github/updatecli.d/bump-go-version.sh 1.25.2-1
Update Go version 1.25.2-1
diff --git a/go/arm/Dockerfile.tmpl b/go/arm/Dockerfile.tmpl
index e7570c9..f5ff727 100644
--- a/go/arm/Dockerfile.tmpl
+++ b/go/arm/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM --platform=linux/amd64 ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} AS stage-amd64
 
@@ -46,7 +46,7 @@ RUN apt install -y \
 {{- end }}
 
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM --platform=linux/arm64 ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION} AS stage-arm64
 
diff --git a/go/armel/Dockerfile.tmpl b/go/armel/Dockerfile.tmpl
index 5873789..5ac4ac1 100644
--- a/go/armel/Dockerfile.tmpl
+++ b/go/armel/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}
 
diff --git a/go/armhf/Dockerfile.tmpl b/go/armhf/Dockerfile.tmpl
index 87ef5ba..6dafa03 100644
--- a/go/armhf/Dockerfile.tmpl
+++ b/go/armhf/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}
 
diff --git a/go/base-arm/Dockerfile.tmpl b/go/base-arm/Dockerfile.tmpl
index 8a4c066..216831e 100644
--- a/go/base-arm/Dockerfile.tmpl
+++ b/go/base-arm/Dockerfile.tmpl
@@ -68,11 +68,11 @@ ARG VERSION
 ARG SECURITY_VERSION=-1
 ARG GOLANG_DOWNLOAD_URL=https://aka.ms/golang/release/latest/go$VERSION$SECURITY_VERSION.linux-arm64.tar.gz
 # Use a different arg name for microsoft/go sha so it can be handled seperately from the regular golang sha
-ARG MSFT_DOWNLOAD_SHA256=011bb6986c2fd978d5a74e70b5d3905ee6e35a24137732b78ec319dfdbdb077a
+ARG MSFT_DOWNLOAD_SHA256=9740a895843b92ce4c1e3d559dbeea265541efc0fda4d14e7ca995caefd7b64f
 ARG DOWNLOAD_SHA256=$MSFT_DOWNLOAD_SHA256
 {{- else}}
 ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$VERSION.linux-arm64.tar.gz
-ARG GOLANG_DOWNLOAD_SHA256=b00b694903d126c588c378e72d3545549935d3982635ba3f7a964c9fa23fe3b9
+ARG GOLANG_DOWNLOAD_SHA256=9aaeb044bf8dbf50ca2fbf0edc5ebc98b90d5bda8c6b2911526df76f61232919
 ARG DOWNLOAD_SHA256=$GOLANG_DOWNLOAD_SHA256
 {{- end}}
 
diff --git a/go/base/Dockerfile.tmpl b/go/base/Dockerfile.tmpl
index aefe6a9..9a29bea 100644
--- a/go/base/Dockerfile.tmpl
+++ b/go/base/Dockerfile.tmpl
@@ -36,11 +36,11 @@ ARG VERSION
 ARG SECURITY_VERSION=-1
 ARG GOLANG_DOWNLOAD_URL=https://aka.ms/golang/release/latest/go$VERSION$SECURITY_VERSION.linux-amd64.tar.gz
 # Use a different arg name for microsoft/go sha so it can be handled seperately from the regular golang sha
-ARG MSFT_DOWNLOAD_SHA256=48e42b9e3554e106326d326624733fa7da9c4f315cd7e04d764adeb3f285c582
+ARG MSFT_DOWNLOAD_SHA256=42746b2774e8c142a1d19699e56cbaef373beeab0f9110c2a39bf22ce71ff232
 ARG DOWNLOAD_SHA256=$MSFT_DOWNLOAD_SHA256
 {{- else}}
 ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$VERSION.linux-amd64.tar.gz
-ARG GOLANG_DOWNLOAD_SHA256=9e9b755d63b36acf30c12a9a3fc379243714c1c6d3dd72861da637f336ebb35b
+ARG GOLANG_DOWNLOAD_SHA256=d7fa7f8fbd16263aa2501d681b11f972a5fd8e811f7b10cb9b26d031a3d7454b
 ARG DOWNLOAD_SHA256=$GOLANG_DOWNLOAD_SHA256
 {{- end }}
 
diff --git a/go/darwin-arm64/Dockerfile.tmpl b/go/darwin-arm64/Dockerfile.tmpl
index 759f9ba..e341ac4 100644
--- a/go/darwin-arm64/Dockerfile.tmpl
+++ b/go/darwin-arm64/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 {{- if or (eq .DEBIAN_VERSION "10") (eq .DEBIAN_VERSION "11") (eq .DEBIAN_VERSION "12")}}
 FROM --platform=linux/arm64  docker.elastic.co/beats-dev/golang-crossbuild:llvm-apple-debian{{ .DEBIAN_VERSION }}-arm64 AS build-llvm-apple
diff --git a/go/darwin/Dockerfile.tmpl b/go/darwin/Dockerfile.tmpl
index 63e7eb9..4d196e1 100644
--- a/go/darwin/Dockerfile.tmpl
+++ b/go/darwin/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 
 {{- if or (eq .DEBIAN_VERSION "10") (eq .DEBIAN_VERSION "11") (eq .DEBIAN_VERSION "12")}}
diff --git a/go/main/Dockerfile.tmpl b/go/main/Dockerfile.tmpl
index 014aad6..c868b6f 100644
--- a/go/main/Dockerfile.tmpl
+++ b/go/main/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}
 
diff --git a/go/mips/Dockerfile.tmpl b/go/mips/Dockerfile.tmpl
index 7804750..2d46b8f 100644
--- a/go/mips/Dockerfile.tmpl
+++ b/go/mips/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}
 
diff --git a/go/mips32/Dockerfile.tmpl b/go/mips32/Dockerfile.tmpl
index a336c41..72c2fd2 100644
--- a/go/mips32/Dockerfile.tmpl
+++ b/go/mips32/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}
 
diff --git a/go/npcap/Dockerfile.tmpl b/go/npcap/Dockerfile.tmpl
index d7672d1..5d16bbc 100644
--- a/go/npcap/Dockerfile.tmpl
+++ b/go/npcap/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-main${TAG_EXTENSION}
 
diff --git a/go/ppc/Dockerfile.tmpl b/go/ppc/Dockerfile.tmpl
index 2e95c6b..33545a3 100644
--- a/go/ppc/Dockerfile.tmpl
+++ b/go/ppc/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}
 
diff --git a/go/s390x/Dockerfile.tmpl b/go/s390x/Dockerfile.tmpl
index 8dd3991..4141362 100644
--- a/go/s390x/Dockerfile.tmpl
+++ b/go/s390x/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}
 
diff --git a/go/windows-arm64/Dockerfile.tmpl b/go/windows-arm64/Dockerfile.tmpl
index 881ff14..1532e97 100644
--- a/go/windows-arm64/Dockerfile.tmpl
+++ b/go/windows-arm64/Dockerfile.tmpl
@@ -1,5 +1,5 @@
 ARG REPOSITORY=docker.elastic.co/beats-dev
-ARG VERSION=1.25.5
+ARG VERSION=1.25.2
 ARG TAG_EXTENSION=''
 
 FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base-arm${TAG_EXTENSION}

Copy link
Author

Copilot AI commented Dec 4, 2025

@copilot, confirm if running .github/updatecli.d/bump-go-version.sh 1.25.2-1 works as expected

Confirmed working as expected. Running .github/updatecli.d/bump-go-version.sh 1.25.2-1:

  • ✅ Correctly extracts MAJOR_MINOR_PATCH_VERSION=1.25.2 from 1.25.2-1
  • ✅ Updates all ARG VERSION=1.25.5 to ARG VERSION=1.25.2 in Dockerfile templates
  • ✅ Updates SHA256 hashes for both golang.org and Microsoft Go releases
  • ✅ Updates ARG SECURITY_VERSION=-1 in base templates

The script properly uses ${MAJOR_MINOR_PATCH_VERSION} (without the security suffix) for the VERSION arg, while the full version 1.25.2-1 is used for downloading and SHA validation.

@v1v v1v marked this pull request as ready for review December 4, 2025 17:40
@v1v v1v requested a review from a team as a code owner December 4, 2025 17:40
@v1v v1v requested review from a team, swiatekm and ycombinator December 4, 2025 17:40
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Dec 5, 2025
@v1v
Copy link
Member

v1v commented Dec 6, 2025

buildkite test this

@elasticmachine
Copy link

💛 Build succeeded, but was flaky

Failed CI Steps

cc @v1v @copilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-skip Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker warnings in this project

6 participants