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

Add Version to Bootstrap Image #7182

Merged
merged 10 commits into from
Dec 18, 2020
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
131 changes: 30 additions & 101 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,119 +190,57 @@ $(PROTO_GO_OUTS): install_protoc-gen-go proto/*.proto
# This rule builds the bootstrap images for all flavors.
DOCKER_IMAGES_FOR_TEST = mariadb mariadb103 mysql56 mysql57 mysql80 percona percona57 percona80
DOCKER_IMAGES = common $(DOCKER_IMAGES_FOR_TEST)
BOOTSTRAP_VERSION=0
ensure_bootstrap_version:
find docker/ -type f -exec sed -i "s/^\(ARG bootstrap_version\)=.*/\1=${BOOTSTRAP_VERSION}/" {} \;
sed -i 's/\(^.*flag.String(\"bootstrap-version\",\) *\"[^\"]\+\"/\1 \"${BOOTSTRAP_VERSION}\"/' test.go

docker_bootstrap:
for i in $(DOCKER_IMAGES); do echo "building bootstrap image: $$i"; docker/bootstrap/build.sh $$i || exit 1; done
for i in $(DOCKER_IMAGES); do echo "building bootstrap image: $$i"; docker/bootstrap/build.sh $$i ${BOOTSTRAP_VERSION} || exit 1; done

