Upgrade circle-ci config to v2.1 (#8621)

* Upgrade to 2.1 circle-ci config

* new line
This commit is contained in:
Sebastian Spaink 2021-01-06 16:23:29 -06:00 committed by GitHub
parent 4608620924
commit c8584a7b3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 107 additions and 88 deletions

View File

@ -1,16 +1,19 @@
--- version: 2.1
defaults:
defaults: &defaults executors:
go-1_14:
working_directory: '/go/src/github.com/influxdata/telegraf' working_directory: '/go/src/github.com/influxdata/telegraf'
environment:
GOFLAGS: -p=8
go-1_14: &go-1_14
docker: docker:
- image: 'quay.io/influxdb/telegraf-ci:1.14.9' - image: 'quay.io/influxdb/telegraf-ci:1.14.9'
go-1_15: &go-1_15 environment:
GOFLAGS: -p=8
go-1_15:
working_directory: '/go/src/github.com/influxdata/telegraf'
docker: docker:
- image: 'quay.io/influxdb/telegraf-ci:1.15.5' - image: 'quay.io/influxdb/telegraf-ci:1.15.5'
mac: &mac environment:
GOFLAGS: -p=8
mac:
macos: macos:
xcode: 12.1.0 xcode: 12.1.0
working_directory: '~/go/src/github.com/influxdata/telegraf' working_directory: '~/go/src/github.com/influxdata/telegraf'
@ -18,10 +21,52 @@ defaults:
HOMEBREW_NO_AUTO_UPDATE: 1 HOMEBREW_NO_AUTO_UPDATE: 1
GOFLAGS: -p=8 GOFLAGS: -p=8
version: 2 commands:
test-go:
parameters:
goarch:
type: string
default: "amd64"
steps:
- checkout
- attach_workspace:
at: '/go'
- run: 'GOARCH=<< parameters.goarch >> make'
- run: 'GOARCH=<< parameters.goarch >> make check'
- run: 'GOARCH=<< parameters.goarch >> make check-deps'
- run: 'GOARCH=<< parameters.goarch >> make test'
test-go-mac:
steps:
- checkout
- attach_workspace:
at: '/'
- run: 'make'
- run: 'make check'
- run: 'make test'
package:
parameters:
nightly:
type: boolean
default: false
steps:
- checkout
- attach_workspace:
at: '/go'
- when:
condition: << parameters.nightly >>
steps:
- run: 'NIGHTLY=1 make package'
- run: 'make upload-nightly'
- unless:
condition: << parameters.nightly >>
steps:
- run: 'make package'
- store_artifacts:
path: './build/dist'
destination: 'build/dist'
jobs: jobs:
deps: deps:
<<: [ *defaults, *go-1_15 ] executor: go-1_15
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
@ -38,7 +83,7 @@ jobs:
paths: paths:
- '*' - '*'
macdeps: macdeps:
<<: [ *mac ] executor: mac
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
@ -62,75 +107,42 @@ jobs:
- 'usr/local/bin/gofmt' - 'usr/local/bin/gofmt'
- 'Users/distiller/go' - 'Users/distiller/go'
test-go-1.14: test-go-1_14:
<<: [ *defaults, *go-1_14 ] executor: go-1_14
steps: steps:
- attach_workspace: - test-go
at: '/go' test-go-1_14-386:
- run: 'make' executor: go-1_14
- run: 'make test'
test-go-1.14-386:
<<: [ *defaults, *go-1_14 ]
steps: steps:
- attach_workspace: - test-go:
at: '/go' goarch: "386"
- run: 'GOARCH=386 make' test-go-1_15:
- run: 'GOARCH=386 make test' executor: go-1_15
test-go-1.15:
<<: [ *defaults, *go-1_15 ]
steps: steps:
- attach_workspace: - test-go
at: '/go' test-go-1_15-386:
- run: 'make' executor: go-1_15
- run: 'make check'
- run: 'make check-deps'
- run: 'make test'
test-go-1.15-386:
<<: [ *defaults, *go-1_15 ]
steps: steps:
- attach_workspace: - test-go:
at: '/go' goarch: "386"
- run: 'GOARCH=386 make'
- run: 'GOARCH=386 make check'
- run: 'GOARCH=386 make test'
test-go-darwin: test-go-darwin:
<<: [ *mac ] executor: mac
steps: steps:
- attach_workspace: - test-go-mac
at: '/'
- run: 'make'
- run: 'make check'
- run: 'make test'
package: package:
<<: [ *defaults, *go-1_15 ] executor: go-1_15
steps: steps:
- attach_workspace: - package
at: '/go'
- run: 'make package'
- store_artifacts:
path: './build/dist'
destination: 'build/dist'
release: release:
<<: [ *defaults, *go-1_15 ] executor: go-1_15
steps: steps:
- attach_workspace: - package
at: '/go'
- run: 'make package'
- store_artifacts:
path: './build/dist'
destination: 'build/dist'
nightly: nightly:
<<: [ *defaults, *go-1_15 ] executor: go-1_15
steps: steps:
- attach_workspace: - package:
at: '/go' nightly: true
- run: 'NIGHTLY=1 make package'
- run: 'make upload-nightly'
- store_artifacts:
path: './build/dist'
destination: 'build/dist'
workflows: workflows:
version: 2 version: 2
@ -144,25 +156,25 @@ workflows:
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- 'test-go-1.14': - 'test-go-1_14':
requires: requires:
- 'deps' - 'deps'
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- 'test-go-1.14-386': - 'test-go-1_14-386':
requires: requires:
- 'deps' - 'deps'
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- 'test-go-1.15': - 'test-go-1_15':
requires: requires:
- 'deps' - 'deps'
filters: filters:
tags: tags:
only: /.*/ only: /.*/
- 'test-go-1.15-386': - 'test-go-1_15-386':
requires: requires:
- 'deps' - 'deps'
filters: filters:
@ -177,17 +189,17 @@ workflows:
- 'package': - 'package':
requires: requires:
- 'test-go-darwin' - 'test-go-darwin'
- 'test-go-1.14' - 'test-go-1_14'
- 'test-go-1.14-386' - 'test-go-1_14-386'
- 'test-go-1.15' - 'test-go-1_15'
- 'test-go-1.15-386' - 'test-go-1_15-386'
- 'release': - 'release':
requires: requires:
- 'test-go-darwin' - 'test-go-darwin'
- 'test-go-1.14' - 'test-go-1_14'
- 'test-go-1.14-386' - 'test-go-1_14-386'
- 'test-go-1.15' - 'test-go-1_15'
- 'test-go-1.15-386' - 'test-go-1_15-386'
filters: filters:
tags: tags:
only: /.*/ only: /.*/
@ -197,16 +209,16 @@ workflows:
jobs: jobs:
- 'deps' - 'deps'
- 'macdeps' - 'macdeps'
- 'test-go-1.14': - 'test-go-1_14':
requires: requires:
- 'deps' - 'deps'
- 'test-go-1.14-386': - 'test-go-1_14-386':
requires: requires:
- 'deps' - 'deps'
- 'test-go-1.15': - 'test-go-1_15':
requires: requires:
- 'deps' - 'deps'
- 'test-go-1.15-386': - 'test-go-1_15-386':
requires: requires:
- 'deps' - 'deps'
- 'test-go-darwin': - 'test-go-darwin':
@ -215,10 +227,10 @@ workflows:
- 'nightly': - 'nightly':
requires: requires:
- 'test-go-darwin' - 'test-go-darwin'
- 'test-go-1.14' - 'test-go-1_14'
- 'test-go-1.14-386' - 'test-go-1_14-386'
- 'test-go-1.15' - 'test-go-1_15'
- 'test-go-1.15-386' - 'test-go-1_15-386'
triggers: triggers:
- schedule: - schedule:
cron: "0 7 * * *" cron: "0 7 * * *"

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/telegraf.gz /telegraf.gz
/vendor /vendor
.DS_Store .DS_Store
process.yml

View File

@ -75,7 +75,7 @@ const (
defaultClientTimeout = 5 * time.Second defaultClientTimeout = 5 * time.Second
defaultMethod = http.MethodPost defaultMethod = http.MethodPost
defaultMaxRequestBodySize = 1_000_000 defaultMaxRequestBodySize = 1000000
contentTypeHeader = "Content-Type" contentTypeHeader = "Content-Type"
carbon2ContentType = "application/vnd.sumologic.carbon2" carbon2ContentType = "application/vnd.sumologic.carbon2"

6
scripts/local_circleci.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
jobName=$1
circleci config process .circleci/config.yml > process.yml
circleci local execute -c process.yml --job $jobName