Build official packages with Go 1.13.1 (#6462)

This commit is contained in:
Daniel Nelson 2019-10-07 21:08:28 -07:00 committed by GitHub
parent da17d6569d
commit 5bd5cdc6d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 58 additions and 209 deletions

View File

@ -4,20 +4,17 @@ defaults:
working_directory: '/go/src/github.com/influxdata/telegraf' working_directory: '/go/src/github.com/influxdata/telegraf'
environment: environment:
GOFLAGS: -p=8 GOFLAGS: -p=8
go-1_10: &go-1_10
docker:
- image: 'quay.io/influxdb/telegraf-ci:1.10.8'
go-1_11: &go-1_11
docker:
- image: 'quay.io/influxdb/telegraf-ci:1.11.13'
go-1_12: &go-1_12 go-1_12: &go-1_12
docker: docker:
- image: 'quay.io/influxdb/telegraf-ci:1.12.10' - image: 'quay.io/influxdb/telegraf-ci:1.12.10'
go-1_13: &go-1_13
docker:
- image: 'quay.io/influxdb/telegraf-ci:1.13.1'
version: 2 version: 2
jobs: jobs:
deps: deps:
<<: [ *defaults, *go-1_12 ] <<: [ *defaults, *go-1_13 ]
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
@ -34,28 +31,13 @@ jobs:
paths: paths:
- '*' - '*'
test-go-1.10:
<<: [ *defaults, *go-1_10 ]
steps:
- attach_workspace:
at: '/go/src'
# disabled due to gofmt differences (1.10 vs 1.11).
#- run: 'make check'
- run: 'make test'
test-go-1.11:
<<: [ *defaults, *go-1_11 ]
steps:
- attach_workspace:
at: '/go/src'
- run: 'make check'
- run: 'make test'
test-go-1.12: test-go-1.12:
<<: [ *defaults, *go-1_12 ] <<: [ *defaults, *go-1_12 ]
steps: steps:
- attach_workspace: - attach_workspace:
at: '/go/src' at: '/go/src'
- run: 'GOARCH=386 make check' - run: 'make check'
- run: 'GOARCH=386 make test' - run: 'make test'
test-go-1.12-386: test-go-1.12-386:
<<: [ *defaults, *go-1_12 ] <<: [ *defaults, *go-1_12 ]
steps: steps:
@ -63,9 +45,23 @@ jobs:
at: '/go/src' at: '/go/src'
- run: 'GOARCH=386 make check' - run: 'GOARCH=386 make check'
- run: 'GOARCH=386 make test' - run: 'GOARCH=386 make test'
test-go-1.13:
<<: [ *defaults, *go-1_13 ]
steps:
- attach_workspace:
at: '/go/src'
- run: 'make check'
- run: 'make test'
test-go-1.13-386:
<<: [ *defaults, *go-1_13 ]
steps:
- attach_workspace:
at: '/go/src'
- run: 'GOARCH=386 make check'
- run: 'GOARCH=386 make test'
package: package:
<<: [ *defaults, *go-1_12 ] <<: [ *defaults, *go-1_13 ]
steps: steps:
- attach_workspace: - attach_workspace:
at: '/go/src' at: '/go/src'
@ -74,7 +70,7 @@ jobs:
path: './build' path: './build'
destination: 'build' destination: 'build'
release: release:
<<: [ *defaults, *go-1_12 ] <<: [ *defaults, *go-1_13 ]
steps: steps:
- attach_workspace: - attach_workspace:
at: '/go/src' at: '/go/src'
@ -83,7 +79,7 @@ jobs:
path: './build' path: './build'
destination: 'build' destination: 'build'
nightly: nightly:
<<: [ *defaults, *go-1_12 ] <<: [ *defaults, *go-1_13 ]
steps: steps:
- attach_workspace: - attach_workspace:
at: '/go/src' at: '/go/src'
@ -100,18 +96,6 @@ workflows:
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- 'test-go-1.10':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1.11':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1.12': - 'test-go-1.12':
requires: requires:
- 'deps' - 'deps'
@ -124,18 +108,30 @@ workflows:
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- 'test-go-1.13':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'test-go-1.13-386':
requires:
- 'deps'
filters:
tags:
only: /.*/
- 'package': - 'package':
requires: requires:
- 'test-go-1.10'
- 'test-go-1.11'
- 'test-go-1.12' - 'test-go-1.12'
- 'test-go-1.12-386' - 'test-go-1.12-386'
- 'test-go-1.13'
- 'test-go-1.13-386'
- 'release': - 'release':
requires: requires:
- 'test-go-1.10'
- 'test-go-1.11'
- 'test-go-1.12' - 'test-go-1.12'
- 'test-go-1.12-386' - 'test-go-1.12-386'
- 'test-go-1.13'
- 'test-go-1.13-386'
filters: filters:
tags: tags:
only: /.*/ only: /.*/
@ -144,24 +140,24 @@ workflows:
nightly: nightly:
jobs: jobs:
- 'deps' - 'deps'
- 'test-go-1.10':
requires:
- 'deps'
- 'test-go-1.11':
requires:
- 'deps'
- 'test-go-1.12': - 'test-go-1.12':
requires: requires:
- 'deps' - 'deps'
- 'test-go-1.12-386': - 'test-go-1.12-386':
requires: requires:
- 'deps' - 'deps'
- 'test-go-1.13':
requires:
- 'deps'
- 'test-go-1.13-386':
requires:
- 'deps'
- 'nightly': - 'nightly':
requires: requires:
- 'test-go-1.10'
- 'test-go-1.11'
- 'test-go-1.12' - 'test-go-1.12'
- 'test-go-1.12-386' - 'test-go-1.12-386'
- 'test-go-1.13'
- 'test-go-1.13-386'
triggers: triggers:
- schedule: - schedule:
cron: "0 7 * * *" cron: "0 7 * * *"

View File

@ -129,17 +129,12 @@ plugin-%:
@echo "Starting dev environment for $${$(@)} input plugin..." @echo "Starting dev environment for $${$(@)} input plugin..."
@docker-compose -f plugins/inputs/$${$(@)}/dev/docker-compose.yml up @docker-compose -f plugins/inputs/$${$(@)}/dev/docker-compose.yml up
.PHONY: ci-1.13
ci-1.13:
docker build -t quay.io/influxdb/telegraf-ci:1.13.1 - < scripts/ci-1.13.docker
docker push quay.io/influxdb/telegraf-ci:1.13.1
.PHONY: ci-1.12 .PHONY: ci-1.12
ci-1.12: ci-1.12:
docker build -t quay.io/influxdb/telegraf-ci:1.12.10 - < scripts/ci-1.12.docker docker build -t quay.io/influxdb/telegraf-ci:1.12.10 - < scripts/ci-1.12.docker
docker push quay.io/influxdb/telegraf-ci:1.12.10 docker push quay.io/influxdb/telegraf-ci:1.12.10
.PHONY: ci-1.11
ci-1.11:
docker build -t quay.io/influxdb/telegraf-ci:1.11.13 - < scripts/ci-1.11.docker
docker push quay.io/influxdb/telegraf-ci:1.11.13
.PHONY: ci-1.10
ci-1.10:
docker build -t quay.io/influxdb/telegraf-ci:1.10.8 - < scripts/ci-1.10.docker
docker push quay.io/influxdb/telegraf-ci:1.10.8

View File

@ -40,9 +40,9 @@ Ansible role: https://github.com/rossmcdonald/telegraf
### From Source: ### From Source:
Telegraf requires golang version 1.10 or newer, the Makefile requires GNU make. Telegraf requires golang version 1.12 or newer, the Makefile requires GNU make.
1. [Install Go](https://golang.org/doc/install) >=1.10 (1.12 recommended) 1. [Install Go](https://golang.org/doc/install) >=1.12 (1.13 recommended)
2. [Install dep](https://golang.github.io/dep/docs/installation.html) ==v0.5.0 2. [Install dep](https://golang.github.io/dep/docs/installation.html) ==v0.5.0
3. Download Telegraf source: 3. Download Telegraf source:
``` ```

View File

@ -13,11 +13,11 @@ platform: x64
install: install:
- IF NOT EXIST "C:\Cache" mkdir C:\Cache - IF NOT EXIST "C:\Cache" mkdir C:\Cache
- IF NOT EXIST "C:\Cache\go1.12.9.msi" curl -o "C:\Cache\go1.12.9.msi" https://storage.googleapis.com/golang/go1.12.9.windows-amd64.msi - IF NOT EXIST "C:\Cache\go1.13.1.msi" curl -o "C:\Cache\go1.13.1.msi" https://storage.googleapis.com/golang/go1.13.1.windows-amd64.msi
- IF NOT EXIST "C:\Cache\gnuwin32-bin.zip" curl -o "C:\Cache\gnuwin32-bin.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-bin.zip - IF NOT EXIST "C:\Cache\gnuwin32-bin.zip" curl -o "C:\Cache\gnuwin32-bin.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-bin.zip
- IF NOT EXIST "C:\Cache\gnuwin32-dep.zip" curl -o "C:\Cache\gnuwin32-dep.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-dep.zip - IF NOT EXIST "C:\Cache\gnuwin32-dep.zip" curl -o "C:\Cache\gnuwin32-dep.zip" https://dl.influxdata.com/telegraf/ci/make-3.81-dep.zip
- IF EXIST "C:\Go" rmdir /S /Q C:\Go - IF EXIST "C:\Go" rmdir /S /Q C:\Go
- msiexec.exe /i "C:\Cache\go1.12.9.msi" /quiet - msiexec.exe /i "C:\Cache\go1.13.1.msi" /quiet
- 7z x "C:\Cache\gnuwin32-bin.zip" -oC:\GnuWin32 -y - 7z x "C:\Cache\gnuwin32-bin.zip" -oC:\GnuWin32 -y
- 7z x "C:\Cache\gnuwin32-dep.zip" -oC:\GnuWin32 -y - 7z x "C:\Cache\gnuwin32-dep.zip" -oC:\GnuWin32 -y
- go get -d github.com/golang/dep - go get -d github.com/golang/dep

View File

@ -184,7 +184,7 @@ func TestSimpleMetricCreated(t *testing.T) {
{"neither value nor count", map[string]interface{}{"v1": "alpha", "v2": 45.8}, "", []string{"v2"}}, {"neither value nor count", map[string]interface{}{"v1": "alpha", "v2": 45.8}, "", []string{"v2"}},
{"value is of wrong type", map[string]interface{}{"value": "alpha", "count": 15}, "", []string{"count"}}, {"value is of wrong type", map[string]interface{}{"value": "alpha", "count": 15}, "", []string{"count"}},
{"count is of wrong type", map[string]interface{}{"value": 23.77, "count": 7.5}, "", []string{"count", "value"}}, {"count is of wrong type", map[string]interface{}{"value": 23.77, "count": 7.5}, "", []string{"count", "value"}},
{"count is out of range", map[string]interface{}{"value": -98.45E4, "count": math.MaxUint64 - uint64(20)}, "", []string{"value", "count"}}, {"count is out of range", map[string]interface{}{"value": -98.45e4, "count": math.MaxUint64 - uint64(20)}, "", []string{"value", "count"}},
{"several additional fields", map[string]interface{}{"alpha": 10, "bravo": "bravo", "charlie": 30, "delta": 40.7}, "", []string{"alpha", "charlie", "delta"}}, {"several additional fields", map[string]interface{}{"alpha": 10, "bravo": "bravo", "charlie": 30, "delta": 40.7}, "", []string{"alpha", "charlie", "delta"}},
} }

View File

@ -1,114 +0,0 @@
package prometheus_client_test
import (
"crypto/tls"
"fmt"
"net/http"
"testing"
inttls "github.com/influxdata/telegraf/internal/tls"
"github.com/influxdata/telegraf/plugins/outputs/prometheus_client"
"github.com/influxdata/telegraf/testutil"
"github.com/influxdata/toml"
"github.com/stretchr/testify/require"
)
var pki = testutil.NewPKI("../../../testutil/pki")
var configWithTLS = fmt.Sprintf(`
listen = "127.0.0.1:0"
tls_allowed_cacerts = ["%s"]
tls_cert = "%s"
tls_key = "%s"
tls_cipher_suites = ["%s"]
tls_min_version = "%s"
`, pki.TLSServerConfig().TLSAllowedCACerts[0], pki.TLSServerConfig().TLSCert, pki.TLSServerConfig().TLSKey, pki.CipherSuite(), pki.TLSMaxVersion())
var configWithoutTLS = `
listen = "127.0.0.1:0"
`
type PrometheusClientTestContext struct {
Output *prometheus_client.PrometheusClient
Accumulator *testutil.Accumulator
Client *http.Client
}
func TestWorksWithoutTLS(t *testing.T) {
tc := buildTestContext(t, []byte(configWithoutTLS))
err := tc.Output.Connect()
require.NoError(t, err)
defer tc.Output.Close()
response, err := tc.Client.Get(tc.Output.URL())
require.NoError(t, err)
require.NoError(t, err)
require.Equal(t, response.StatusCode, http.StatusOK)
}
func TestWorksWithTLS(t *testing.T) {
tc := buildTestContext(t, []byte(configWithTLS))
err := tc.Output.Connect()
require.NoError(t, err)
defer tc.Output.Close()
serverCiphers, err := inttls.ParseCiphers(tc.Output.ServerConfig.TLSCipherSuites)
require.NoError(t, err)
require.Equal(t, 1, len(serverCiphers))
tlsVersion, err := inttls.ParseTLSVersion(tc.Output.ServerConfig.TLSMinVersion)
require.NoError(t, err)
response, err := tc.Client.Get(tc.Output.URL())
require.NoError(t, err)
require.NoError(t, err)
require.Equal(t, response.StatusCode, http.StatusOK)
require.Equal(t, response.TLS.CipherSuite, serverCiphers[0])
require.Equal(t, response.TLS.Version, tlsVersion)
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
response, err = client.Get(tc.Output.URL())
require.Error(t, err)
}
func buildTestContext(t *testing.T, config []byte) *PrometheusClientTestContext {
output := prometheus_client.NewClient()
err := toml.Unmarshal(config, output)
require.NoError(t, err)
var (
httpClient *http.Client
)
if len(output.TLSAllowedCACerts) != 0 {
httpClient = buildClientWithTLS(t, output)
} else {
httpClient = buildClientWithoutTLS()
}
return &PrometheusClientTestContext{
Output: output,
Accumulator: &testutil.Accumulator{},
Client: httpClient,
}
}
func buildClientWithoutTLS() *http.Client {
return &http.Client{}
}
func buildClientWithTLS(t *testing.T, output *prometheus_client.PrometheusClient) *http.Client {
tlsConfig, err := pki.TLSClientConfig().TLSConfig()
require.NoError(t, err)
transport := &http.Transport{TLSClientConfig: tlsConfig}
return &http.Client{Transport: transport}
}

View File

@ -1,28 +0,0 @@
FROM golang:1.11.13
RUN chmod -R 755 "$GOPATH"
RUN DEBIAN_FRONTEND=noninteractive \
apt update && apt install -y --no-install-recommends \
autoconf \
git \
libtool \
locales \
make \
python-boto \
rpm \
ruby \
ruby-dev \
zip && \
rm -rf /var/lib/apt/lists/*
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
RUN locale-gen C.UTF-8 || true
ENV LANG=C.UTF-8
RUN gem install fpm
RUN go get -d github.com/golang/dep && \
cd src/github.com/golang/dep && \
git checkout -q v0.5.0 && \
go install -ldflags="-X main.version=v0.5.0" ./cmd/dep

View File

@ -1,4 +1,4 @@
FROM golang:1.10.8 FROM golang:1.13.1
RUN chmod -R 755 "$GOPATH" RUN chmod -R 755 "$GOPATH"