chore: Improve circle automation structure in prep for moving out of Jenkins (#21132)
* chore: Add workflow structure and pre-release actions to circle config * chore: Update dockerfiles to use latest ubuntu LTS and python3 packagespull/21156/head
parent
31d4d742e8
commit
56e91faf31
|
@ -1,14 +1,138 @@
|
|||
version: 2
|
||||
version: 2.1
|
||||
orbs:
|
||||
aws-s3: circleci/aws-s3@2.0.0
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- build
|
||||
- fluxtest
|
||||
commands:
|
||||
source-vars:
|
||||
description: source the environment variables from the temp workspace
|
||||
steps:
|
||||
- run: |
|
||||
set -x
|
||||
cat /tmp/workspace/env_vars.sh >> $BASH_ENV
|
||||
source $BASH_ENV
|
||||
|
||||
jobs:
|
||||
build:
|
||||
export_vars:
|
||||
machine:
|
||||
enabled: true
|
||||
docker_layer_caching: true
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Export environment variables to bash environment
|
||||
command: |
|
||||
set -x
|
||||
go_ver=$(grep -r '^go ' go.mod | cut -d ' ' -f2)
|
||||
test -n "$go_ver"
|
||||
working_dir=/home/circleci/project
|
||||
touch env_vars.sh
|
||||
echo "export WORKING_DIR=$working_dir" >> env_vars.sh
|
||||
echo "export GO_VERSION=$go_ver" >> env_vars.sh
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- env_vars.sh
|
||||
build_binaries:
|
||||
machine:
|
||||
enabled: true
|
||||
docker_layer_caching: true
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: /tmp/workspace
|
||||
- source-vars
|
||||
- checkout
|
||||
- run:
|
||||
name: Build source tarballs
|
||||
command: |
|
||||
set -x
|
||||
mkdir -p ${WORKING_DIR}/tarball
|
||||
"${WORKING_DIR}/releng/source-tarball/build.bash" \
|
||||
-p "${WORKING_DIR}/.git" \
|
||||
-s "${CIRCLE_SHA1}" \
|
||||
-b "${CIRCLE_BRANCH}" \
|
||||
-v "${CIRCLE_BRANCH}-${CIRCLE_SHA1}" \
|
||||
-o "${WORKING_DIR}/tarball"
|
||||
- store_artifacts:
|
||||
path: tarball/
|
||||
- run:
|
||||
name: Build binaries
|
||||
command: |
|
||||
OUTDIR=${WORKING_DIR}/bins
|
||||
mkdir -p ${OUTDIR}
|
||||
GOOS=linux GOARCH=amd64 "${WORKING_DIR}/releng/raw-binaries/build.bash" \
|
||||
-i "${WORKING_DIR}/tarball/influxdb-src-${CIRCLE_SHA1}.tar.gz" \
|
||||
-o "$OUTDIR"
|
||||
- store_artifacts:
|
||||
path: bins/
|
||||
- run:
|
||||
name: Build packages
|
||||
command: |
|
||||
OUTDIR=${WORKING_DIR}/oss-packages
|
||||
BINDIR=${WORKING_DIR}/bins
|
||||
mkdir -p ${OUTDIR}
|
||||
mkdir -p ${BINDIR}
|
||||
"${WORKING_DIR}/releng/packages/build.bash" \
|
||||
-s "${WORKING_DIR}/tarball/influxdb-src-${CIRCLE_SHA1}.tar.gz" \
|
||||
-b "${BINDIR}/influxdb_bin_linux_amd64-${CIRCLE_SHA1}.tar.gz" \
|
||||
-O linux -A amd64 \
|
||||
-o "$OUTDIR"
|
||||
- store_artifacts:
|
||||
path: oss-packages/
|
||||
- when:
|
||||
condition:
|
||||
and:
|
||||
- equal: [ master-1.x, << pipeline.git.branch >> ]
|
||||
- << pipeline.git.tag >>
|
||||
steps:
|
||||
- aws-s3/copy:
|
||||
arguments: |
|
||||
--aws-region us-east-1
|
||||
from: 'tarball'
|
||||
to: 's3://dl.influxdata.com/influxdb/releases'
|
||||
- aws-s3/copy:
|
||||
arguments: |
|
||||
--aws-region us-east-1
|
||||
from: 'bins'
|
||||
to: 's3://dl.influxdata.com/influxdb/releases'
|
||||
- aws-s3/copy:
|
||||
arguments: |
|
||||
--aws-region us-east-1
|
||||
from: 'oss-packages'
|
||||
to: 's3://dl.influxdata.com/influxdb/releases'
|
||||
changelog:
|
||||
docker:
|
||||
- image: jsternberg/changelog:latest
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: changelog-magic
|
||||
command: |
|
||||
set -ex
|
||||
if [ -n << pipeline.git.base_revision >> ]; then
|
||||
sh "git changelog << pipeline.git.base_revision >>"
|
||||
else
|
||||
sh "git changelog"
|
||||
fi
|
||||
|
||||
if ! git diff --quiet; then
|
||||
git config remote.origin.pushurl git@github.com:influxdata/influxdb.git
|
||||
git commit -am 'Update changelog'
|
||||
git push origin HEAD:${CIRCLE_BRANCH}
|
||||
fi
|
||||
oss_release_candidate:
|
||||
machine:
|
||||
enabled: true
|
||||
docker_layer_caching: true
|
||||
#parallelism: 3 # How many CircleCI test containers
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Check OSS release candidacy
|
||||
command: |
|
||||
echo "TODO: Run checks to determine if this build is a release candidate"
|
||||
ls ./
|
||||
no_output_timeout: 1500s
|
||||
test:
|
||||
machine:
|
||||
enabled: true
|
||||
docker_layer_caching: true
|
||||
|
@ -16,6 +140,9 @@ jobs:
|
|||
- PARALLELISM: 4 # Amount of parallelism within each test (not the number of tests)
|
||||
parallelism: 3 # How many CircleCI test containers
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: /tmp/workspace
|
||||
- source-vars
|
||||
- checkout
|
||||
- run:
|
||||
name: Ensure CircleCI parallelism matches "./test.sh count"
|
||||
|
@ -34,3 +161,47 @@ jobs:
|
|||
name: Execute test
|
||||
command: ./test.sh flux
|
||||
no_output_timeout: 1500s
|
||||
|
||||
workflows:
|
||||
version: 2.1
|
||||
on_push:
|
||||
jobs:
|
||||
- export_vars
|
||||
- changelog:
|
||||
filters:
|
||||
branches:
|
||||
only: /^1(.\d+)*$/
|
||||
- test:
|
||||
requires:
|
||||
- export_vars
|
||||
- fluxtest:
|
||||
requires:
|
||||
- export_vars
|
||||
daily:
|
||||
triggers:
|
||||
- schedule:
|
||||
# run weekdays at 4am -- note: use spaces, not tabs
|
||||
cron: "0 4 * * 1-5"
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- "master-1.x"
|
||||
- "1.8"
|
||||
jobs:
|
||||
- export_vars
|
||||
- changelog:
|
||||
filters:
|
||||
branches:
|
||||
only: /^1(.\d+)*$/
|
||||
- test:
|
||||
requires:
|
||||
- export_vars
|
||||
- fluxtest:
|
||||
requires:
|
||||
- export_vars
|
||||
- build_binaries:
|
||||
requires:
|
||||
- test
|
||||
- oss_release_candidate:
|
||||
requires:
|
||||
- build_binaries
|
||||
|
|
|
@ -13,6 +13,9 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|||
pkg-config \
|
||||
python \
|
||||
python3-pip \
|
||||
python3 \
|
||||
python3-boto \
|
||||
python3-software-properties \
|
||||
rpm \
|
||||
ruby \
|
||||
ruby-dev \
|
||||
|
|
Loading…
Reference in New Issue