This is an automated email from the ASF dual-hosted git repository.
ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new c5cb7eb Update Go version to 1.15.2 (#5095)
c5cb7eb is described below
commit c5cb7ebf2e894d65d87a7e85afd9181c4d708200
Author: Zach Hoffman <[email protected]>
AuthorDate: Mon Oct 5 15:01:26 2020 -0600
Update Go version to 1.15.2 (#5095)
* Make CDN-in-a-Box CI workflow ignore changes in the .github directory
except for
things related to the workflow
* Store the current Go version (1.14.2) in a file named GO_VERSION
* Pull the minor-level Go version from GO_VERSION in
verify_and_set_go_version and in the docs
* traffic_ops/install/bin/install_go.sh gets its Go version from
GO_VERSION
* Reword types.TOType godoc
* CentOS builder images get the Go version from GO_VERSION
* Debian Docker images in the repo get the Go version from GO_VERSION
* Alpine Docker images in the repo get the Go version from GO_VERSION,
including GitHub Actions
* Update Go version to 1.15.2
* Close GO_VERSION file with context manager
* No longer validating Go version in Grove. This check can be added back
in a separate PR.
* spaces -> tabs
---
.github/actions/go-fmt/Dockerfile | 10 ++++++++-
.github/actions/go-fmt/entrypoint.sh | 10 +++++++++
.github/actions/go-test/Dockerfile | 13 +++++++++--
.github/actions/go-test/entrypoint.sh | 20 ++++++++++++-----
.github/actions/to-integration-tests/Dockerfile | 12 +++++++---
.github/actions/to-integration-tests/entrypoint.sh | 20 ++++++++++++-----
.github/actions/todb-init/Dockerfile | 15 ++++++++-----
.github/actions/todb-init/entrypoint.sh | 17 ++++++++++++++
.github/workflows/ciab.yaml | 12 ++++++++--
CHANGELOG.md | 1 +
GO_VERSION | 1 +
build/functions.sh | 26 ++++++++++++++++++----
docs/source/_ext/atc.py | 25 +++++++++++++++++++++
docs/source/development/traffic_ops.rst | 5 ++++-
grove/build/build_rpm.sh | 9 ++------
grove/grovetccfg/build/build_rpm.sh | 9 ++------
infrastructure/cdn-in-a-box/enroller/Dockerfile | 21 +++++++++++++----
.../traffic_ops_integration_test/Dockerfile | 18 ++++++++++++++-
infrastructure/docker/build/Dockerfile-grove | 10 +++++----
infrastructure/docker/build/Dockerfile-grovetccfg | 10 +++++----
.../docker/build/Dockerfile-traffic_monitor | 10 +++++----
infrastructure/docker/build/Dockerfile-traffic_ops | 10 +++++----
.../docker/build/Dockerfile-traffic_ops_ort | 10 +++++----
.../docker/build/Dockerfile-traffic_stats | 10 +++++----
tools/golang/Dockerfile | 19 +++++++++++++++-
.../golang/Dockerfile.dockerignore | 16 +++++++------
tools/golang/docker-compose.yml | 8 +++----
traffic_monitor/tests/Dockerfile-golangtest | 23 ++++++++++++++++++-
traffic_ops/app/bin/tests/Dockerfile-golangtest | 21 ++++++++++++++++-
traffic_ops/build/traffic_ops.spec | 3 +++
traffic_ops/install/bin/install_go.sh | 2 +-
traffic_ops/traffic_ops_golang/README.md | 2 +-
.../traffic_ops_golang/swaggerdocs/v13/Dockerfile | 24 +++++++++++++++-----
.../swaggerdocs/v13/Dockerfile.dockerignore | 18 +++++++++------
.../swaggerdocs/v13/docker-compose.yml | 4 ++--
traffic_ops/traffic_ops_golang/types/types.go | 2 +-
36 files changed, 343 insertions(+), 103 deletions(-)
diff --git a/.github/actions/go-fmt/Dockerfile
b/.github/actions/go-fmt/Dockerfile
index a9d59a9..e3f8a00 100644
--- a/.github/actions/go-fmt/Dockerfile
+++ b/.github/actions/go-fmt/Dockerfile
@@ -15,7 +15,15 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2-alpine
+FROM alpine:3.12
+
+RUN architecture=$(uname -m) && \
+ mkdir lib64 && \
+ # Use musl libc where the go binary expects glibc
+ # Less-generalized: ln -s /lib/ld-musl-x86_64.so.1
/lib64/ld-linux-x86-64.so.2
+ ln -s /lib/ld-musl-${architecture}.so.[0-9]
/lib64/ld-linux-${architecture//_/-}.so.2
+ENV GOROOT=/usr/local/go \
+ CGO_ENABLED=0
RUN apk add --no-cache git python3
diff --git a/.github/actions/go-fmt/entrypoint.sh
b/.github/actions/go-fmt/entrypoint.sh
index cab06a1..598e2b0 100755
--- a/.github/actions/go-fmt/entrypoint.sh
+++ b/.github/actions/go-fmt/entrypoint.sh
@@ -18,6 +18,16 @@
set -e
+download_go() {
+ go_version="$(cat "${GITHUB_WORKSPACE}/GO_VERSION")"
+ wget -O go.tar.gz
"https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz"
+ tar -C /usr/local -xzf go.tar.gz
+ rm go.tar.gz
+ export PATH="${PATH}:${GOROOT}/bin"
+ go version
+}
+download_go
+
GOPATH="$(mktemp -d)"
SRCDIR="$GOPATH/src/github.com/apache"
mkdir -p "$SRCDIR"
diff --git a/.github/actions/go-test/Dockerfile
b/.github/actions/go-test/Dockerfile
index 524985a..5cf5c21 100644
--- a/.github/actions/go-test/Dockerfile
+++ b/.github/actions/go-test/Dockerfile
@@ -15,9 +15,18 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2
+FROM alpine:3.12
+
+RUN architecture=$(uname -m) && \
+ mkdir lib64 && \
+ # Use musl libc where the go binary expects glibc
+ # Less-generalized: ln -s /lib/ld-musl-x86_64.so.1
/lib64/ld-linux-x86-64.so.2
+ ln -s /lib/ld-musl-${architecture}.so.[0-9]
/lib64/ld-linux-${architecture//_/-}.so.2
+ENV GOROOT=/usr/local/go \
+ CGO_ENABLED=0
+
+RUN apk add --no-cache git
COPY entrypoint.sh /entrypoint.sh
-RUN chmod a+x /entrypoint.sh
ENTRYPOINT /entrypoint.sh
diff --git a/.github/actions/go-test/entrypoint.sh
b/.github/actions/go-test/entrypoint.sh
old mode 100644
new mode 100755
index ae88dfa..d332785
--- a/.github/actions/go-test/entrypoint.sh
+++ b/.github/actions/go-test/entrypoint.sh
@@ -18,16 +18,26 @@
set -e
+download_go() {
+ go_version="$(cat "${GITHUB_WORKSPACE}/GO_VERSION")"
+ wget -O go.tar.gz
"https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz"
+ tar -C /usr/local -xzf go.tar.gz
+ rm go.tar.gz
+ export PATH="${PATH}:${GOROOT}/bin"
+ go version
+}
+download_go
+
if [ -z "$INPUT_DIR" ]; then
# There's a bug in "defaults" for inputs
INPUT_DIR="./lib/..."
fi
-GOPATH="$(mktemp -d)"
-SRCDIR="$GOPATH/src/github.com/apache"
-mkdir -p "$SRCDIR"
-ln -s "$PWD" "$SRCDIR/trafficcontrol"
-cd "$SRCDIR/trafficcontrol"
+export GOPATH="$(mktemp -d)"
+srcdir="$GOPATH/src/github.com/apache"
+mkdir -p "$srcdir"
+ln -s "$PWD" "$srcdir/trafficcontrol"
+cd "$srcdir/trafficcontrol"
# Need to fetch golang.org/x/* dependencies
/usr/local/go/bin/go get -v $INPUT_DIR
diff --git a/.github/actions/to-integration-tests/Dockerfile
b/.github/actions/to-integration-tests/Dockerfile
index 3457f8d..661e0cf 100644
--- a/.github/actions/to-integration-tests/Dockerfile
+++ b/.github/actions/to-integration-tests/Dockerfile
@@ -15,12 +15,18 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2-alpine
+FROM alpine:3.12
+
+RUN architecture=$(uname -m) && \
+ mkdir lib64 && \
+ # Use musl libc where the go binary expects glibc
+ # Less-generalized: ln -s /lib/ld-musl-x86_64.so.1
/lib64/ld-linux-x86-64.so.2
+ ln -s /lib/ld-musl-${architecture}.so.[0-9]
/lib64/ld-linux-${architecture//_/-}.so.2
+ENV GOROOT=/usr/local/go \
+ CGO_ENABLED=0
-ENV CGO_ENABLED=0
RUN apk add --no-cache gettext git
COPY entrypoint.sh database.json traffic-ops-test.json cdn.json /
-RUN chmod a+x /entrypoint.sh
ENTRYPOINT /entrypoint.sh
diff --git a/.github/actions/to-integration-tests/entrypoint.sh
b/.github/actions/to-integration-tests/entrypoint.sh
old mode 100644
new mode 100755
index cc99f4a..8fae324
--- a/.github/actions/to-integration-tests/entrypoint.sh
+++ b/.github/actions/to-integration-tests/entrypoint.sh
@@ -16,12 +16,22 @@
# specific language governing permissions and limitations
# under the License.
-GOPATH="$(mktemp -d)"
-SRCDIR="$GOPATH/src/github.com/apache"
-mkdir -p "$SRCDIR"
-ln -s "$PWD" "$SRCDIR/trafficcontrol"
+download_go() {
+ go_version="$(cat "${GITHUB_WORKSPACE}/GO_VERSION")"
+ wget -O go.tar.gz
"https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz"
+ tar -C /usr/local -xzf go.tar.gz
+ rm go.tar.gz
+ export PATH="${PATH}:${GOROOT}/bin"
+ go version
+}
+download_go
-cd "$SRCDIR/trafficcontrol/traffic_ops/traffic_ops_golang"
+export GOPATH="$(mktemp -d)"
+srcdir="$GOPATH/src/github.com/apache"
+mkdir -p "$srcdir"
+ln -s "$PWD" "$srcdir/trafficcontrol"
+
+cd "$srcdir/trafficcontrol/traffic_ops/traffic_ops_golang"
/usr/local/go/bin/go get ./...
diff --git a/.github/actions/todb-init/Dockerfile
b/.github/actions/todb-init/Dockerfile
index d5836ab..a5929f2 100644
--- a/.github/actions/todb-init/Dockerfile
+++ b/.github/actions/todb-init/Dockerfile
@@ -15,15 +15,18 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2-alpine
+FROM alpine:3.12
-RUN apk add --no-cache git gcc gettext postgresql-client musl-dev &&\
- go get -v bitbucket.org/liamstask/goose/cmd/goose &&\
- mv $GOPATH/bin/goose /bin/ &&\
- apk del git gcc musl-dev
+RUN architecture=$(uname -m) && \
+ mkdir lib64 && \
+ # Use musl libc where the go binary expects glibc
+ # Less-generalized: ln -s /lib/ld-musl-x86_64.so.1
/lib64/ld-linux-x86-64.so.2
+ ln -s /lib/ld-musl-${architecture}.so.[0-9]
/lib64/ld-linux-${architecture//_/-}.so.2
+# Do not disable CGO, bitbucket.org/liamstask/goose needs it
+ENV GOROOT=/usr/local/go
+RUN apk add --no-cache git
COPY entrypoint.sh dbconf.yml /
-RUN chmod a+x /entrypoint.sh
ENTRYPOINT /entrypoint.sh
diff --git a/.github/actions/todb-init/entrypoint.sh
b/.github/actions/todb-init/entrypoint.sh
old mode 100644
new mode 100755
index a951ce4..53e15e1
--- a/.github/actions/todb-init/entrypoint.sh
+++ b/.github/actions/todb-init/entrypoint.sh
@@ -18,6 +18,23 @@
set -e
+download_go() {
+ go_version="$(cat "${GITHUB_WORKSPACE}/GO_VERSION")"
+ wget -O go.tar.gz
"https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz"
+ tar -C /usr/local -xzf go.tar.gz
+ rm go.tar.gz
+ export PATH="${PATH}:${GOROOT}/bin"
+ go version
+}
+download_go
+GOPATH="$(mktemp -d)"
+export PATH="${GOPATH}/bin:${PATH}" GOPATH
+
+apk add --no-cache git gcc gettext postgresql-client musl-dev
+go get -v bitbucket.org/liamstask/goose/cmd/goose
+mv $GOPATH/bin/goose /bin/ &&\
+ apk del git gcc musl-dev
+
cd "traffic_ops/app/db"
mv /dbconf.yml ./
diff --git a/.github/workflows/ciab.yaml b/.github/workflows/ciab.yaml
index d2d479b..20fbbbb 100644
--- a/.github/workflows/ciab.yaml
+++ b/.github/workflows/ciab.yaml
@@ -27,7 +27,11 @@ on:
- 'blueprints/**'
- 'docs/**'
- 'experimental/**'
- - '.github/ISSUE_TEMPLATE/config.yml'
+ - '.github/**'
+ - '!.github/actions/build-ciab/*'
+ - '!.github/actions/build-rpms/*'
+ - '!.github/actions/run-ciab/*'
+ - '!.github/workflows/ciab.yaml'
- 'licenses/**'
- 'misc/**'
- 'NOTICE'
@@ -42,7 +46,11 @@ on:
- 'blueprints/**'
- 'docs/**'
- 'experimental/**'
- - '.github/ISSUE_TEMPLATE/config.yml'
+ - '.github/**'
+ - '!.github/actions/build-ciab/*'
+ - '!.github/actions/build-rpms/*'
+ - '!.github/actions/run-ciab/*'
+ - '!.github/workflows/ciab.yaml'
- 'licenses/**'
- 'misc/**'
- 'NOTICE'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b392a27..48819da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -51,6 +51,7 @@ The format is based on [Keep a
Changelog](http://keepachangelog.com/en/1.0.0/).
- Added Traffic Monitor: Support astats CSV output. Includes
http_polling_format configuration option to specify the Accept header sent to
stats endpoints. Adds CSV parsing ability (~100% faster than JSON) to the
astats plugin
- Added Traffic Monitor: Support stats over http CSV output. Officially
supported in ATS 9.0 unless backported by users. Users must also include
`system_stats.so` when using stats over http in order to keep all the same
functionality (and included stats) that astats_over_http provides.
- Added ability for Traffic Monitor to determine health of cache based on
interface data and aggregate data. Using the new `stats_over_http`
`health.polling.format` value that allows monitoring of multiple interfaces
will first require that *all* Traffic Monitors monitoring the affected cache
server be upgraded.
+- Traffic Ops, Traffic Ops ORT, Traffic Monitor, Traffic Stats, and Grove are
now compiled using Go version 1.15.
### Fixed
- Fixed #3455 - Alphabetically sorting CDN Read API call [Related Github
issues](https://github.com/apache/trafficcontrol/issues/3455)
diff --git a/GO_VERSION b/GO_VERSION
new file mode 100644
index 0000000..42cf067
--- /dev/null
+++ b/GO_VERSION
@@ -0,0 +1 @@
+1.15.2
diff --git a/build/functions.sh b/build/functions.sh
index a60f66a..7c6bde1 100755
--- a/build/functions.sh
+++ b/build/functions.sh
@@ -107,6 +107,14 @@ getBuildNumber() {
}
# ---------------------------------------
+getGoVersion() {
+ local directory="$1"
+ local go_version_file="$directory/GO_VERSION"
+ [ -r "$go_version_file" ] || { echo "Could not read $go_version_file:
$!"; return 1; }
+ cat "$go_version_file"
+}
+
+# ---------------------------------------
getVersion() {
local d="$1"
local vf="$d/VERSION"
@@ -171,13 +179,14 @@ checkEnvironment() {
TC_VERSION='' BUILD_NUMBER='' RHEL_VERSION='' RPMBUILD='' DIST=''
TC_VERSION="$(getVersion "$TC_DIR")"
BUILD_NUMBER="$(getBuildNumber)"
+ GO_VERSION="$(getGoVersion "$TC_DIR")"
RHEL_VERSION="$(getRhelVersion)"
WORKSPACE="${WORKSPACE:-$TC_DIR}"
RPMBUILD="$WORKSPACE/rpmbuild"
GOOS="${GOOS:-linux}"
RPM_TARGET_OS="${RPM_TARGET_OS:-$GOOS}"
DIST="$WORKSPACE/dist"
- export TC_VERSION BUILD_NUMBER RHEL_VERSION WORKSPACE RPMBUILD GOOS
RPM_TARGET_OS DIST
+ export TC_VERSION BUILD_NUMBER GO_VERSION RHEL_VERSION WORKSPACE
RPMBUILD GOOS RPM_TARGET_OS DIST
mkdir -p "$DIST" || { echo "Could not create ${DIST}: ${?}"; return 1; }
@@ -220,6 +229,7 @@ buildRpm() {
(cd "$RPMBUILD" && \
rpmbuild --define "_topdir $(pwd)" \
--define "traffic_control_version $TC_VERSION" \
+ --define "go_version $GO_VERSION" \
--define "commit $(getCommit)" \
--define "build_number
$BUILD_NUMBER.$RHEL_VERSION" \
--define "_target_os $RPM_TARGET_OS" \
@@ -286,9 +296,16 @@ createDocsTarball() {
}
# ----------------------------------------
-# verify if the go compiler is version 1.14 or higher, returns 0 if if not.
returns 1 if it is.
+# verify whether the minor-level version of the go compiler is greater or equal
+# to the minor-level version in the GO_VERSION file: returns 0 if if not.
+# returns 1 if it is.
#
verify_and_set_go_version() {
+ if [ -z "$GO_VERSION" ]; then
+ GO_VERSION="$(getGoVersion .)"
+ fi
+ local major_version="$(echo "$GO_VERSION" | awk -F. '{print $1}')"
+ local minor_version="$(echo "$GO_VERSION" | awk -F. '{print $2}')"
GO_VERSION="none"
GO="none"
go_in_path="$(type -p go)"
@@ -304,7 +321,7 @@ verify_and_set_go_version() {
if echo "$go_version" | grep -E "$version_pattern"; then
group_1="$(echo "$go_version" | sed -E
"s/.*${version_pattern}/\1/")"
group_2="$(echo "$go_version" | sed -E
"s/${version_pattern}/\2/")"
- if [ ! "$group_1" -ge 1 ] || [ ! "$group_2" -ge 14 ];
then
+ if [ ! "$group_1" -ge "$major_version" ] || [ !
"$group_2" -ge "$minor_version" ]; then
GO_VERSION="${group_1}.${group_2}"; export
GO_VERSION
echo "go version for $g is
${group_1}.${group_2}"
continue
@@ -319,7 +336,8 @@ verify_and_set_go_version() {
done
if [ "$GO" = none ]; then
- echo "ERROR: this build needs go 1.14 or greater and no usable
go compiler was found, found GO_VERSION: $GO_VERSION"
+ echo "ERROR: this build needs go
${major_version}.${minor_version} or greater and no usable go compiler was
found, found GO_VERSION: $GO_VERSION"
+ unset GO_VERSION
return 1
fi
}
diff --git a/docs/source/_ext/atc.py b/docs/source/_ext/atc.py
index b095fda..e6935cb 100644
--- a/docs/source/_ext/atc.py
+++ b/docs/source/_ext/atc.py
@@ -46,6 +46,30 @@ class ImplementationDetail(SphinxDirective):
impl_node.append(nodes.paragraph('', '', *(n + m)))
return [impl_node]
+# -- Go Version role --------------------------------------------------
+# Returns the value of the Go version stored in GO_VERSION to minor version
+# precision.
+import os
+import re
+
+from docutils.nodes import strong
+from docutils.parsers.rst.states import Inliner
+from typing import Tuple, List
+
+def atc_go_version(unused_typ: str,
+ unused_rawtext: str,
+ unused_text: str,
+ unused_lineno: int,
+ unused_inliner: Inliner,
+ options=None,
+ content=None) -> Tuple[List[strong], list]:
+ go_version_file = os.path.join(os.path.dirname(__file__),
'../../../GO_VERSION')
+ with open(file=go_version_file) as go_version_file:
+ go_version = go_version_file.read()
+ major_minor_version = re.match(pattern=r'\d+\.\d+',
string=go_version).group()
+ strong_node = nodes.strong(major_minor_version, major_minor_version)
+ return [strong_node], []
+
# -- Issue role --------------------------------------------------------------
from docutils import utils
@@ -175,6 +199,7 @@ def setup(app: object) -> dict:
latex=(visit_impl_node, depart_impl_node),
text=(visit_impl_node, depart_impl_node))
app.add_directive("impl-detail", ImplementationDetail)
+ app.add_role("atc-go-version", atc_go_version)
app.add_role("issue", issue_role)
app.add_role("pr", pr_role)
app.add_role("pull-request", pr_role)
diff --git a/docs/source/development/traffic_ops.rst
b/docs/source/development/traffic_ops.rst
index 97e7e08..bd3b7b6 100644
--- a/docs/source/development/traffic_ops.rst
+++ b/docs/source/development/traffic_ops.rst
@@ -75,9 +75,12 @@ Most dependencies are managed by `Carton 1.0.12
<http://search.cpan.org/~miyagaw
Go Implementation Requirements
------------------------------
-- `Go 1.14 or later <http://golang.org/doc/install>`_
+- |install-go-link|_
- If the system's Go compiler doesn't provide it implicitly, also note that
all Go code in the :abbr:`ATC (Apache Traffic Control)` repository should be
formatted using `gofmt <https://golang.org/cmd/gofmt/>`_
+.. |install-go-link| replace:: Go :atc-go-version:`_` or later
+.. _install-go-link: http://golang.org/doc/install
+
All Go code dependencies are managed through the :atc-file:`vendor/` directory
and should thus be available without any extra work - and any new dependencies
should be properly "vendored" into that same, top-level directory. Some
dependencies have been "vendored" into :atc-file:`traffic_ops/vendor` and
:atc-file:`traffic_ops/traffic_ops_golang/vendor` but the preferred location
for new dependencies is under that top-level :atc-file:`vendor/` directory.
Per the Go language standard's authoritative source's recommendation, all
sub-packages of ``golang.org/x`` are treated as a part of the compiler, and so
need not ever be "vendored" as though they were an external dependency. These
dependencies are not listed explicitly here, so it is strongly advised that
they be fetched using :manpage:`go-get(1)` rather than downloaded by hand.
diff --git a/grove/build/build_rpm.sh b/grove/build/build_rpm.sh
index 7e49e0e..a90de85 100755
--- a/grove/build/build_rpm.sh
+++ b/grove/build/build_rpm.sh
@@ -47,11 +47,6 @@ checkGroveEnvironment() {
RPM_TARGET_OS="${RPM_TARGET_OS:-$GOOS}"
export GROVE_DIR GROVE_VERSION PACKAGE BUILD_NUMBER RPMBUILD DIST RPM
GOOS RPM_TARGET_OS
- # grove needs to be built with go 1.14 or greater
- if ! verify_and_set_go_version; then
- return $?;
- fi;
-
echo "=================================================="
echo "GO_VERSION: $GO_VERSION"
echo "TC_DIR: $TC_DIR"
@@ -82,8 +77,8 @@ buildRpmGrove() {
# build
ldflags='-s -w'
tags='osusergo netgo'
- $GO get -v -d . || { echo "Failed to go get dependencies: $?" >&2;
return 1; }
- $GO build -v -ldflags "${ldflags} -X main.Version=$GROVE_VERSION" -tags
"$tags" || { echo "Failed to build grove: $?" >&2; return 1; }
+ go get -v -d . || { echo "Failed to go get dependencies: $?" >&2;
return 1; }
+ go build -v -ldflags "${ldflags} -X main.Version=$GROVE_VERSION" -tags
"$tags" || { echo "Failed to build grove: $?" >&2; return 1; }
# tar
tar -cvzf "${RPMBUILD}/SOURCES/grove-${GROVE_VERSION}.tgz" grove
conf/grove.cfg build/grove.init build/grove.logrotate || { echo "Failed to
create archive for rpmbuild: $?" >&2; return 1; }
diff --git a/grove/grovetccfg/build/build_rpm.sh
b/grove/grovetccfg/build/build_rpm.sh
index 4eb57b5..c16c7a7 100755
--- a/grove/grovetccfg/build/build_rpm.sh
+++ b/grove/grovetccfg/build/build_rpm.sh
@@ -47,11 +47,6 @@ checkGroveEnvironment() {
RPM_TARGET_OS="${RPM_TARGET_OS:-$GOOS}"
export GROVETC_DIR GROVE_DIR GROVE_VERSION PACKAGE BUILD_NUMBER
RPMBUILD DIST RPM GOOS RPM_TARGET_OS
- # grovetccfg needs to be built with go 1.14 or greater
- if ! verify_and_set_go_version; then
- return $?;
- fi;
-
echo "=================================================="
echo "GO_VERSION: $GO_VERSION"
echo "TC_DIR: $TC_DIR"
@@ -83,8 +78,8 @@ buildRpmGrove() {
# build
ldflags='-s -w'
tags='osusergo netgo'
- $GO get -v -d . || { echo "Failed to go get dependencies: $?" >&2;
return 1; }
- $GO build -v -ldflags "${ldflags} -X main.Version=$GROVE_VERSION" -tags
"$tags" || { echo "Failed to build $PACKAGE: $?" >&2; return 1; }
+ go get -v -d . || { echo "Failed to go get dependencies: $?" >&2;
return 1; }
+ go build -v -ldflags "${ldflags} -X main.Version=$GROVE_VERSION" -tags
"$tags" || { echo "Failed to build $PACKAGE: $?" >&2; return 1; }
# tar
tar -cvzf "${RPMBUILD}/SOURCES/${PACKAGE}-${GROVE_VERSION}.tgz"
${PACKAGE}|| { echo "Failed to create archive for rpmbuild: $?" >&2; return 1; }
diff --git a/infrastructure/cdn-in-a-box/enroller/Dockerfile
b/infrastructure/cdn-in-a-box/enroller/Dockerfile
index 8ed5bae..9a97920 100644
--- a/infrastructure/cdn-in-a-box/enroller/Dockerfile
+++ b/infrastructure/cdn-in-a-box/enroller/Dockerfile
@@ -15,7 +15,22 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2 AS enroller-builder
+FROM debian:buster AS enroller-builder
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ ca-certificates \
+ git \
+ wget && \
+ apt-get clean
+
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ wget -O go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
+ENV GOPATH=/go
# enroller source and dependencies
COPY ./lib/ /go/src/github.com/apache/trafficcontrol/lib/
@@ -27,9 +42,7 @@ COPY ./infrastructure/cdn-in-a-box/
/go/src/github.com/apache/trafficcontrol/inf
WORKDIR
/go/src/github.com/apache/trafficcontrol/infrastructure/cdn-in-a-box/enroller
RUN go clean && go get -v && go build
-
-
-FROM debian:stretch
+FROM debian:buster
RUN apt-get update && apt-get install -y \
netcat curl dnsutils net-tools \
diff --git
a/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
index dd5a1f6..74d09f4 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
+++ b/infrastructure/cdn-in-a-box/traffic_ops_integration_test/Dockerfile
@@ -15,7 +15,23 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2-alpine3.11 AS integration-builder
+FROM alpine:3.11 AS integration-builder
+
+COPY GO_VERSION /
+RUN set -o errexit; \
+ go_version=$(cat /GO_VERSION); \
+ wget -O go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz; \
+ tar -C /usr/local -xvzf go.tar.gz; \
+ ln -s /usr/local/go/bin/go /usr/bin/go; \
+ rm go.tar.gz; \
+ architecture=$(uname -m); \
+ mkdir lib64; \
+ # Use musl libc where the go binary expects glibc
+ # Less-generalized: ln -s /lib/ld-musl-x86_64.so.1
/lib64/ld-linux-x86-64.so.2
+ ln -s /lib/ld-musl-${architecture}.so.[0-9]
/lib64/ld-linux-${architecture//_/-}.so.2; \
+ # Test the go binary
+ go version
+ENV GOPATH=/go
RUN apk add --no-cache --update git gcc
diff --git a/infrastructure/docker/build/Dockerfile-grove
b/infrastructure/docker/build/Dockerfile-grove
index 4473934..6acac11 100644
--- a/infrastructure/docker/build/Dockerfile-grove
+++ b/infrastructure/docker/build/Dockerfile-grove
@@ -36,10 +36,12 @@ RUN yum -y install \
rpm-build && \
yum -y clean all
-RUN curl -LO https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz && \
- tar -C /usr/local -xvzf go1.14.2.linux-amd64.tar.gz && \
- ln -s /usr/local/go/bin/go /usr/bin/go && \
- rm go1.14.2.linux-amd64.tar.gz
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ curl -Lo go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
###
diff --git a/infrastructure/docker/build/Dockerfile-grovetccfg
b/infrastructure/docker/build/Dockerfile-grovetccfg
index 3e06710..f139b6a 100644
--- a/infrastructure/docker/build/Dockerfile-grovetccfg
+++ b/infrastructure/docker/build/Dockerfile-grovetccfg
@@ -36,10 +36,12 @@ RUN yum -y install \
rpm-build && \
yum -y clean all
-RUN curl -LO https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz && \
- tar -C /usr/local -xvzf go1.14.2.linux-amd64.tar.gz && \
- ln -s /usr/local/go/bin/go /usr/bin/go && \
- rm go1.14.2.linux-amd64.tar.gz
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ curl -Lo go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
###
diff --git a/infrastructure/docker/build/Dockerfile-traffic_monitor
b/infrastructure/docker/build/Dockerfile-traffic_monitor
index f2a67bc..77c1bfc 100644
--- a/infrastructure/docker/build/Dockerfile-traffic_monitor
+++ b/infrastructure/docker/build/Dockerfile-traffic_monitor
@@ -38,10 +38,12 @@ RUN yum -y install \
rpm-build && \
yum -y clean all
-RUN curl -LO https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz && \
- tar -C /usr/local -xvzf go1.14.2.linux-amd64.tar.gz && \
- ln -s /usr/local/go/bin/go /usr/bin/go && \
- rm go1.14.2.linux-amd64.tar.gz
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ curl -Lo go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
###
diff --git a/infrastructure/docker/build/Dockerfile-traffic_ops
b/infrastructure/docker/build/Dockerfile-traffic_ops
index 99632f2..b93f993 100644
--- a/infrastructure/docker/build/Dockerfile-traffic_ops
+++ b/infrastructure/docker/build/Dockerfile-traffic_ops
@@ -43,10 +43,12 @@ RUN yum -y install \
tar && \
yum -y clean all
-RUN curl -LO https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz && \
- tar -C /usr/local -xvzf go1.14.2.linux-amd64.tar.gz && \
- ln -s /usr/local/go/bin/go /usr/bin/go && \
- rm go1.14.2.linux-amd64.tar.gz
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ curl -Lo go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
###
diff --git a/infrastructure/docker/build/Dockerfile-traffic_ops_ort
b/infrastructure/docker/build/Dockerfile-traffic_ops_ort
index 77ebdf2..57c7b02 100644
--- a/infrastructure/docker/build/Dockerfile-traffic_ops_ort
+++ b/infrastructure/docker/build/Dockerfile-traffic_ops_ort
@@ -26,10 +26,12 @@ RUN yum -y install \
rpm-build && \
yum -y clean all
-RUN curl -Lo go.tgz https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz && \
- tar -C /usr/local -xvzf go.tgz && \
- ln -s /usr/local/go/bin/go /usr/bin/go && \
- rm go.tgz
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ curl -Lo go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
ADD build/clean_build.sh /
CMD /clean_build.sh traffic_ops_ort
diff --git a/infrastructure/docker/build/Dockerfile-traffic_stats
b/infrastructure/docker/build/Dockerfile-traffic_stats
index aa1ddab..9725a2f 100644
--- a/infrastructure/docker/build/Dockerfile-traffic_stats
+++ b/infrastructure/docker/build/Dockerfile-traffic_stats
@@ -36,10 +36,12 @@ RUN yum -y install \
rpm-build && \
yum -y clean all
-RUN curl -LO https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz && \
- tar -C /usr/local -xvzf go1.14.2.linux-amd64.tar.gz && \
- ln -s /usr/local/go/bin/go /usr/bin/go && \
- rm go1.14.2.linux-amd64.tar.gz
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ curl -Lo go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
###
diff --git a/tools/golang/Dockerfile b/tools/golang/Dockerfile
index d4b4774..b15821a 100644
--- a/tools/golang/Dockerfile
+++ b/tools/golang/Dockerfile
@@ -15,7 +15,24 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2-alpine3.11 AS base
+FROM alpine:3.11 AS base
+
+COPY GO_VERSION /
+RUN set -o errexit; \
+ go_version=$(cat /GO_VERSION); \
+ wget -O go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz; \
+ tar -C /usr/local -xvzf go.tar.gz; \
+ ln -s /usr/local/go/bin/go /usr/bin/go; \
+ rm go.tar.gz; \
+ architecture=$(uname -m); \
+ mkdir lib64; \
+ # Use musl libc where the go binary expects glibc
+ # Less-generalized: ln -s /lib/ld-musl-x86_64.so.1
/lib64/ld-linux-x86-64.so.2
+ ln -s /lib/ld-musl-${architecture}.so.[0-9]
/lib64/ld-linux-${architecture//_/-}.so.2; \
+ # Test the go binary
+ go version
+ENV GOPATH=/go
+ENV PATH="${PATH}:${GOPATH}/bin"
RUN apk --no-cache add gcc musl-dev git
diff --git a/.github/actions/go-fmt/Dockerfile
b/tools/golang/Dockerfile.dockerignore
similarity index 66%
copy from .github/actions/go-fmt/Dockerfile
copy to tools/golang/Dockerfile.dockerignore
index a9d59a9..d114c64 100644
--- a/.github/actions/go-fmt/Dockerfile
+++ b/tools/golang/Dockerfile.dockerignore
@@ -15,10 +15,12 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2-alpine
-
-RUN apk add --no-cache git python3
-
-COPY entrypoint.sh /entrypoint.sh
-
-ENTRYPOINT /entrypoint.sh
+# To use this dockerignore:
+# - Set these environment variables: COMPOSE_DOCKER_CLI_BUILD=1
DOCKER_BUILDKIT=1
+# - Use a docker version of 19.03.0 or higher (Docker Desktop >=2.1.0.1)
+# For more information, see:
+# - https://github.com/moby/buildkit/pull/901
+# - https://github.com/docker/compose/pull/6865
+# - https://docs.docker.com/develop/develop-images/build_enhancements/
+*
+!GO_VERSION
diff --git a/tools/golang/docker-compose.yml b/tools/golang/docker-compose.yml
index d73b843..5048b54 100644
--- a/tools/golang/docker-compose.yml
+++ b/tools/golang/docker-compose.yml
@@ -20,16 +20,16 @@ version: '2.3'
services:
lint:
build:
- context: .
- dockerfile: Dockerfile
+ context: ../..
+ dockerfile: tools/golang/Dockerfile
target: lint
volumes:
- ../..:/go/src/github.com/apache/trafficcontrol
unit:
build:
- context: .
- dockerfile: Dockerfile
+ context: ../..
+ dockerfile: tools/golang/Dockerfile
target: unit
volumes:
- ../..:/go/src/github.com/apache/trafficcontrol
diff --git a/traffic_monitor/tests/Dockerfile-golangtest
b/traffic_monitor/tests/Dockerfile-golangtest
index 12e7bb6..fced088 100644
--- a/traffic_monitor/tests/Dockerfile-golangtest
+++ b/traffic_monitor/tests/Dockerfile-golangtest
@@ -11,7 +11,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM golang:1.14.2
+FROM debian:buster
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ ca-certificates \
+ # gcc is a CGO dependency
+ gcc \
+ git \
+ # libc6-dev is a CGO dependency
+ libc6-dev \
+ wget && \
+ apt-get clean
+
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ wget -O go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
+ENV GOPATH=/go
+ENV PATH="${PATH}:${GOPATH}/bin"
+
ARG DIR=github.com/apache/trafficcontrol
ADD traffic_monitor /go/src/$DIR/traffic_monitor
diff --git a/traffic_ops/app/bin/tests/Dockerfile-golangtest
b/traffic_ops/app/bin/tests/Dockerfile-golangtest
index 27e6dc4..5031e8f 100644
--- a/traffic_ops/app/bin/tests/Dockerfile-golangtest
+++ b/traffic_ops/app/bin/tests/Dockerfile-golangtest
@@ -11,10 +11,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-FROM golang:1.14.2
+FROM debian:buster
MAINTAINER [email protected]
ARG DIR=github.com/apache/trafficcontrol
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ ca-certificates \
+ # gcc is a CGO dependency
+ gcc \
+ git \
+ # libc6-dev is a CGO dependency
+ libc6-dev \
+ wget && \
+ apt-get clean
+
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ wget -O go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
+ENV GOPATH=/go
+
ADD traffic_ops /go/src/$DIR/traffic_ops
ADD lib /go/src/$DIR/lib
ADD traffic_monitor /go/src/$DIR/traffic_monitor
diff --git a/traffic_ops/build/traffic_ops.spec
b/traffic_ops/build/traffic_ops.spec
index dcb8bdf..b1f27d6 100644
--- a/traffic_ops/build/traffic_ops.spec
+++ b/traffic_ops/build/traffic_ops.spec
@@ -59,6 +59,9 @@ Built: %(date) by %{getenv: USER}
# update version referenced in the source
sed -i.bak 's/__VERSION__/%{version}-%{release}/g'
app/lib/UI/Utils.pm
+ # update the go version referenced in install_go.sh
+ sed -i.bak 's/__GO_VERSION__/%{go_version}/g'
install/bin/install_go.sh
+
# copy traffic_ops_golang binary
godir=src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang
( mkdir -p "$godir" && \
diff --git a/traffic_ops/install/bin/install_go.sh
b/traffic_ops/install/bin/install_go.sh
index ed476e6..10ae7eb 100755
--- a/traffic_ops/install/bin/install_go.sh
+++ b/traffic_ops/install/bin/install_go.sh
@@ -15,7 +15,7 @@
#
GO_DOWNLOADS_URL=https://dl.google.com/go
-GO_TARBALL_VERSION=go1.14.2.linux-amd64.tar.gz
+GO_TARBALL_VERSION=__GO_VERSION__
GO_TARBALL_URL=$GO_DOWNLOADS_URL/$GO_TARBALL_VERSION
GO_TARBALL_VERSION_SHA_FILE=$GO_TARBALL_VERSION.sha256
diff --git a/traffic_ops/traffic_ops_golang/README.md
b/traffic_ops/traffic_ops_golang/README.md
index 202875a..7d7f447 100644
--- a/traffic_ops/traffic_ops_golang/README.md
+++ b/traffic_ops/traffic_ops_golang/README.md
@@ -23,7 +23,7 @@
To run `traffic_ops_golang` proxy locally the following prerequisites are
needed:
-* Golang 1.14 or greater See:
[https://golang.org/doc/install](https://golang.org/doc/install)
+* Golang version greater or equal to the Go version found in the `GO_VERSION`
file at the base of this repository. See:
[https://golang.org/doc/install](https://golang.org/doc/install)
* Postgres 9.6 or greater
* Because the Golang proxy is fronting Mojolicious Perl you need to have that
service setup and running as well [TO Perl Setup
Here](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/INSTALL.md)
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/v13/Dockerfile
b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/Dockerfile
index a4e819e..0b0f128 100644
--- a/traffic_ops/traffic_ops_golang/swaggerdocs/v13/Dockerfile
+++ b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/Dockerfile
@@ -16,13 +16,27 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2 AS go-swagger
-
# Swagger Spec Server
-FROM golang:1.14.2 AS swagger-server
+FROM debian:buster AS swagger-server
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ ca-certificates \
+ git \
+ wget && \
+ apt-get clean
+
+COPY GO_VERSION /
+RUN go_version=$(cat /GO_VERSION) && \
+ wget -O go.tar.gz
https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz && \
+ tar -C /usr/local -xvzf go.tar.gz && \
+ ln -s /usr/local/go/bin/go /usr/bin/go && \
+ rm go.tar.gz
+ENV GOPATH=/go
+
-ADD /swaggerspec .
-ADD ./swaggerspec-server /usr/src/swaggerspec-server
+COPY traffic_ops/traffic_ops_golang/swaggerdocs/v13/swaggerspec .
+COPY traffic_ops/traffic_ops_golang/swaggerdocs/v13/swaggerspec-server
/usr/src/swaggerspec-server
WORKDIR /usr/src/swaggerspec-server
RUN go build
diff --git a/.github/actions/go-fmt/Dockerfile
b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/Dockerfile.dockerignore
similarity index 60%
copy from .github/actions/go-fmt/Dockerfile
copy to traffic_ops/traffic_ops_golang/swaggerdocs/v13/Dockerfile.dockerignore
index a9d59a9..2807371 100644
--- a/.github/actions/go-fmt/Dockerfile
+++ b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/Dockerfile.dockerignore
@@ -15,10 +15,14 @@
# specific language governing permissions and limitations
# under the License.
-FROM golang:1.14.2-alpine
-
-RUN apk add --no-cache git python3
-
-COPY entrypoint.sh /entrypoint.sh
-
-ENTRYPOINT /entrypoint.sh
+# To use this dockerignore:
+# - Set these environment variables: COMPOSE_DOCKER_CLI_BUILD=1
DOCKER_BUILDKIT=1
+# - Use a docker version of 19.03.0 or higher (Docker Desktop >=2.1.0.1)
+# For more information, see:
+# - https://github.com/moby/buildkit/pull/901
+# - https://github.com/docker/compose/pull/6865
+# - https://docs.docker.com/develop/develop-images/build_enhancements/
+*
+!GO_VERSION
+!traffic_ops/traffic_ops_golang/swaggerdocs/v13/swaggerspec/
+!traffic_ops/traffic_ops_golang/swaggerdocs/v13/swaggerspec-server/
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/v13/docker-compose.yml
b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/docker-compose.yml
index 98a09ab..c00fd58 100644
--- a/traffic_ops/traffic_ops_golang/swaggerdocs/v13/docker-compose.yml
+++ b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/docker-compose.yml
@@ -21,8 +21,8 @@ version: '3.6'
services:
swagger-spec-server:
build:
- context: .
- dockerfile: ./Dockerfile
+ context: ../../../..
+ dockerfile: traffic_ops/traffic_ops_golang/swaggerdocs/v13/Dockerfile
ports:
- 8000:8000
volumes:
diff --git a/traffic_ops/traffic_ops_golang/types/types.go
b/traffic_ops/traffic_ops_golang/types/types.go
index be77abc..2edeea3 100644
--- a/traffic_ops/traffic_ops_golang/types/types.go
+++ b/traffic_ops/traffic_ops_golang/types/types.go
@@ -36,7 +36,7 @@ import (
validation "github.com/go-ozzo/ozzo-validation"
)
-//we need a type alias to define functions on
+// TOType is a needed type alias to define functions on.
type TOType struct {
api.APIInfoImpl `json:"-"`
tc.TypeNullable