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

Docker - allow BUILD_NUMBER variable override #6628

Merged
merged 1 commit into from
Sep 15, 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
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
9 changes: 6 additions & 3 deletions docker/lite/Dockerfile.testing
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2019 The Vitess Authors.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -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.ubi7.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.ubi7.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.ubi7.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.ubi7.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}' \
"