build: fix goreleaser setup and release jobs (#20465)

pull/20469/head
Daniel Moran 2021-01-07 08:06:12 -08:00 committed by GitHub
parent 30306e5b10
commit defac1b9d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 68 additions and 37 deletions

View File

@ -43,6 +43,13 @@ workflows:
filters:
branches:
only: /^(?!pull\/).*$/
- cross_build:
requires:
- build
filters:
branches:
only:
- master
- litmus_integration:
requires:
- litmus_daily
@ -99,7 +106,7 @@ workflows:
- jslint:
requires:
- jsdeps
- deploy-nightly:
- deploy_nightly:
requires:
- gotest
- golint
@ -113,10 +120,10 @@ workflows:
- master
- litmus_nightly:
requires:
- deploy-nightly
- deploy_nightly
- grace_nightly:
requires:
- deploy-nightly
- deploy_nightly
release:
jobs:
@ -213,8 +220,8 @@ jobs:
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-{{ checksum "ui/yarn.lock" }}
- yarn-deps-
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- yarn-deps-lock-
- run:
name: Install Dependencies
command: |
@ -223,7 +230,7 @@ jobs:
yarn install --immutable
- save_cache:
name: Save Yarn Cache
key: yarn-deps-{{ checksum "ui/yarn.lock" }}
key: yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
paths:
- /home/circleci/go/src/github.com/influxdata/influxdb/ui/node_modules
- ~/.cache/yarn
@ -238,7 +245,7 @@ jobs:
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-{{ checksum "ui/yarn.lock" }}
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- run:
name: install dependencies
command: |
@ -268,7 +275,7 @@ jobs:
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-{{ checksum "ui/yarn.lock" }}
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- run:
name: install dependencies
command: |
@ -301,14 +308,14 @@ jobs:
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }}
- influxdb-gomod-
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- influxdb-gomod-sum-
- run:
name: Install Dependencies
command: go mod download -x
- save_cache:
name: Save GOPATH/pkg/mod
key: influxdb-gomod-{{ checksum "go.sum" }}
key: influxdb-gomod-sum-{{ checksum "go.sum" }}
paths:
- /home/circleci/go/pkg/mod
@ -322,7 +329,7 @@ jobs:
- checkout
- restore_cache:
keys:
- influxdb-gomod-{{ checksum "go.sum" }}
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- run: |
# this is not in a seperate bash script because it isn't meant to be run on local.
# it just checks to make sure that the same major/minor version of go is used in the mod file as on ci
@ -360,7 +367,7 @@ jobs:
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }}
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- run: mkdir -p $TEST_RESULTS
- run:
name: run parallel race tests
@ -398,7 +405,7 @@ jobs:
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }}
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- run: mkdir -p $TEST_RESULTS
- run: make GO_TEST_CMD="gotestsum --format standard-quiet --junitfile /tmp/test-results/gotestsum.xml --" test-influxql-validation
- save_cache:
@ -431,7 +438,7 @@ jobs:
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }}
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- run: mkdir -p $TEST_RESULTS
- run: make GO_TEST_CMD="gotestsum --format standard-quiet --junitfile /tmp/test-results/gotestsum.xml --" test-influxql-integration
- save_cache:
@ -461,7 +468,7 @@ jobs:
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }}
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- restore_cache:
name: Restore GOCACHE
keys:
@ -471,8 +478,7 @@ jobs:
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-{{ checksum "ui/yarn.lock" }}
- run: make protoc
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- run: make build
- save_cache:
name: Save GOCACHE
@ -488,7 +494,42 @@ jobs:
- etc/litmus_success_notify.sh
- etc/litmus_fail_notify.sh
deploy-nightly:
cross_build:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
environment:
GOCACHE: /tmp/go-cache
steps:
- checkout
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- restore_cache:
name: Restore GOCACHE
keys:
- influxdb-cross-build-{{ .Branch }}-{{ .Revision }}
- influxdb-cross-build-{{ .Branch }}-
- influxdb-build-{{ .Branch }}-{{ .Revision }}
- influxdb-build-{{ .Branch }}-
- influxdb-cross-build-
- influxdb-build-
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- setup_remote_docker
- run:
name: Docker Login
command: docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
- run: make dist
- save_cache:
name: Save GOCACHE
key: influxdb-cross-build-{{ .Branch }}-{{ .Revision }}
paths:
- /tmp/go-cache
deploy_nightly:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
environment:
@ -499,7 +540,7 @@ jobs:
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }}
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- restore_cache:
name: Restore GOCACHE
keys:
@ -512,12 +553,11 @@ jobs:
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-{{ checksum "ui/yarn.lock" }}
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- setup_remote_docker
- run:
name: Docker Login
command: docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
- run: make protoc # installs protoc
- run:
name: Build nightly
command: make nightly
@ -543,7 +583,7 @@ jobs:
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }}
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- restore_cache:
name: Restore GOCACHE
keys:
@ -556,12 +596,11 @@ jobs:
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-{{ checksum "ui/yarn.lock" }}
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- setup_remote_docker
- run:
name: Docker Login
command: docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
- run: make protoc # installs protoc
- run:
name: import GPG key
command: |
@ -594,8 +633,7 @@ jobs:
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-{{ checksum "ui/yarn.lock" }}
- run: make protoc
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- run:
command: ./bin/linux/influxd --store=memory --e2e-testing=true --feature-flags=communityTemplates=true
background: true

View File

@ -15,6 +15,7 @@
# It is required that all SUBDIRS have the `all` and `clean` targets.
SUBDIRS := http ui chronograf storage
export GOPATH=$(shell go env GOPATH)
export GOOS=$(shell go env GOOS)
export GOARCH=$(shell go env GOARCH)
@ -216,13 +217,6 @@ run: chronogiraffe
run-e2e: chronogiraffe
./bin/$(GOOS)/influxd --assets-path=ui/build --e2e-testing --store=memory
# assume this is running from circleci
# TODO: Move this to the CI docker image build?
protoc:
curl -s -L https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip > /tmp/protoc.zip
unzip -o -d /go /tmp/protoc.zip
chmod +x /go/bin/protoc
# generate feature flags
flags:
$(GO_GENERATE) ./kit/feature

View File

@ -62,16 +62,15 @@ ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=/usr/local/musl/bin/musl-gcc
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/usr/local/musl-cross/bin/aarch64-unknown-linux-musl-gcc
ENV CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=/usr/local/osxcross/target/bin/x86_64-apple-darwin15-clang
WORKDIR /go
# Install Docker buildkit to support multi-arch image builds.
ENV DOCKER_BUILDX_VERSION=0.5.1
RUN mkdir -p /home/circleci/.docker/cli-plugins && \
curl -sfL -o /home/circleci/.docker/cli-plugins/docker-buildx \
https://github.com/docker/buildx/releases/download/v${DOCKER_BUILDX_VERSION}/buildx-v${DOCKER_BUILDX_VERSION}.linux-amd64 && \
chmod a+x /home/circleci/.docker/cli-plugins/docker-buildx
WORKDIR $GOPATH
# Install goreleaser.
ENV GORELEASER_VERSION=v0.152.0
RUN curl -sfL -o goreleaser-install https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh && \