Skip to content
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 vitess/base and vitess/k8s Docker images #15620

Merged
merged 10 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Build Base
name: Docker Build Images
on:
push:
branches:
Expand All @@ -7,21 +7,21 @@ on:
- '*'

concurrency:
group: format('{0}-{1}', ${{ github.ref }}, 'Docker Build Base')
group: format('{0}-{1}', ${{ github.ref }}, 'Docker Build Images')
cancel-in-progress: true

permissions: read-all

jobs:
build_and_push_base:
name: Build and push vitess/base Docker images
build_and_push_lite:
name: Build and push vitess/lite Docker images
runs-on: gh-hosted-runners-16cores-1
if: github.repository == 'vitessio/vitess'

strategy:
fail-fast: true
matrix:
branch: [ latest, mysql57, percona57, percona80 ]
branch: [ latest ]

steps:
- name: Check out code
Expand All @@ -36,9 +36,9 @@ jobs:
- name: Set Dockerfile path
run: |
if [[ "${{ matrix.branch }}" == "latest" ]]; then
echo "DOCKERFILE=./docker/base/Dockerfile" >> $GITHUB_ENV
echo "DOCKERFILE=./docker/lite/Dockerfile" >> $GITHUB_ENV
else
echo "DOCKERFILE=./docker/base/Dockerfile.${{ matrix.branch }}" >> $GITHUB_ENV
echo "DOCKERFILE=./docker/lite/Dockerfile.${{ matrix.branch }}" >> $GITHUB_ENV
fi

- name: Build and push on main
Expand All @@ -48,125 +48,33 @@ jobs:
context: .
file: ${{ env.DOCKERFILE }}
push: true
tags: vitess/base:${{ matrix.branch }}
tags: vitess/lite:${{ matrix.branch }}

######
# All code below only applies to new tags
######

- name: Get the Git tag
if: startsWith(github.ref, 'refs/tags/')
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Set Docker tag name
if: startsWith(github.ref, 'refs/tags/') && matrix.branch == 'latest'
if: startsWith(github.ref, 'refs/tags/')
run: |
if [[ "${{ matrix.branch }}" == "latest" ]]; then
echo "DOCKER_TAG=vitess/base:${TAG_NAME}" >> $GITHUB_ENV
echo "DOCKER_TAG=vitess/lite:${TAG_NAME}" >> $GITHUB_ENV
else
echo "DOCKER_TAG=vitess/lite:${TAG_NAME}-${{ matrix.branch }}" >> $GITHUB_ENV
fi

- name: Build and push on tags
if: startsWith(github.ref, 'refs/tags/') && matrix.branch == 'latest'
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKERFILE }}
push: true
tags: ${{ env.DOCKER_TAG }}

build_and_push_k8s:
needs: build_and_push_base
name: Build and push vitess/k8s image
runs-on: gh-hosted-runners-16cores-1
if: github.repository == 'vitessio/vitess'

strategy:
fail-fast: true
matrix:
debian: [ bullseye, bookworm ]

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set Docker context path
run: |
echo "DOCKER_CTX=./docker/k8s" >> $GITHUB_ENV

- name: Build and push on main latest tag
if: github.ref == 'refs/heads/main' && matrix.debian == 'bookworm'
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_CTX }}
push: true
tags: vitess/k8s:latest
build-args: |
VT_BASE_VER=latest
DEBIAN_VER=${{ matrix.debian }}-slim

- name: Build and push on main debian specific tag
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_CTX }}
push: true
tags: vitess/k8s:latest-${{ matrix.debian }}
build-args: |
VT_BASE_VER=latest
DEBIAN_VER=${{ matrix.debian }}-slim

######
# All code below only applies to new tags
######

- name: Get the Git tag
if: startsWith(github.ref, 'refs/tags/')
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

# We push git-tag-based k8s image to three tags, i.e. for 'v19.0.0' we push to:
#
# vitess/k8s:v19.0.0 (DOCKER_TAG_DEFAULT_DEBIAN)
# vitess/k8s:v19.0.0-bookworm (DOCKER_TAG)
# vitess/k8s:v19.0.0-bullseye (DOCKER_TAG)
#
- name: Set Docker tag name
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "DOCKER_TAG_DEFAULT_DEBIAN=vitess/k8s:${TAG_NAME}" >> $GITHUB_ENV
echo "DOCKER_TAG=vitess/k8s:${TAG_NAME}-${{ matrix.debian }}" >> $GITHUB_ENV

# Build and Push component image to DOCKER_TAG, applies to both debian version
- name: Build and push on tags using Debian extension
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_CTX }}
push: true
tags: ${{ env.DOCKER_TAG }}
build-args: |
VT_BASE_VER=${{ env.TAG_NAME }}
DEBIAN_VER=${{ matrix.debian }}-slim

# Build and Push component image to DOCKER_TAG_DEFAULT_DEBIAN, only applies when building the default Debian version (bookworm)
# It is fine to build a second time here when "matrix.debian == 'bookworm'" as we have cached the first build already
- name: Build and push on tags without Debian extension
if: startsWith(github.ref, 'refs/tags/') && matrix.debian == 'bookworm'
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_CTX }}
push: true
tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }}
build-args: |
VT_BASE_VER=${{ env.TAG_NAME }}
DEBIAN_VER=${{ matrix.debian }}-slim


build_and_push_components:
needs: build_and_push_k8s
name: Build and push vitess components Docker images
Expand All @@ -191,7 +99,7 @@ jobs:

- name: Set Docker context path
run: |
echo "DOCKER_CTX=./docker/k8s/${{ matrix.component }}" >> $GITHUB_ENV
echo "DOCKER_CTX=./docker/binaries/${{ matrix.component }}" >> $GITHUB_ENV

- name: Build and push on main latest tag
if: github.ref == 'refs/heads/main' && matrix.debian == 'bookworm'
Expand Down Expand Up @@ -258,4 +166,4 @@ jobs:
tags: ${{ env.DOCKER_TAG_DEFAULT_DEBIAN }}
build-args: |
VT_BASE_VER=${{ env.TAG_NAME }}
DEBIAN_VER=${{ matrix.debian }}-slim
DEBIAN_VER=${{ matrix.debian }}-slim
73 changes: 0 additions & 73 deletions .github/workflows/docker_build_lite.yml

This file was deleted.

26 changes: 1 addition & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ endif
install: build
# binaries
mkdir -p "$${PREFIX}/bin"
cp "$${VTROOTBIN}/"{mysqlctl,mysqlctld,vtorc,vtadmin,vtctld,vtctlclient,vtctldclient,vtgate,vttablet,vtbackup} "$${PREFIX}/bin/"
cp "$${VTROOTBIN}/"{mysqlctl,mysqlctld,vtorc,vtadmin,vtctl,vtctld,vtctlclient,vtctldclient,vtgate,vttablet,vtbackup,vtexplain} "$${PREFIX}/bin/"
Copy link
Member Author

Choose a reason for hiding this comment

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

The image vitess/k8s now relies on vitess/lite, which runs make install. In vitess/k8s we copy these binaries so they are available for the binary-specific images. I had to add the missing binaries that we use in vitess/k8s.


# Will only work inside the docker bootstrap for now
cross-install: cross-build
Expand Down Expand Up @@ -318,16 +318,6 @@ define build_docker_image
fi
endef

docker_base:
${call build_docker_image,docker/base/Dockerfile,vitess/base}

DOCKER_BASE_SUFFIX = mysql80 percona57 percona80
DOCKER_BASE_TARGETS = $(addprefix docker_base_, $(DOCKER_BASE_SUFFIX))
$(DOCKER_BASE_TARGETS): docker_base_%:
${call build_docker_image,docker/base/Dockerfile.$*,vitess/base:$*}

docker_base_all: docker_base $(DOCKER_BASE_TARGETS)

docker_lite:
${call build_docker_image,docker/lite/Dockerfile,vitess/lite}

Expand Down Expand Up @@ -365,20 +355,6 @@ docker_test:
docker_unit_test:
go run test.go -flavor $(flavor) unit

# Release a version.
# This will generate a tar.gz file into the releases folder with the current source
release: docker_base
Comment on lines -368 to -370
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed docker/release and the corresponding make command as it seems to not be used and very ancient.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. It was being used by the pre-GH release process.

@if [ -z "$VERSION" ]; then \
echo "Set the env var VERSION with the release version"; exit 1;\
fi
mkdir -p releases
docker build -f docker/Dockerfile.release -t vitess/release .
docker run -v ${PWD}/releases:/vt/releases --env VERSION=$(VERSION) vitess/release
git tag -m Version\ $(VERSION) v$(VERSION)
echo "A git tag was created, you can push it with:"
echo "git push origin v$(VERSION)"
echo "Also, don't forget the upload releases/v$(VERSION).tar.gz file to GitHub releases"

create_release:
./tools/create_release.sh

Expand Down
7 changes: 7 additions & 0 deletions changelog/20.0/20.0.0/summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- **[Major Changes](#major-changes)**
- **[Deletions](#deletions)**
- [MySQL binaries in the vitess/lite Docker images](#vitess-lite)
- [vitess/base and vitess/k8s Docker images](#base-k8s-images)
- **[Breaking changes](#breaking-changes)**
- [`shutdown_grace_period` Default Change](#shutdown-grace-period-default)
- [New `unmanaged` Flag and `disable_active_reparents` deprecation](#unmanaged-flag)
Expand Down Expand Up @@ -71,6 +72,12 @@ Below is an example of a kubernetes yaml file before and after upgrading to an o
mysql80Compatible: mysql:8.0.30 # or even mysql:8.0.34 for instance
```

#### <a id="base-k8s-images"/>`vitess/base` and `vitess/k8s` Docker images

Since we have deleted MySQL from our `vitess/lite` image, we are removing the `vitess/base` and `vitess/k8s` images.

These images are no longer useful since we can use `vitess/lite` as the base of many other Docker images (`vitess/vtgate`, `vitess/vtgate`, ...).

### <a id="breaking-changes"/>Breaking Changes

#### <a id="shutdown-grace-period-default"/>`shutdown_grace_period` Default Change
Expand Down
16 changes: 1 addition & 15 deletions doc/DockerBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,8 @@ Then you can run our build script for the `lite` image which extracts the Vitess
image on your machine before then it could be old, which may cause build
failures. So it would be a good idea to always execute this step.

1. Build the `vitess/base[:<flavor>]` image.
It will include the compiled the Vitess binaries.
(`vitess/base` also contains the source code and tests i.e. everything needed for development work.)

Choose one of the following commands (the command without suffix builds
the default image containing MySQL 5.7):

```sh
vitess$ make docker_base
vitess$ make docker_base_mysql56
vitess$ make docker_base_percona57
vitess$ make docker_base_percona
```

1. Build the `vitess/lite[:<flavor>]` image.
This will run a script that extracts from `vitess/base` only the files
This will run a script that extracts from `vitess/bootstrap` only the files
needed to run Vitess.

Choose one of the following commands (the command without suffix builds
Expand Down
25 changes: 0 additions & 25 deletions docker/Dockerfile.release

This file was deleted.

Loading
Loading