Merge pull request #11508 from influxdata/feat/releasing

ci(goreleaser): create a release version of goreleaser
pull/11250/head
Chris Goller 2019-01-23 14:58:24 -06:00 committed by GitHub
commit 460ca4dda4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 138 additions and 24 deletions

View File

@ -37,14 +37,14 @@ jobs:
- restore_cache:
name: Restoring GOCACHE
keys:
- platform-gocache-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run.
- platform-gocache-{{ .Branch }}- # Matches a new commit on an existing branch.
- platform-gocache- # Matches a new branch.
- influxdb-gocache-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run.
- influxdb-gocache-{{ .Branch }}- # Matches a new commit on an existing branch.
- influxdb-gocache- # Matches a new branch.
# Populate GOPATH/pkg.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- platform-gomod-{{ checksum "go.sum" }} # Matches based on go.sum checksum.
- influxdb-gomod-{{ checksum "go.sum" }} # Matches based on go.sum checksum.
- run: make test-go # This uses the test cache so it may succeed or fail quickly.
- run: make vet
- run: make checkfmt
@ -64,13 +64,13 @@ jobs:
- save_cache:
name: Saving GOCACHE
key: platform-gocache-{{ .Branch }}-{{ .Revision }}
key: influxdb-gocache-{{ .Branch }}-{{ .Revision }}
paths:
- /tmp/go-cache
when: always
- save_cache:
name: Saving GOPATH/pkg/mod
key: platform-gomod-{{ checksum "go.sum" }}
key: influxdb-gomod-{{ checksum "go.sum" }}
paths:
- /go/pkg/mod
when: always
@ -89,18 +89,18 @@ jobs:
- restore_cache:
name: Restoring GOCACHE
keys:
- platform-gocache- # Just match the most recent Go cache.
- influxdb-gocache- # Just match the most recent Go cache.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- platform-gomod-{{ checksum "go.sum" }} # Just match the go.sum checksum cache.
- influxdb-gomod-{{ checksum "go.sum" }} # Just match the go.sum checksum cache.
- restore_cache:
name: Restore Yarn package cache
keys:
- chronograf-npm-packages-{{ checksum "ui/package-lock.json" }}
- run: make build
deploy:
deploy-nightly:
docker:
- image: circleci/golang:1.11-node-browsers
environment:
@ -114,11 +114,11 @@ jobs:
- restore_cache:
name: Restoring GOCACHE
keys:
- platform-gocache- # Just match the most recent Go cache.
- influxdb-gocache- # Just match the most recent Go cache.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- platform-gomod-{{ checksum "go.sum" }} # Just match the go.sum checksum cache.
- influxdb-gomod-{{ checksum "go.sum" }} # Just match the go.sum checksum cache.
- restore_cache:
name: Restore Yarn package cache
keys:
@ -127,12 +127,40 @@ jobs:
- run:
name: "Docker Login"
command: docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
- run:
name: "Tag commit for goreleaser semantic versioning"
command: git tag v0.0.0
- run:
name: "Build nightly"
command: make nightly
release:
docker:
- image: circleci/golang:1.11-node-browsers
environment:
GOCACHE: /tmp/go-cache
GOFLAGS: "-mod=readonly -p=4" # Go on Circle thinks 32 CPUs are available, but there aren't.
DOCKER_VERSION: 2.0.0-alpha
working_directory: /go/src/github.com/influxdata/influxdb
steps:
- checkout
# Speed up `make nightly` by restoring caches from previous runs.
- restore_cache:
name: Restoring GOCACHE
keys:
- influxdb-gocache- # Just match the most recent Go cache.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }} # Just match the go.sum checksum cache.
- restore_cache:
name: Restore Yarn package cache
keys:
- chronograf-npm-packages-{{ checksum "ui/package-lock.json" }}
- setup_remote_docker
- run:
name: "Docker Login"
command: docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
- run:
name: "Build release"
command: make release
workflows:
version: 2
@ -153,10 +181,23 @@ workflows:
jobs:
- gotest
- jstest
- deploy:
- deploy-nightly:
requires:
- gotest
- jstest
filters:
branches:
only: master
release:
jobs:
- gotest
- jstest
- release:
requires:
- gotest
- jstest
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$/

65
.goreleaser-nightly.yml Normal file
View File

@ -0,0 +1,65 @@
project_name: platform
builds:
- goos:
- linux
- darwin
goarch:
- amd64
- arm64
main: ./cmd/influx/
env:
- GO111MODULE=on
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
binary: influx
- goos:
- linux
- darwin
goarch:
- amd64
- arm64
main: ./cmd/influxd/
flags:
- -tags=assets
env:
- GO111MODULE=on
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
binary: influxd
hooks:
pre: make generate
archive:
format: tar.gz
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{
.Arm }}{{ end }}'
files:
- LICENSE
- README.md
snapshot:
name_template: 'nightly'
s3:
-
bucket: dl.influxdata.com
region: us-east-1
folder: "platform/nightlies/"
dockers:
- goos: linux
goarch: amd64
binaries:
- influxd
- influx
image_templates:
- 'quay.io/influxdb/influx:{{ .Version }}'
dockerfile: docker/influxd/Dockerfile
extra_files:
- docker/influxd/entrypoint.sh
# Do not make github release
release:
disable: true

View File

@ -1,4 +1,4 @@
project_name: platform
project_name: influxdb
builds:
- goos:
- linux
@ -9,6 +9,7 @@ builds:
main: ./cmd/influx/
env:
- GO111MODULE=on
- CGO_ENABLED=0
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
binary: influx
- goos:
@ -22,6 +23,7 @@ builds:
- -tags=assets
env:
- GO111MODULE=on
- CGO_ENABLED=0
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
binary: influxd
hooks:
@ -39,14 +41,11 @@ archive:
- LICENSE
- README.md
snapshot:
name_template: 'nightly'
s3:
-
bucket: dl.influxdata.com
region: us-east-1
folder: "platform/nightlies/"
folder: "influxdb/releases/"
dockers:
- goos: linux
@ -55,11 +54,14 @@ dockers:
- influxd
- influx
image_templates:
- 'quay.io/influxdb/influx:{{ .Version }}'
- 'quay.io/influxdb/influxdb:{{ .Env.DOCKER_VERSION }}'
dockerfile: docker/influxd/Dockerfile
extra_files:
- docker/influxd/entrypoint.sh
# Do not make github release
release:
disable: true
name_template: "v{{.Version}}"
prerelease: auto # when we go to GA remove this line
draft: true # when we go to GA remove this line
disable: true # we keep the artifacts in S3 and link from the website

View File

@ -19,6 +19,7 @@ GO_ARGS=-tags '$(GO_TAGS)'
# Test vars can be used by all recursive Makefiles
export GOOS=$(shell go env GOOS)
export GO_BUILD=env GO111MODULE=on go build $(GO_ARGS)
export GO_INSTALL=env GO111MODULE=on go install $(GO_ARGS)
export GO_TEST=env GOTRACEBACK=all GO111MODULE=on go test $(GO_ARGS)
# Do not add GO111MODULE=on to the call to go generate so it doesn't pollute the environment.
export GO_GENERATE=go generate $(GO_ARGS)
@ -119,10 +120,15 @@ bench:
build: all
dist:
$(GO_RUN) github.com/goreleaser/goreleaser --snapshot --rm-dist
$(GO_RUN) github.com/goreleaser/goreleaser --snapshot --rm-dist --config=.goreleaser-nightly.yml
nightly:
$(GO_RUN) github.com/goreleaser/goreleaser --snapshot --rm-dist --publish-snapshots
$(GO_RUN) github.com/goreleaser/goreleaser --snapshot --rm-dist --publish-snapshots --config=.goreleaser-nightly.yml
release:
$(GO_INSTALL) github.com/goreleaser/goreleaser
git checkout -- go.sum # avoid dirty git repository caused by go install
goreleaser release --rm-dist
clean:
@for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done