docker_bootstrap_test:
flavors='$(DOCKER_IMAGES_FOR_TEST)' && ./test.go -pull=false -parallel=2 -flavor=$${flavors// /,}
flavors='$(DOCKER_IMAGES_FOR_TEST)' && ./test.go -pull=false -parallel=2 -bootstrap-version=${BOOTSTRAP_VERSION} -flavor=$${flavors// /,}

docker_bootstrap_push:
for i in $(DOCKER_IMAGES); do echo "pushing bootstrap image: $$i"; docker push vitess/bootstrap:$$i || exit 1; done
for i in $(DOCKER_IMAGES); do echo "pushing bootstrap image: ${BOOTSTRAP_VERSION}-$$i"; docker push vitess/bootstrap:${BOOTSTRAP_VERSION}-$$i || exit 1; done

# Use this target to update the local copy of your images with the one on Dockerhub.
docker_bootstrap_pull:
for i in $(DOCKER_IMAGES); do echo "pulling bootstrap image: $$i"; docker pull vitess/bootstrap:$$i || exit 1; done

docker_base:
# Fix permissions before copying files, to avoid AUFS bug.
chmod -R o=g *
docker build -f docker/base/Dockerfile -t vitess/base .
for i in $(DOCKER_IMAGES); do echo "pulling bootstrap image: $$i"; docker pull vitess/bootstrap:${BOOTSTRAP_VERSION}-$$i || exit 1; done

docker_base_mysql56:
chmod -R o=g *
docker build -f docker/base/Dockerfile.mysql56 -t vitess/base:mysql56 .

docker_base_mysql80:
chmod -R o=g *
docker build -f docker/base/Dockerfile.mysql80 -t vitess/base:mysql80 .

docker_base_mariadb:
chmod -R o=g *
docker build -f docker/base/Dockerfile.mariadb -t vitess/base:mariadb .

docker_base_mariadb103:
chmod -R o=g *
docker build -f docker/base/Dockerfile.mariadb -t vitess/base:mariadb103 .
define build_docker_image
# Fix permissions before copying files, to avoid AUFS bug.
${info Building ${2}}
chmod -R o=g *;
docker build -f ${1} -t ${2} --build-arg bootstrap_version=${BOOTSTRAP_VERSION} .;
endef

docker_base_percona:
chmod -R o=g *
docker build -f docker/base/Dockerfile.percona -t vitess/base:percona .
docker_base:
${call build_docker_image,docker/base/Dockerfile,vitess/base}

docker_base_percona57:
chmod -R o=g *
docker build -f docker/base/Dockerfile.percona57 -t vitess/base:percona57 .
DOCKER_BASE_SUFFIX = mysql56 mysql80 mariadb mariadb103 percona 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_percona80:
chmod -R o=g *
docker build -f docker/base/Dockerfile.percona80 -t vitess/base:percona80 .
docker_base_all: docker_base $(DOCKER_BASE_TARGETS)

docker_lite:
chmod -R o=g *
docker build -f docker/lite/Dockerfile -t vitess/lite .

docker_lite_mysql56:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.mysql56 -t vitess/lite:mysql56 .

docker_lite_mysql57:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.mysql57 -t vitess/lite:mysql57 .

docker_lite_ubi7.mysql57:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.ubi7.mysql57 -t vitess/lite:ubi7.mysql57 .

docker_lite_mysql80:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.mysql80 -t vitess/lite:mysql80 .

docker_lite_ubi7.mysql80:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.ubi7.mysql80 -t vitess/lite:ubi7.mysql80 .
${call build_docker_image,docker/lite/Dockerfile,vitess/lite}

docker_lite_mariadb:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.mariadb -t vitess/lite:mariadb .
DOCKER_LITE_SUFFIX = mysql56 mysql57 ubi7.mysql57 mysql80 ubi7.mysql80 mariadb mariadb103 percona percona57 ubi7.percona57 percona80 ubi7.percona80 alpine testing
DOCKER_LITE_TARGETS = $(addprefix docker_lite_,$(DOCKER_LITE_SUFFIX))
$(DOCKER_LITE_TARGETS): docker_lite_%:
${call build_docker_image,docker/lite/Dockerfile.$*,vitess/lite:$*}

docker_lite_mariadb103:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.mariadb103 -t vitess/lite:mariadb103 .

docker_lite_percona:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.percona -t vitess/lite:percona .

docker_lite_percona57:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.percona57 -t vitess/lite:percona57 .

docker_lite_ubi7.percona57:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.ubi7.percona57 -t vitess/lite:ubi7.percona57 .

docker_lite_percona80:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.percona80 -t vitess/lite:percona80 .

docker_lite_ubi7.percona80:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.ubi7.percona80 -t vitess/lite:ubi7.percona80 .

docker_lite_alpine:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.alpine -t vitess/lite:alpine .

docker_lite_testing:
chmod -R o=g *
docker build -f docker/lite/Dockerfile.testing -t vitess/lite:testing .
docker_lite_all: docker_lite $(DOCKER_LITE_TARGETS)

docker_local:
chmod -R o=g *
docker build -f docker/local/Dockerfile -t vitess/local .
${call build_docker_image,docker/local/Dockerfile,vitess/local}

docker_mini:
chmod -R o=g *
docker build -f docker/mini/Dockerfile -t vitess/mini .
${call build_docker_image,docker/mini/Dockerfile,vitess/mini}

# This rule loads the working copy of the code into a bootstrap image,
# and then runs the tests inside Docker.
Expand All @@ -327,15 +265,6 @@ release: docker_base
echo "git push origin v$(VERSION)"
echo "Also, don't forget the upload releases/v$(VERSION).tar.gz file to GitHub releases"

packages: docker_base
@if [ -z "$VERSION" ]; then \
echo "Set the env var VERSION with the release version"; exit 1;\
fi
mkdir -p releases
docker build -f docker/packaging/Dockerfile -t vitess/packaging .
docker run --rm -v ${PWD}/releases:/vt/releases --env VERSION=$(VERSION) vitess/packaging --package /vt/releases -t deb --deb-no-default-config-files
docker run --rm -v ${PWD}/releases:/vt/releases --env VERSION=$(VERSION) vitess/packaging --package /vt/releases -t rpm

tools:
echo $$(date): Installing dependencies
./bootstrap.sh
Expand Down
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ install_all() {

# chromedriver
if [ "$BUILD_CHROME" == 1 ] ; then
install_dep "chromedriver" "73.0.3683.20" "$VTROOT/dist/chromedriver" install_chromedriver
install_dep "chromedriver" "83.0.4103.14" "$VTROOT/dist/chromedriver" install_chromedriver
fi

echo
Expand Down
6 changes: 5 additions & 1 deletion docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
# therefore we need to have the symlinked "Dockerfile" in there as well.
# TODO(mberlin): Remove the symlink and this note once
# https://github.com/docker/hub-feedback/issues/292 is fixed.
FROM vitess/bootstrap:mysql57

ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-mysql57"

FROM "${image}"

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0
Expand Down
5 changes: 4 additions & 1 deletion docker/base/Dockerfile.mariadb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:mariadb
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-mariadb"

FROM "${image}"

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0
Expand Down
5 changes: 4 additions & 1 deletion docker/base/Dockerfile.mariadb103
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:mariadb103
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-mariadb103"

FROM "${image}"

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0
Expand Down
5 changes: 4 additions & 1 deletion docker/base/Dockerfile.mysql56
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:mysql56
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-mysql56"

FROM "${image}"

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0
Expand Down
5 changes: 4 additions & 1 deletion docker/base/Dockerfile.mysql80
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:mysql80
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-mysql80"

FROM "${image}"

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0
Expand Down
5 changes: 4 additions & 1 deletion docker/base/Dockerfile.percona
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:percona
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-percona"

FROM "${image}"

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0
Expand Down
5 changes: 4 additions & 1 deletion docker/base/Dockerfile.percona57
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:percona57
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-percona57"

FROM "${image}"

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0
Expand Down
5 changes: 4 additions & 1 deletion docker/base/Dockerfile.percona80
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:percona80
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-percona80"

FROM "${image}"

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0
Expand Down
1 change: 1 addition & 0 deletions docker/bootstrap/Dockerfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
software-properties-common \
unzip \
zip \
xvfb \
&& rm -rf /var/lib/apt/lists/*

# Set up Vitess environment (equivalent to '. dev.env')
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.mariadb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install MariaDB 10
RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keys.gnupg.net --recv-keys 9334A25F8507EFA5 && break; done && \
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.mariadb103
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install MariaDB 10.3
RUN apt-key adv --no-tty --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 \
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.mysql56
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install MySQL 5.6
#
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.mysql57
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install MySQL 5.7
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gnupg dirmngr ca-certificates && \
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.mysql57-arm64v8
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ RUN apt-get update && \
make -j4 && \
make install

FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install MySQL 5.7
RUN add-apt-repository 'deb http://ftp.debian.org/debian sid main' && \
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.mysql80
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install MySQL 8.0
RUN for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver ha.pool.sks-keyservers.net 8C718D3B5072E1F5 && break; done && \
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.percona
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install Percona 5.6
#
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.percona57
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install Percona 5.7
RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keys.gnupg.net --recv-keys 9334A25F8507EFA5 && break; done && \
Expand Down
5 changes: 4 additions & 1 deletion docker/bootstrap/Dockerfile.percona80
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM vitess/bootstrap:common
ARG bootstrap_version
ARG image="vitess/bootstrap:${bootstrap_version}-common"

FROM "${image}"

# Install Percona 8.0
RUN for i in $(seq 1 10); do apt-key adv --no-tty --keyserver keys.gnupg.net --recv-keys 9334A25F8507EFA5 && break; done \
Expand Down
6 changes: 4 additions & 2 deletions docker/bootstrap/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
# limitations under the License.

flavor=$1

if [[ -z "$flavor" ]]; then
echo "Flavor must be specified as first argument."
exit 1
fi

# Set default version of 0
version="${2:-0}"

if [[ ! -f bootstrap.sh ]]; then
echo "This script should be run from the root of the Vitess source tree - e.g. ~/src/vitess.io/vitess"
exit 1
Expand All @@ -32,5 +34,5 @@ chmod -R o=g *
arch=$(uname -m)
[ "$arch" == "aarch64" ] && [ $flavor != "common" ] && arch_ext='-arm64v8'
if [ -f "docker/bootstrap/Dockerfile.$flavor$arch_ext" ]; then
docker build --no-cache -f docker/bootstrap/Dockerfile.$flavor$arch_ext -t vitess/bootstrap:$flavor$arch_ext .
docker build --no-cache -f docker/bootstrap/Dockerfile.$flavor$arch_ext -t vitess/bootstrap:$version-$flavor$arch_ext --build-arg bootstrap_version=$version .
fi
5 changes: 4 additions & 1 deletion docker/lite/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
# ensure images contain the right binaries.

# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mariadb103 AS builder
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-mariadb103"

FROM "${image}" AS builder

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER
Expand Down
5 changes: 4 additions & 1 deletion docker/lite/Dockerfile.mariadb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
# ensure images contain the right binaries.

# Use a temporary layer for the build stage.
FROM vitess/bootstrap:mariadb AS builder
ARG bootstrap_version=0
ARG image="vitess/bootstrap:${bootstrap_version}-mariadb"

FROM "${image}" AS builder

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER
Expand Down
Loading