-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Remove the bootstrap
dependency on the Docker images we ship
#16339
Remove the bootstrap
dependency on the Docker images we ship
#16339
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16339 +/- ##
=======================================
Coverage 68.71% 68.71%
=======================================
Files 1547 1547
Lines 198287 198287
=======================================
+ Hits 136243 136249 +6
+ Misses 62044 62038 -6 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
ecc0b28
to
1ab2da3
Compare
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
@@ -334,7 +334,7 @@ docker_lite: | |||
docker_mini: | |||
${call build_docker_image,docker/mini/Dockerfile,vitess/mini} | |||
|
|||
DOCKER_VTTESTSERVER_SUFFIX = mysql57 mysql80 | |||
DOCKER_VTTESTSERVER_SUFFIX = mysql80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only have mysql80
, since a while.
RUN make install PREFIX=/vt/install | ||
|
||
# Start over and build the final image. | ||
FROM debian:bullseye-slim | ||
FROM --platform=linux/amd64 debian:bullseye-slim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added these --platform=linux/amd64
directives here and in other places to ensure that the base image we pull is based on linux/amd64
, that way, we can build the docker images from any machine. For instance, if we remove this directive and try to build from a Mac, the install dependencies step will fail as there are no Percona package for the Mac's architecture.
@@ -45,7 +42,7 @@ RUN groupadd -r vitess && useradd -r -g vitess vitess | |||
RUN mkdir -p /vt/vtdataroot && chown -R vitess:vitess /vt | |||
|
|||
# Set up Vitess environment (just enough to run pre-built Go binaries) | |||
ENV VTROOT /vt/src/vitess.io/vitess | |||
ENV VTROOT /vt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was wrong to begin with, leading to the error: bash: vtgate: command not found
:
$ docker run -it --user=vitess vitess/lite:v20.0.0 bash
vitess@0d7c6ece9106:/$ vtgate
bash: vtgate: command not found
vitess@0d7c6ece9106:/$
With this fix, the vitess binaries are directly in the PATH
and people can execute them without specifying the full path to the binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the fix:
$ docker run -it --user="vitess" docker.io/vitess/lite-test:latest bash
vitess@6a3782014166:/$ vtgate --version
vtgate version Version: 21.0.0-SNAPSHOT (Git revision 694a0cf8d9e51aa4b130ad1656c4009427eb0e3d branch 'remove-bootstrap-from-lite') built on Thu Jul 4 15:55:37 UTC 2024 by vitess@buildkitsandbox using go1.22.5 linux/amd64
vitess@6a3782014166:/$
"./docker/lite", | ||
"./docker/local", | ||
"./docker/vttestserver", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer update the bootstrap version in these path.
"./docker/lite/Dockerfile", | ||
"./docker/lite/Dockerfile.percona80", | ||
"./docker/vttestserver/Dockerfile.mysql80", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have to bump the golang version in more places since we base more of our images on the official go docker image.
skip_push: | ||
name: Set skip_push if we are on a Pull Request | ||
runs-on: ubuntu-20.04 | ||
if: github.repository == 'vitessio/vitess' | ||
outputs: | ||
skip_push: ${{ steps.skip_push.outputs.skip_push }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This job will be executed before everyone else. Then build_and_push_vttestserver
and build_and_push_lite
are executed concurrently. Finally, once build_and_push_lite
is done, build_and_push_components
will begin building all the binaries concurrently.
lite
and vttestserver
Docker imagebootstrap
bootstrap
bootstrap
dependency on the Docker images we ship
Signed-off-by: Florent Poinsard <[email protected]>
Co-authored-by: Deepthi Sigireddi <[email protected]> Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a few questions, but perhaps I'm missing or misunderstanding somethings?
build_and_push_vttestserver: | ||
name: Build and push vttestserver | ||
runs-on: gh-hosted-runners-16cores-1 | ||
if: github.repository == 'vitessio/vitess' && needs.skip_push.result == 'success' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github.repository == 'vitessio/vitess'
seems redundant here? And I think it's better to keep the criteria for when to skip within the skip_push step where we already check for this, if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed via e99c1a7
uses: actions/checkout@v4 | ||
|
||
- name: Login to Docker Hub | ||
if: needs.skip_push.outputs.skip_push == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we need to login to docker hub if we're NOT pushing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a really good point, the naming of skip_push
was misleading, I renamed it to push
via e99c1a7
echo "DOCKERFILE=./docker/vttestserver/Dockerfile.${{ matrix.branch }}" >> $GITHUB_ENV | ||
|
||
- name: Build and push on main | ||
if: startsWith(github.ref, 'refs/tags/') == false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not explicitly check: if: github.ref == 'refs/heads/main'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could check for this, but that will only build if the PR is based on main
. Once we create the release-21.0
branch it will no longer work on that branch.
Signed-off-by: Florent Poinsard <[email protected]>
Description
This PR removes the dependency that the
vitess/lite
andvitess/vttestsever
Docker images had on thevitess/bootstrap
image. We do not need to build these two images on top ofbootstrap
as we end-up installing all the required dependencies in the final stage of the build anyway.The
docker/local
folder is also removed as a follow up of #16335.With this PR the whole dependency chain of our images is simplified and any future work on the docker images will be easier. This is also the first step towards simplifying and potentially removing the bootstrap image, the only use right now is for our CI test (in
./test.go
and./docker/test
).I reworked our two github action workflows that enabled us to build and push docker images (
vttestserver
,lite
, and all the binaries). I merged the two workflows into a single one, which will make it easier to know if all images we ship are building correctly. Moreover, for every Pull Requests we will now try to build the Docker Images without pushing them, that way we know if we break a docker build. We often realized this too late in the past, while we were doing a release. Here is what the new workflow looks like:Note
The new workflow we are adding to CI spawns about 33 jobs that will show up on the workflows list of every Pull Request. Despite having a lot of new jobs, the time needed to complete all workflows should not be impacted by much, we need about 5-8 minutes to complete all 33 jobs of the
Build Docker Images
workflow.This workflow should be marked as
required
once the PR is merged.Finally, some changes are needed on the
vitess-releaser
to use the new workflow to ensure GHA has built all the Docker images during the release. (https://github.com/vitessio/vitess-releaser/blob/main/go/releaser/release/docker.go)This is marked as a draft, we will merge it when the following PRs are merged: