Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Docker - allow BUILD_NUMBER variable override
Browse files Browse the repository at this point in the history
  • Loading branch information
Guido Iaquinti authored and ajm188 committed Jul 2, 2020
1 parent fd71900 commit 8fa68d5
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 10 deletions.
3 changes: 3 additions & 0 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ FROM vitess/bootstrap:mysql57
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree
USER root
COPY . /vt/src/vitess.io/vitess
Expand Down
6 changes: 6 additions & 0 deletions docker/base/Dockerfile.mariadb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM vitess/bootstrap:mariadb

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree
USER root
COPY . /vt/src/vitess.io/vitess
Expand Down
6 changes: 6 additions & 0 deletions docker/base/Dockerfile.mariadb103
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM vitess/bootstrap:mariadb103

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree
USER root
COPY . /vt/src/vitess.io/vitess
Expand Down
6 changes: 6 additions & 0 deletions docker/base/Dockerfile.mysql56
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM vitess/bootstrap:mysql56

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree
USER root
COPY . /vt/src/vitess.io/vitess
Expand Down
6 changes: 6 additions & 0 deletions docker/base/Dockerfile.mysql80
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM vitess/bootstrap:mysql80

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree
USER root
COPY . /vt/src/vitess.io/vitess
Expand Down
6 changes: 6 additions & 0 deletions docker/base/Dockerfile.percona
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM vitess/bootstrap:percona

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree
USER root
COPY . /vt/src/vitess.io/vitess
Expand Down
6 changes: 6 additions & 0 deletions docker/base/Dockerfile.percona57
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM vitess/bootstrap:percona57

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree
USER root
COPY . /vt/src/vitess.io/vitess
Expand Down
6 changes: 6 additions & 0 deletions docker/base/Dockerfile.percona80
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM vitess/bootstrap:percona80

# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree
USER root
COPY . /vt/src/vitess.io/vitess
Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:mariadb103 AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.mariadb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:mariadb AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.mariadb103
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:mariadb103 AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.mysql56
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:mysql56 AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.mysql57
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:mysql57 AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.mysql80
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:mysql80 AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.percona
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:percona AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.percona57
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:percona57 AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
3 changes: 3 additions & 0 deletions docker/lite/Dockerfile.percona80
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ FROM vitess/bootstrap:percona80 AS builder
# Allows some docker builds to disable CGO
ARG CGO_ENABLED=0

# Allows docker builds to set the BUILD_NUMBER
ARG BUILD_NUMBER

# Re-copy sources from working tree.
COPY --chown=vitess:vitess . /vt/src/vitess.io/vitess

Expand Down
14 changes: 4 additions & 10 deletions tools/build_version_flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,14 @@ source $DIR/shell_functions.inc
# a tar ball might be used, which will prevent the git metadata from being available.
# Should this be the case then allow environment variables to be used to source
# this information instead.
_build_git_rev=$(git rev-parse --short HEAD)
if [ -z "$_build_git_rev" ]; then
_build_git_rev="$BUILD_GIT_REV"
fi
_build_git_branch=$(git rev-parse --abbrev-ref HEAD)
if [ -z "$_build_git_branch" ]; then
_build_git_branch="$BUILD_GIT_BRANCH"
fi
DEFAULT_BUILD_GIT_REV=$(git rev-parse --short HEAD)
DEFAULT_BUILD_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

echo "\
-X 'vitess.io/vitess/go/vt/servenv.buildHost=$(hostname)' \
-X 'vitess.io/vitess/go/vt/servenv.buildUser=$(whoami)' \
-X 'vitess.io/vitess/go/vt/servenv.buildGitRev=${_build_git_rev}' \
-X 'vitess.io/vitess/go/vt/servenv.buildGitBranch=${_build_git_branch}' \
-X 'vitess.io/vitess/go/vt/servenv.buildGitRev=${BUILD_GIT_REV:-$DEFAULT_BUILD_GIT_REV}' \
-X 'vitess.io/vitess/go/vt/servenv.buildGitBranch=${BUILD_GIT_BRANCH:-$DEFAULT_BUILD_GIT_BRANCH}' \
-X 'vitess.io/vitess/go/vt/servenv.buildTime=$(LC_ALL=C date)' \
-X 'vitess.io/vitess/go/vt/servenv.jenkinsBuildNumberStr=${BUILD_NUMBER}' \
"

0 comments on commit 8fa68d5

Please sign in to comment.