
* fix: don't import non-existent/unused GPG private key * fix: supply "VERSION" when doing release builds
525 lines
15 KiB
YAML
525 lines
15 KiB
YAML
version: "2.1"
|
|
|
|
executors:
|
|
cross-builder:
|
|
docker:
|
|
# NOTE: To upgrade the Go version, first push the upgrade to the cross-builder Dockerfile in the edge repo,
|
|
# then update the version here to match. Until we finish the migration to using the cross-builder image,
|
|
# you'll also need to update references to `cimg/go` and `GO_VERSION` in this file.
|
|
- image: quay.io/influxdb/cross-builder:go1.20.3-a38b5cac193a1bdf7436f45581167a43835cc727
|
|
resource_class: medium
|
|
linux-amd64:
|
|
machine:
|
|
image: ubuntu-2004:202107-02
|
|
linux-arm64:
|
|
machine:
|
|
image: ubuntu-2004:202104-01
|
|
resource_class: arm.medium
|
|
mac:
|
|
macos:
|
|
xcode: 12.5.1
|
|
resource_class: medium
|
|
shell: /bin/bash -eo pipefail
|
|
windows:
|
|
machine:
|
|
image: windows-server-2019-vs2019:stable
|
|
resource_class: windows.medium
|
|
shell: bash.exe -eo pipefail
|
|
|
|
|
|
release_filter: &release_filter
|
|
filters:
|
|
tags:
|
|
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
|
|
branches:
|
|
ignore: /.*/
|
|
|
|
workflows:
|
|
version: 2
|
|
build-and-test:
|
|
jobs:
|
|
- lint
|
|
- check-openapi
|
|
- test-race:
|
|
name: test-linux-amd64
|
|
- test-build:
|
|
matrix:
|
|
parameters:
|
|
os: [ linux, darwin, windows ]
|
|
arch: [ amd64, arm64 ]
|
|
exclude:
|
|
- os: darwin
|
|
arch: arm64
|
|
- os: windows
|
|
arch: arm64
|
|
# linux/amd64 can be tested directly from our cross-builder image
|
|
# to save time & enable running with the race detector.
|
|
- os: linux
|
|
arch: amd64
|
|
- test-prebuilt:
|
|
name: test-linux-arm64
|
|
executor: linux-arm64
|
|
os: linux
|
|
arch: arm64
|
|
requires:
|
|
- test-build-arm64-linux
|
|
- test-prebuilt:
|
|
name: test-mac
|
|
executor: mac
|
|
os: darwin
|
|
arch: amd64
|
|
requires:
|
|
- test-build-amd64-darwin
|
|
- test-prebuilt:
|
|
name: test-windows
|
|
executor: windows
|
|
os: windows
|
|
arch: amd64
|
|
requires:
|
|
- test-build-amd64-windows
|
|
- build:
|
|
name: build-<< matrix.os >>-<< matrix.arch >>
|
|
matrix:
|
|
parameters:
|
|
os: [ linux, darwin, windows ]
|
|
arch: [ amd64, arm64 ]
|
|
workflow: [ snapshot ]
|
|
exclude:
|
|
- os: darwin
|
|
arch: arm64
|
|
- os: windows
|
|
arch: arm64
|
|
- build-packages:
|
|
requires:
|
|
- build-darwin-amd64
|
|
- build-linux-amd64
|
|
- build-linux-arm64
|
|
- build-windows-amd64
|
|
release-nightly:
|
|
triggers:
|
|
- schedule:
|
|
cron: "0 5 * * *"
|
|
filters:
|
|
branches:
|
|
only:
|
|
- main
|
|
jobs:
|
|
- changelog
|
|
- lint
|
|
- check-openapi
|
|
- test-race:
|
|
name: test-linux-amd64
|
|
- test-build:
|
|
matrix:
|
|
parameters:
|
|
os: [ linux, darwin, windows ]
|
|
arch: [ amd64, arm64 ]
|
|
exclude:
|
|
- os: darwin
|
|
arch: arm64
|
|
- os: windows
|
|
arch: arm64
|
|
# linux/amd64 can be tested directly from our cross-builder image
|
|
# to save time & enable running with the race detector.
|
|
- os: linux
|
|
arch: amd64
|
|
- test-prebuilt:
|
|
name: test-linux-arm64
|
|
executor: linux-arm64
|
|
os: linux
|
|
arch: arm64
|
|
requires:
|
|
- test-build-arm64-linux
|
|
- test-prebuilt:
|
|
name: test-mac
|
|
executor: mac
|
|
os: darwin
|
|
arch: amd64
|
|
requires:
|
|
- test-build-amd64-darwin
|
|
- test-prebuilt:
|
|
name: test-windows
|
|
executor: windows
|
|
os: windows
|
|
arch: amd64
|
|
requires:
|
|
- test-build-amd64-windows
|
|
- build:
|
|
name: build-<< matrix.os >>-<< matrix.arch >>
|
|
matrix:
|
|
parameters:
|
|
os: [ linux, darwin, windows ]
|
|
arch: [ amd64, arm64 ]
|
|
workflow: [ snapshot ]
|
|
exclude:
|
|
- os: darwin
|
|
arch: arm64
|
|
- os: windows
|
|
arch: arm64
|
|
- build-packages:
|
|
requires:
|
|
- build-darwin-amd64
|
|
- build-linux-amd64
|
|
- build-linux-arm64
|
|
- build-windows-amd64
|
|
- sign-packages:
|
|
requires:
|
|
- build-packages
|
|
- release:
|
|
is-nightly: true
|
|
requires:
|
|
- changelog
|
|
- lint
|
|
- check-openapi
|
|
- test-linux-amd64
|
|
- test-linux-arm64
|
|
- test-mac
|
|
- test-windows
|
|
- sign-packages
|
|
release-tag:
|
|
jobs:
|
|
- changelog:
|
|
<<: *release_filter
|
|
- lint:
|
|
<<: *release_filter
|
|
- check-openapi:
|
|
<<: *release_filter
|
|
- test-race:
|
|
name: test-linux-amd64
|
|
<<: *release_filter
|
|
- test-build:
|
|
<<: *release_filter
|
|
matrix:
|
|
parameters:
|
|
os: [ linux, darwin, windows ]
|
|
arch: [ amd64, arm64 ]
|
|
exclude:
|
|
- os: darwin
|
|
arch: arm64
|
|
- os: windows
|
|
arch: arm64
|
|
# linux/amd64 can be tested directly from our cross-builder image
|
|
# to save time & enable running with the race detector.
|
|
- os: linux
|
|
arch: amd64
|
|
- test-prebuilt:
|
|
<<: *release_filter
|
|
name: test-linux-arm64
|
|
executor: linux-arm64
|
|
os: linux
|
|
arch: arm64
|
|
requires:
|
|
- test-build-arm64-linux
|
|
- test-prebuilt:
|
|
<<: *release_filter
|
|
name: test-mac
|
|
executor: mac
|
|
os: darwin
|
|
arch: amd64
|
|
requires:
|
|
- test-build-amd64-darwin
|
|
- test-prebuilt:
|
|
<<: *release_filter
|
|
name: test-windows
|
|
executor: windows
|
|
os: windows
|
|
arch: amd64
|
|
requires:
|
|
- test-build-amd64-windows
|
|
- build:
|
|
<<: *release_filter
|
|
name: build-<< matrix.os >>-<< matrix.arch >>
|
|
matrix:
|
|
parameters:
|
|
os: [ linux, darwin, windows ]
|
|
arch: [ amd64, arm64 ]
|
|
workflow: [ release ]
|
|
exclude:
|
|
- os: darwin
|
|
arch: arm64
|
|
- os: windows
|
|
arch: arm64
|
|
- build-packages:
|
|
<<: *release_filter
|
|
requires:
|
|
- build-darwin-amd64
|
|
- build-linux-amd64
|
|
- build-linux-arm64
|
|
- build-windows-amd64
|
|
- sign-packages:
|
|
<<: *release_filter
|
|
requires:
|
|
- build-packages
|
|
- release:
|
|
<<: *release_filter
|
|
is-nightly: false
|
|
requires:
|
|
- changelog
|
|
- lint
|
|
- check-openapi
|
|
- test-linux-amd64
|
|
- test-linux-arm64
|
|
- test-mac
|
|
- test-windows
|
|
- sign-packages
|
|
|
|
commands:
|
|
setup:
|
|
steps:
|
|
- run:
|
|
name: Install system dependencies
|
|
command: ./scripts/ci/setup-system.sh
|
|
- run:
|
|
name: Install Go
|
|
command: |
|
|
./scripts/ci/install-go.sh ${HOME}/.tools
|
|
echo 'export PATH=${HOME}/.tools/go/bin:${PATH}' >> $BASH_ENV
|
|
- run:
|
|
name: Set GOPATH and GOCACHE
|
|
command: |
|
|
GOPATH=${HOME}/go
|
|
echo "export GOPATH=${GOPATH}" >> $BASH_ENV
|
|
mkdir -p ${GOPATH}/bin
|
|
echo 'export PATH=${GOPATH}/bin:${PATH}' >> $BASH_ENV
|
|
mkdir -p ${HOME}/.cache
|
|
echo 'export GOCACHE=${HOME}/.cache' >> $BASH_ENV
|
|
|
|
jobs:
|
|
lint:
|
|
executor: cross-builder
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: vet
|
|
command: make vet
|
|
when: always
|
|
- run:
|
|
name: Check formatting
|
|
command: make checkfmt
|
|
when: always
|
|
- run:
|
|
name: Check mod tidy
|
|
command: make checktidy
|
|
when: always
|
|
- run:
|
|
name: staticcheck
|
|
command: make staticcheck
|
|
when: always
|
|
- run:
|
|
name: Check generate
|
|
command: make checkgenerate
|
|
when: always
|
|
|
|
check-openapi:
|
|
executor: linux-amd64
|
|
steps:
|
|
- checkout
|
|
- setup
|
|
- run:
|
|
name: Init openapi submodule
|
|
command: git submodule update --init --recursive
|
|
- run: make checkopenapi
|
|
|
|
release:
|
|
parameters:
|
|
is-nightly:
|
|
type: boolean
|
|
executor: linux-amd64
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: .
|
|
- run:
|
|
command: |
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
sudo -E apt-get update
|
|
sudo -E apt-get install --yes awscli
|
|
- when:
|
|
condition: << parameters.is-nightly >>
|
|
steps:
|
|
- run:
|
|
command: .circleci/scripts/upload-artifacts nightly
|
|
- unless:
|
|
condition: << parameters.is-nightly >>
|
|
steps:
|
|
- run:
|
|
command: .circleci/scripts/upload-artifacts release
|
|
- store_artifacts:
|
|
path: packages
|
|
|
|
test-build:
|
|
executor: cross-builder
|
|
parameters:
|
|
os:
|
|
type: string
|
|
arch:
|
|
type: string
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Build test binaries
|
|
command: |
|
|
export GOOS=<< parameters.os >>
|
|
export GOARCH=<< parameters.arch >>
|
|
./scripts/ci/build-tests.sh ./test-bin-"$GOOS"-"$GOARCH"
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- ./test-bin*
|
|
|
|
test-prebuilt:
|
|
parameters:
|
|
executor:
|
|
type: executor
|
|
os:
|
|
type: string
|
|
arch:
|
|
type: string
|
|
executor: << parameters.executor >>
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: .
|
|
- run:
|
|
name: Run tests
|
|
command: ./scripts/ci/run-prebuilt-tests.sh $(pwd)/test-bin-<< parameters.os >>-<< parameters.arch >> $(pwd)/test-results
|
|
- store_artifacts:
|
|
path: ./test-results
|
|
destination: raw-test-output
|
|
- store_test_results:
|
|
path: ./test-results
|
|
|
|
test-race:
|
|
executor: cross-builder
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Run race tests
|
|
command: ./scripts/ci/run-race-tests.sh $(pwd)/test-results
|
|
- store_artifacts:
|
|
path: ./test-results
|
|
destination: raw-test-output
|
|
- store_test_results:
|
|
path: ./test-results
|
|
|
|
build:
|
|
executor: cross-builder
|
|
parameters:
|
|
os:
|
|
type: string
|
|
arch:
|
|
type: string
|
|
workflow:
|
|
type: string
|
|
steps:
|
|
- checkout
|
|
- when:
|
|
condition:
|
|
equals: [ << parameters.workflow >>, snapshot ]
|
|
steps:
|
|
- run: |
|
|
GOOS=<< parameters.os >> GOARCH=<< parameters.arch >> COMMIT=<< pipeline.git.revision >> make
|
|
- when:
|
|
condition:
|
|
equals: [ << parameters.workflow >>, release ]
|
|
steps:
|
|
- run: |
|
|
GOOS=<< parameters.os >> GOARCH=<< parameters.arch >> COMMIT=<< pipeline.git.revision >> VERSION=<< pipeline.git.tag >> make
|
|
- store_artifacts:
|
|
path: bin
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths: bin
|
|
|
|
build-packages:
|
|
docker:
|
|
- image: ubuntu:latest
|
|
resource_class: small
|
|
steps:
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- checkout
|
|
- run:
|
|
name: Build Packages
|
|
command: |
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update
|
|
apt-get install --yes \
|
|
build-essential \
|
|
git \
|
|
gnupg \
|
|
rpm \
|
|
ruby-dev
|
|
gem install fpm
|
|
|
|
mkdir -p packages
|
|
OS=darwin ARCH=amd64 scripts/ci/build-packages /tmp/workspace/bin/darwin/amd64/influx "${PWD}/packages"
|
|
OS=linux ARCH=amd64 scripts/ci/build-packages /tmp/workspace/bin/linux/amd64/influx "${PWD}/packages"
|
|
OS=linux ARCH=arm64 scripts/ci/build-packages /tmp/workspace/bin/linux/arm64/influx "${PWD}/packages"
|
|
OS=windows ARCH=amd64 scripts/ci/build-packages /tmp/workspace/bin/windows/amd64/influx.exe "${PWD}/packages"
|
|
- store_artifacts:
|
|
path: packages/
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- packages
|
|
|
|
sign-packages:
|
|
circleci_ip_ranges: true
|
|
docker:
|
|
- image: quay.io/influxdb/rsign:latest
|
|
auth:
|
|
username: $QUAY_RSIGN_USERNAME
|
|
password: $QUAY_RSIGN_PASSWORD
|
|
steps:
|
|
- add_ssh_keys:
|
|
fingerpints:
|
|
-
|
|
- attach_workspace:
|
|
at: /tmp/workspace
|
|
- run: |
|
|
for target in /tmp/workspace/packages/*
|
|
do
|
|
case "${target}"
|
|
in
|
|
# rsign is shipped on Alpine Linux which uses "busybox ash" instead
|
|
# of bash. ash is somewhat more posix compliant and is missing some
|
|
# extensions and niceties from bash.
|
|
*.deb|*.rpm|*.tar.gz|*.zip)
|
|
rsign "${target}"
|
|
;;
|
|
esac
|
|
done
|
|
- persist_to_workspace:
|
|
root: /tmp/workspace
|
|
paths:
|
|
- packages
|
|
- store_artifacts:
|
|
path: /tmp/workspace/packages
|
|
|
|
changelog:
|
|
docker:
|
|
- image: quay.io/influxdb/changelogger:a20523cf8594eb93920e74d0189d6602a76a6146
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Generate changelog
|
|
command: |
|
|
CHANGELOG_FILE_NAME="CHANGELOG-CLI"
|
|
if [ -n "<< pipeline.git.tag >>" ]; then
|
|
CHANGELOG_FILE_NAME="CHANGELOG-CLI-<< pipeline.git.tag >>"
|
|
fi
|
|
|
|
mkdir changelog_artifacts
|
|
|
|
echo -e "CHANGELOG for influx-cli commit ${CIRCLE_SHA1}\n" > changelog_artifacts/"$CHANGELOG_FILE_NAME".md
|
|
echo "In addition to the list of changes below, please also see the [official release notes](https://docs.influxdata.com/influxdb/latest/reference/release-notes/influx-cli/) for other important information about this release." >> changelog_artifacts/"$CHANGELOG_FILE_NAME".md
|
|
build-changelog-by-tags.sh HEAD v2.2.1 main >> changelog_artifacts/"$CHANGELOG_FILE_NAME".md
|
|
cat ./scripts/ci/CHANGELOG_frozen.md >> changelog_artifacts/"$CHANGELOG_FILE_NAME".md
|
|
- store_artifacts:
|
|
path: changelog_artifacts/
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- changelog_artifacts
|