Remove the bootstrap dependency on the Docker images we ship#16339
Remove the bootstrap dependency on the Docker images we ship#16339frouioui merged 10 commits intovitessio:mainfrom
bootstrap dependency on the Docker images we ship#16339Conversation
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 <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
ecc0b28 to
1ab2da3
Compare
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
| ${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.
We only have mysql80, since a while.
|
|
||
| # 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.
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.
|
|
||
| # 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.
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.
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.
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.
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.
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
bootstrapbootstrap dependency on the Docker images we ship
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Co-authored-by: Deepthi Sigireddi <deepthi.sigireddi@gmail.com> Signed-off-by: Florent Poinsard <35779988+frouioui@users.noreply.github.com>
Signed-off-by: Florent Poinsard <35779988+frouioui@users.noreply.github.com>
mattlord
left a comment
There was a problem hiding this comment.
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.
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.
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Login to Docker Hub | ||
| if: needs.skip_push.outputs.skip_push == 'true' |
There was a problem hiding this comment.
Why would we need to login to docker hub if we're NOT pushing?
There was a problem hiding this comment.
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.
Why not explicitly check: if: github.ref == 'refs/heads/main'?
There was a problem hiding this comment.
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 <florent.poinsard@outlook.fr>
Description
This PR removes the dependency that the
vitess/liteandvitess/vttestseverDocker images had on thevitess/bootstrapimage. We do not need to build these two images on top ofbootstrapas we end-up installing all the required dependencies in the final stage of the build anyway.The
docker/localfolder 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.goand./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 Imagesworkflow.This workflow should be marked as
requiredonce the PR is merged.Finally, some changes are needed on the
vitess-releaserto 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: