Skip to content

Docker: Address build file CI warnings#19363

Merged
mattlord merged 16 commits intomainfrom
dockerfile_platform_var
Feb 20, 2026
Merged

Docker: Address build file CI warnings#19363
mattlord merged 16 commits intomainfrom
dockerfile_platform_var

Conversation

@mattlord
Copy link
Member

@mattlord mattlord commented Feb 11, 2026

Description

This addresses the following warnings that we've been getting for our docker files:

FROM --platform flag should not use a constant value
FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64"
More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/
Legacy key/value format with whitespace separator should not be used
LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format
More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Signed-off-by: Matt Lord <mattalord@gmail.com>
@github-actions github-actions bot added this to the v24.0.0 milestone Feb 11, 2026
@vitess-bot vitess-bot bot added NeedsWebsiteDocsUpdate What it says NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Feb 11, 2026
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Feb 11, 2026

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@mattlord mattlord added Type: Internal Cleanup Component: Build/CI and removed NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Feb 11, 2026
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord removed the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Feb 11, 2026
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord force-pushed the dockerfile_platform_var branch from c7bdbd2 to b79a121 Compare February 11, 2026 17:48
@github-actions github-actions bot added the Type: Dependencies Dependency updates label Feb 11, 2026
@mattlord mattlord force-pushed the dockerfile_platform_var branch from b79a121 to 639118e Compare February 11, 2026 17:50
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord force-pushed the dockerfile_platform_var branch from 639118e to a6071ab Compare February 11, 2026 17:51
@mattlord mattlord marked this pull request as ready for review February 11, 2026 18:18
Copilot AI review requested due to automatic review settings February 11, 2026 18:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Vitess’ Docker build definitions to eliminate Dockerfile linter warnings by removing hard-coded FROM --platform=linux/amd64 values and switching legacy ENV key value syntax to ENV key=value in the lite images.

Changes:

  • Replace constant --platform=linux/amd64 with --platform=${BUILDPLATFORM} across multiple Dockerfiles.
  • Update ENV statements in docker/lite/* Dockerfiles to the non-legacy key=value format.
  • Add a default BUILDPLATFORM export to build.env.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
docker/vttestserver/Dockerfile.mysql84 Switches FROM --platform to ${BUILDPLATFORM} for builder and final stages.
docker/vttestserver/Dockerfile.mysql80 Switches FROM --platform to ${BUILDPLATFORM} for builder and final stages.
docker/lite/Dockerfile.percona84 Switches FROM --platform to ${BUILDPLATFORM}; updates ENV to key=value.
docker/lite/Dockerfile.percona80 Switches FROM --platform to ${BUILDPLATFORM}; updates ENV to key=value.
docker/lite/Dockerfile.mysql84 Switches FROM --platform to ${BUILDPLATFORM}; updates ENV to key=value.
docker/lite/Dockerfile.mysql80 Switches FROM --platform to ${BUILDPLATFORM}; updates ENV to key=value.
docker/lite/Dockerfile Switches FROM --platform to ${BUILDPLATFORM}; updates ENV to key=value.
docker/bootstrap/Dockerfile.percona84 Switches FROM --platform to ${BUILDPLATFORM}.
docker/bootstrap/Dockerfile.percona80 Switches FROM --platform to ${BUILDPLATFORM}.
docker/bootstrap/Dockerfile.mysql84 Switches FROM --platform to ${BUILDPLATFORM}.
docker/bootstrap/Dockerfile.mysql80 Switches FROM --platform to ${BUILDPLATFORM}.
docker/bootstrap/Dockerfile.common Switches FROM --platform to ${BUILDPLATFORM}.
build.env Exports BUILDPLATFORM with a default of linux/amd64.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mattlord mattlord changed the title Docker: Address FROM --platform flag should not use a constant value warnings Docker: Address build file CI warnings Feb 11, 2026
@mattlord mattlord force-pushed the dockerfile_platform_var branch 2 times, most recently from 57bcd5b to 3ba53b0 Compare February 12, 2026 00:47
Signed-off-by: Matt Lord <mattalord@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@arthurschreiber
Copy link
Member

This addresses the warnings, but I'm not sure I like the solution. 😅

How do you feel about adding --platform=linux/amd64 explicitly when we call docker build, and removing the --platform argument inside the Dockerfiles? 🤔

I also noticed that Percona actually publishes official ARM builds for their packages, so I guess we could publish amd64 and arm64 builds for those container images (not as part of this PR, of course).

@mattlord
Copy link
Member Author

mattlord commented Feb 12, 2026

This addresses the warnings, but I'm not sure I like the solution. 😅

How do you feel about adding --platform=linux/amd64 explicitly when we call docker build, and removing the --platform argument inside the Dockerfiles? 🤔

I also noticed that Percona actually publishes official ARM builds for their packages, so I guess we could publish amd64 and arm64 builds for those container images (not as part of this PR, of course).

What don't you like? What do you think would be better? Note that we do currently have this in the Makefile:

define build_docker_image
        ${info Building ${2}}
        # Fix permissions before copying files, to avoid AUFS bug other must have read/access permissions
        chmod -R o=rx *;

        if grep -q arm64 <<< ${2}; then \
                echo "Building docker using arm64 buildx"; \
                docker buildx build --platform linux/arm64 -f ${1} -t ${2} --build-arg bootstrap_version=${BOOTSTRAP_VERSION} .; \
        elif [ $$(go env GOOS) != $$(go env GOHOSTOS) ] || [ $$(go env GOARCH) != $$(go env GOHOSTARCH) ]; then \
                echo "Building docker using buildx --platform=$$(go env GOOS)/$$(go env GOARCH)"; \
                docker buildx build --platform "$$(go env GOOS)/$$(go env GOARCH)" -f ${1} -t ${2} --build-arg bootstrap_version=${BOOTSTRAP_VERSION} .; \
        else \
                echo "Building docker using straight docker build"; \
                docker build -f ${1} -t ${2} --build-arg bootstrap_version=${BOOTSTRAP_VERSION} .; \
        fi
endef

You're suggesting we move the platform flag there for the amd64 builds as well? I'm good with that too. Let me know if I misunderstood. We'd have to do that in a few other places too, but not a big deal:

docker/bootstrap/build.sh:    docker build \
docker/bootstrap/docker-bake.hcl://   docker buildx bake -f docker/bootstrap/docker-bake.hcl
docker/bootstrap/docker-bake.hcl://   docker buildx bake -f docker/bootstrap/docker-bake.hcl --set *.tags=myregistry/bootstrap:mytag
docker/vttestserver/README.md:docker build -f docker/vtttestserver/Dockerfile.mysql80 -t vitess/vttestserver:v21.0.0-rc1-mysql80 .
go/mysql/collations/tools/colldump/colldump.sh:docker build --tag mysql-collation-data .
test/vtop_example.sh:docker build -f docker/lite/Dockerfile -t vitess/lite:pr .
test/vtop_example.sh:docker build -f docker/binaries/vtadmin/Dockerfile --build-arg VT_BASE_VER=pr -t vitess/vtadmin:pr ./docker/binaries/vtadmin

We know that we want to support ARM64, that has been an ongoing thing that I thought we might finally do for v24 (but the contact I was working with on the ARM side has gone quiet). This work resolves the linter warnings and removes our usage of deprecated things (which could be removed at any point), while also adding an ENV variable that can be used to build for other target platforms such as ARM64.

Signed-off-by: Matt Lord <mattalord@gmail.com>
@arthurschreiber
Copy link
Member

I think the failures will be fixed by #19371.

Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord force-pushed the dockerfile_platform_var branch 2 times, most recently from e444e2c to 8440651 Compare February 15, 2026 15:00
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord force-pushed the dockerfile_platform_var branch from 8440651 to 8331387 Compare February 15, 2026 15:13
Signed-off-by: Matt Lord <mattalord@gmail.com>
@codecov
Copy link

codecov bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.65%. Comparing base (abc6891) to head (ced4dba).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19363      +/-   ##
==========================================
- Coverage   69.67%   69.65%   -0.02%     
==========================================
  Files        1613     1614       +1     
  Lines      216459   216700     +241     
==========================================
+ Hits       150807   150937     +130     
- Misses      65652    65763     +111     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord merged commit 1433876 into main Feb 20, 2026
232 of 236 checks passed
@mattlord mattlord deleted the dockerfile_platform_var branch February 20, 2026 04:09
mhamza15 pushed a commit to mhamza15/vitess that referenced this pull request Feb 23, 2026
Signed-off-by: Matt Lord <mattalord@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants