2020-11-26 13:38:27 +00:00
|
|
|
|
# CI Overview
|
|
|
|
|
# -----------
|
|
|
|
|
#
|
|
|
|
|
# Each night:
|
|
|
|
|
#
|
|
|
|
|
# A build image is created (ci_image) from `docker/Dockerfile.ci` and is
|
|
|
|
|
# pushed to `quay.io/influxdb/rust:ci`. This build image is then used to run
|
|
|
|
|
# the CI tasks for the day.
|
|
|
|
|
#
|
|
|
|
|
# CI runs for git branches ending in `/perf`:
|
|
|
|
|
#
|
|
|
|
|
# Runs tests, fmt, & lints and then compiles binaries using the "release"
|
|
|
|
|
# cargo target and pushes a container with the binary to
|
|
|
|
|
# `quay.io/influxdb/fusion` (see perf_image below).
|
2020-11-26 16:38:57 +00:00
|
|
|
|
#
|
2021-03-29 16:55:50 +00:00
|
|
|
|
# CI for all other branches:
|
|
|
|
|
#
|
|
|
|
|
# - cargo build with the default cargo profile ("dev")
|
|
|
|
|
# - cargo test
|
|
|
|
|
# - cargo fmt
|
|
|
|
|
# - clippy (with warnings denied)
|
|
|
|
|
# - lint protobufs
|
2021-04-07 20:33:38 +00:00
|
|
|
|
# - check if generated flatbuffers code is up to date
|
2020-11-26 13:38:27 +00:00
|
|
|
|
|
2020-02-07 15:39:31 +00:00
|
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
|
|
commands:
|
2021-04-20 19:29:14 +00:00
|
|
|
|
rust_components:
|
|
|
|
|
description: Install additional toolchain components
|
2021-04-20 15:17:05 +00:00
|
|
|
|
steps:
|
|
|
|
|
- run:
|
2021-04-20 19:29:14 +00:00
|
|
|
|
# Cargo will automatically install the toolchain based on rust-toolchain
|
|
|
|
|
# But won't install optional components
|
|
|
|
|
# This will only matter when the CI image is out of date
|
|
|
|
|
name: Install rustfmt and clippy
|
|
|
|
|
command: rustup component add rustfmt clippy
|
|
|
|
|
|
2021-03-29 16:55:50 +00:00
|
|
|
|
cache_restore:
|
|
|
|
|
description: Restore Cargo Cache
|
|
|
|
|
steps:
|
|
|
|
|
- restore_cache:
|
|
|
|
|
name: Restoring Cargo Cache
|
|
|
|
|
keys:
|
|
|
|
|
- cargo-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
|
|
|
|
|
- cargo-cache-{{ arch }}-{{ .Branch }}
|
|
|
|
|
- cargo-cache
|
|
|
|
|
cache_save:
|
|
|
|
|
description: Save Cargo Cache
|
|
|
|
|
steps:
|
|
|
|
|
- save_cache:
|
|
|
|
|
name: Save Cargo Cache
|
|
|
|
|
paths:
|
|
|
|
|
- /usr/local/cargo/registry
|
|
|
|
|
key: cargo-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
|
2020-06-05 21:45:44 +00:00
|
|
|
|
|
2020-02-07 15:39:31 +00:00
|
|
|
|
jobs:
|
|
|
|
|
fmt:
|
|
|
|
|
docker:
|
2020-05-28 01:25:57 +00:00
|
|
|
|
- image: quay.io/influxdb/rust:ci
|
2021-03-29 16:55:50 +00:00
|
|
|
|
environment:
|
|
|
|
|
# Disable full debug symbol generation to speed up CI build
|
|
|
|
|
# "1" means line tables only, which is useful for panic tracebacks.
|
|
|
|
|
RUSTFLAGS: "-C debuginfo=1"
|
2020-02-07 15:39:31 +00:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
2021-04-20 19:29:14 +00:00
|
|
|
|
- rust_components
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_restore
|
2020-02-07 15:39:31 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Rust fmt
|
2020-02-14 13:01:39 +00:00
|
|
|
|
command: cargo fmt --all -- --check
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_save
|
2020-02-07 15:39:31 +00:00
|
|
|
|
lint:
|
|
|
|
|
docker:
|
2020-05-28 01:25:57 +00:00
|
|
|
|
- image: quay.io/influxdb/rust:ci
|
2021-03-29 16:55:50 +00:00
|
|
|
|
environment:
|
|
|
|
|
# Disable full debug symbol generation to speed up CI build
|
|
|
|
|
# "1" means line tables only, which is useful for panic tracebacks.
|
|
|
|
|
RUSTFLAGS: "-C debuginfo=1"
|
2020-02-07 15:39:31 +00:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
2021-04-20 19:29:14 +00:00
|
|
|
|
- rust_components
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_restore
|
2020-02-07 15:39:31 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Clippy
|
2020-05-08 14:24:01 +00:00
|
|
|
|
command: cargo clippy --all-targets --workspace -- -D warnings
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_save
|
2020-02-07 15:39:31 +00:00
|
|
|
|
test:
|
|
|
|
|
docker:
|
2020-05-28 01:25:57 +00:00
|
|
|
|
- image: quay.io/influxdb/rust:ci
|
2020-11-06 15:24:47 +00:00
|
|
|
|
resource_class: xlarge # use of a smaller executor tends crashes on link
|
2021-03-29 16:55:50 +00:00
|
|
|
|
environment:
|
|
|
|
|
# Disable full debug symbol generation to speed up CI build
|
|
|
|
|
# "1" means line tables only, which is useful for panic tracebacks.
|
|
|
|
|
RUSTFLAGS: "-C debuginfo=1"
|
2020-02-07 15:39:31 +00:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
2021-04-20 19:29:14 +00:00
|
|
|
|
- rust_components
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_restore
|
2020-02-07 15:39:31 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Cargo test
|
2020-05-08 14:24:01 +00:00
|
|
|
|
command: cargo test --workspace
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_save
|
|
|
|
|
|
2021-04-05 13:21:32 +00:00
|
|
|
|
# Integration tests for the influxdb2_client crate against InfluxDB 2.0 OSS.
|
|
|
|
|
test_influxdb2_client:
|
|
|
|
|
docker:
|
|
|
|
|
- image: quay.io/influxdb/rust:ci
|
|
|
|
|
environment:
|
|
|
|
|
# Disable full debug symbol generation to speed up CI build
|
|
|
|
|
# "1" means line tables only, which is useful for panic tracebacks.
|
|
|
|
|
RUSTFLAGS: "-C debuginfo=1"
|
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
2021-04-20 19:29:14 +00:00
|
|
|
|
- rust_components
|
2021-04-05 13:21:32 +00:00
|
|
|
|
- cache_restore
|
|
|
|
|
- run:
|
|
|
|
|
name: Cargo test
|
2021-04-21 14:32:07 +00:00
|
|
|
|
command: TEST_INTEGRATION=1 INFLUXDB_IOX_INTEGRATION_LOCAL=1 cargo test -p influxdb2_client
|
2021-04-05 13:21:32 +00:00
|
|
|
|
- cache_save
|
|
|
|
|
|
2020-11-26 13:38:27 +00:00
|
|
|
|
# Build a dev binary.
|
|
|
|
|
#
|
|
|
|
|
# Compiles a binary with the default ("dev") cargo profile from the iox source
|
|
|
|
|
# using the latest ci_image.
|
2020-02-07 15:39:31 +00:00
|
|
|
|
build:
|
|
|
|
|
docker:
|
2020-05-28 01:25:57 +00:00
|
|
|
|
- image: quay.io/influxdb/rust:ci
|
2021-03-29 16:55:50 +00:00
|
|
|
|
resource_class: xlarge # use of a smaller executor tends crashes on link
|
|
|
|
|
environment:
|
|
|
|
|
# Disable full debug symbol generation to speed up CI build
|
|
|
|
|
# "1" means line tables only, which is useful for panic tracebacks.
|
|
|
|
|
RUSTFLAGS: "-C debuginfo=1"
|
2020-02-07 15:39:31 +00:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
2021-04-20 19:29:14 +00:00
|
|
|
|
- rust_components
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_restore
|
2020-02-07 15:39:31 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Cargo build
|
2020-05-08 14:24:01 +00:00
|
|
|
|
command: cargo build --workspace
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Build benches
|
|
|
|
|
command: cargo test --workspace --benches --no-run
|
|
|
|
|
- cache_save
|
|
|
|
|
|
|
|
|
|
# Lint protobufs.
|
|
|
|
|
protobuf-lint:
|
|
|
|
|
docker:
|
|
|
|
|
- image: bufbuild/buf:0.40.0
|
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
|
|
|
|
- run:
|
|
|
|
|
name: buf lint
|
|
|
|
|
command: buf lint
|
|
|
|
|
|
2021-04-07 20:33:38 +00:00
|
|
|
|
# Check that the generated flatbuffers code is up-to-date with the changes in this PR.
|
|
|
|
|
check-flatbuffers:
|
|
|
|
|
docker:
|
|
|
|
|
- image: quay.io/influxdb/rust:ci
|
|
|
|
|
resource_class: xlarge # use of a smaller executor tends crashes on link
|
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
2021-04-20 19:29:14 +00:00
|
|
|
|
- rust_components # Regenerating flatbuffers uses rustfmt
|
2021-04-07 20:33:38 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Check Flatbuffers
|
2021-04-21 14:32:07 +00:00
|
|
|
|
command: INFLUXDB_IOX_INTEGRATION_LOCAL=1 ./generated_types/check-flatbuffers.sh
|
2021-04-07 20:33:38 +00:00
|
|
|
|
|
2020-11-26 13:38:27 +00:00
|
|
|
|
# Compile a cargo "release" profile binary for branches that end in `/perf`
|
|
|
|
|
#
|
|
|
|
|
# Uses the latest ci_image (influxdb/rust below) to build a release binary and
|
|
|
|
|
# copies it to a minimal container image based upon `rust:slim-buster`. This
|
|
|
|
|
# minimal image is then pushed to `quay.io/influxdb/fusion:${BRANCH}` with '/'
|
|
|
|
|
# repaced by '.' - as an example:
|
|
|
|
|
#
|
2021-03-29 16:55:50 +00:00
|
|
|
|
# git branch: dom/my-awesome-feature/perf
|
2020-11-26 13:38:27 +00:00
|
|
|
|
# container: quay.io/influxdb/fusion:dom.my-awesome-feature.perf
|
|
|
|
|
#
|
|
|
|
|
# Subsequent CI runs will overwrite the tag if you push more changes, so watch
|
|
|
|
|
# out for parallel CI runs!
|
|
|
|
|
#
|
|
|
|
|
# To change the contents of the build container, modify docker/Dockerfile.ci
|
2021-02-25 15:05:54 +00:00
|
|
|
|
# To change the final release container, modify docker/Dockerfile.iox
|
2020-06-29 19:33:41 +00:00
|
|
|
|
perf_image:
|
|
|
|
|
docker:
|
|
|
|
|
- image: quay.io/influxdb/rust:ci
|
2021-03-29 16:55:50 +00:00
|
|
|
|
environment:
|
|
|
|
|
# Disable full debug symbol generation to speed up CI build
|
|
|
|
|
# "1" means line tables only, which is useful for panic tracebacks.
|
|
|
|
|
RUSTFLAGS: "-C debuginfo=1"
|
2020-06-29 19:33:41 +00:00
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
2021-04-20 19:29:14 +00:00
|
|
|
|
- rust_components
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_restore
|
2020-06-29 19:33:41 +00:00
|
|
|
|
- run:
|
2020-07-08 14:02:58 +00:00
|
|
|
|
name: Cargo release build with target arch set for CRoaring
|
|
|
|
|
command: ROARING_ARCH=x86-64 cargo build --release
|
2021-04-26 10:51:33 +00:00
|
|
|
|
- run: |
|
|
|
|
|
echo sha256sum after build is
|
|
|
|
|
sha256sum target/release/influxdb_iox
|
2020-06-29 19:33:41 +00:00
|
|
|
|
- setup_remote_docker:
|
|
|
|
|
docker_layer_caching: true
|
|
|
|
|
- run: |
|
|
|
|
|
sudo apt-get update
|
|
|
|
|
sudo apt-get install -y docker.io
|
|
|
|
|
- run: |
|
|
|
|
|
echo "$QUAY_PASS" | docker login quay.io --username $QUAY_USER --password-stdin
|
|
|
|
|
- run: |
|
|
|
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD | tr '/' '.')
|
2021-04-27 07:34:36 +00:00
|
|
|
|
echo sha256sum after build is
|
|
|
|
|
sha256sum target/release/influxdb_iox
|
2021-02-25 15:05:54 +00:00
|
|
|
|
docker build -t quay.io/influxdb/fusion:$BRANCH -f docker/Dockerfile.iox .
|
2020-07-22 13:32:31 +00:00
|
|
|
|
docker push quay.io/influxdb/fusion:$BRANCH
|
2021-01-18 10:55:19 +00:00
|
|
|
|
echo "export BRANCH=${BRANCH}" >> $BASH_ENV
|
2021-01-14 15:32:16 +00:00
|
|
|
|
- run:
|
|
|
|
|
name: Deploy tags
|
2021-01-18 10:55:19 +00:00
|
|
|
|
command: ./.circleci/get-deploy-tags.sh "${BRANCH}"
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- cache_save
|
2020-02-07 15:39:31 +00:00
|
|
|
|
|
2020-11-26 13:38:27 +00:00
|
|
|
|
# Prepare the CI image used for other tasks.
|
|
|
|
|
#
|
|
|
|
|
# A nightly job (scheduled below in the `workflows` section) to build the CI
|
|
|
|
|
# image (influxdb/rust) used for the rest of the checks.
|
|
|
|
|
#
|
|
|
|
|
# To modify the contents of the CI image, update docker/Dockerfile.ci
|
|
|
|
|
ci_image:
|
|
|
|
|
machine: true
|
|
|
|
|
resource_class: xlarge
|
|
|
|
|
steps:
|
|
|
|
|
- checkout
|
|
|
|
|
- run: |
|
|
|
|
|
echo "$QUAY_PASS" | docker login quay.io --username $QUAY_USER --password-stdin
|
|
|
|
|
- run: |
|
|
|
|
|
COMMIT_SHA=$(git rev-parse --short HEAD)
|
2021-04-20 19:29:14 +00:00
|
|
|
|
docker build -t quay.io/influxdb/rust:$COMMIT_SHA -f docker/Dockerfile.ci --build-arg RUST_VERSION=$(cat rust-toolchain) .
|
2020-11-26 13:38:27 +00:00
|
|
|
|
docker tag quay.io/influxdb/rust:$COMMIT_SHA quay.io/influxdb/rust:ci
|
|
|
|
|
docker push quay.io/influxdb/rust:$COMMIT_SHA
|
|
|
|
|
docker push quay.io/influxdb/rust:ci
|
|
|
|
|
|
2020-02-07 15:39:31 +00:00
|
|
|
|
workflows:
|
|
|
|
|
version: 2
|
2021-03-29 16:55:50 +00:00
|
|
|
|
|
|
|
|
|
# CI for all pull requests.
|
|
|
|
|
ci:
|
|
|
|
|
jobs:
|
|
|
|
|
- fmt
|
|
|
|
|
- lint
|
|
|
|
|
- protobuf-lint
|
|
|
|
|
- test
|
2021-04-05 13:21:32 +00:00
|
|
|
|
- test_influxdb2_client
|
2021-03-29 16:55:50 +00:00
|
|
|
|
- build
|
2021-04-07 20:33:38 +00:00
|
|
|
|
- check-flatbuffers
|
2021-03-29 16:55:50 +00:00
|
|
|
|
|
|
|
|
|
# Internal pipeline for perf builds.
|
2020-11-26 16:46:59 +00:00
|
|
|
|
#
|
|
|
|
|
# Filter ensures this only runs for git branches ending in `/perf`.
|
|
|
|
|
perf_build:
|
2020-02-07 15:39:31 +00:00
|
|
|
|
jobs:
|
2020-11-26 16:46:59 +00:00
|
|
|
|
- fmt:
|
|
|
|
|
filters:
|
|
|
|
|
branches:
|
|
|
|
|
only: /.*\/perf$/
|
|
|
|
|
- lint:
|
|
|
|
|
filters:
|
|
|
|
|
branches:
|
|
|
|
|
only: /.*\/perf$/
|
|
|
|
|
- test:
|
|
|
|
|
filters:
|
|
|
|
|
branches:
|
|
|
|
|
only: /.*\/perf$/
|
|
|
|
|
- build:
|
|
|
|
|
filters:
|
|
|
|
|
branches:
|
|
|
|
|
only: /.*\/perf$/
|
2020-06-29 19:33:41 +00:00
|
|
|
|
- perf_image:
|
2020-11-26 16:46:59 +00:00
|
|
|
|
filters:
|
|
|
|
|
branches:
|
|
|
|
|
only: /.*\/perf$/
|
2020-06-29 19:33:41 +00:00
|
|
|
|
requires: # Only do a release build if all tests have passed
|
|
|
|
|
- fmt
|
|
|
|
|
- lint
|
|
|
|
|
- test
|
|
|
|
|
- build
|
2021-03-29 16:55:50 +00:00
|
|
|
|
|
2020-11-26 16:46:59 +00:00
|
|
|
|
# Nightly rebuild of the build container
|
2020-05-28 01:25:57 +00:00
|
|
|
|
ci_image:
|
|
|
|
|
triggers:
|
|
|
|
|
- schedule:
|
|
|
|
|
cron: "0 5 * * *"
|
|
|
|
|
filters:
|
|
|
|
|
branches:
|
|
|
|
|
only:
|
2020-11-11 11:40:38 +00:00
|
|
|
|
- main
|
2020-05-28 01:25:57 +00:00
|
|
|
|
jobs:
|
|
|
|
|
- ci_image
|