build: rewrite our CI/CD pipeline to make ARM64 docker build work (#20484)

pull/19811/head
Daniel Moran 2021-01-11 15:01:09 -08:00 committed by GitHub
parent c28b5f94e7
commit 9493afb46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 219 additions and 459 deletions

View File

@ -34,15 +34,13 @@ workflows:
- grace_daily:
requires:
- build
filters:
branches:
only: /^(?!pull\/).*$/
- litmus_daily:
requires:
- build
filters:
branches:
only: /^(?!pull\/).*$/
only:
- /^(?!pull\/).*$/
- cross_build:
requires:
- build
@ -52,7 +50,7 @@ workflows:
- master
- litmus_integration:
requires:
- litmus_daily
- build
filters:
branches:
only:
@ -125,86 +123,148 @@ workflows:
requires:
- deploy_nightly
release:
jobs:
- godeps:
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
- jsdeps:
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
- gotest:
requires:
- godeps
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
- golint:
requires:
- godeps
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
- jstest:
requires:
- jsdeps
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
- jslint:
requires:
- jsdeps
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
- influxql_validation:
requires:
- godeps
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
- influxql_integration:
requires:
- godeps
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
- release:
requires:
- gotest
- golint
- jstest
- jslint
- influxql_validation
- influxql_integration
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$/
orbs:
# Needed to install chrome for e2e testing.
browser-tools: circleci/browser-tools@1.1
commands:
# Install system dependencies needed to run a native build of influxd
install_core_deps:
steps:
- run:
name: Install system dependencies
command: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
bzr \
clang \
libprotobuf-dev \
pkg-config \
protobuf-compiler
- run:
name: Install Rust toolchain
command: |
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
echo 'export PATH=${HOME}/.cargo/bin:${PATH}' >> $BASH_ENV
# Run goreleaser to cross-build or cross-publish influxd
run_goreleaser:
parameters:
publish_release:
type: boolean
steps:
- run:
name: Set GOPATH
# Machine executors use a different GOPATH from the cimg/go Docker executors.
command: |
echo 'export GOPATH=/home/circleci/go' >> $BASH_ENV
echo 'export PATH=${GOPATH}/bin:${PATH}' >> $BASH_ENV
- run:
name: Install cross-build system dependencies
command: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake \
gnupg \
libssl-dev \
libxml2-dev \
llvm-dev \
lzma-dev \
zlib1g-dev
- run:
name: Import GPG key
command: |
echo -e "$GPG_PRIVATE_KEY" > private.key
gpg --batch --import private.key
- run:
name: Install cross-compilers
environment:
MUSL_VERSION: 1.1.24
MUSL_BUILD_TIME: 20210108172549
MUSL_CROSS_MAKE_VERSION: 0.9.9
MUSL_CROSS_ARM64_BUILD_TIME: 20210108174735
OSXCROSS_VERSION: c2ad5e859d12a295c3f686a15bd7181a165bfa82
OSXCROSS_BUILD_TIME: 20210108174800
command: |
MUSL_ARCHIVE=musl-${MUSL_VERSION}-${MUSL_BUILD_TIME}.tar.gz
curl https://dl.influxdata.com/influxdb-ci/musl/${MUSL_VERSION}/${MUSL_ARCHIVE} -O && \
sudo tar xzf ${MUSL_ARCHIVE} -C /usr/local && \
rm ${MUSL_ARCHIVE}
echo 'export PATH=/usr/local/musl/bin:${PATH}' >> $BASH_ENV
MUSL_CROSS_ARM64_ARCHIVE=musl-${MUSL_VERSION}-cross-aarch64-${MUSL_CROSS_MAKE_VERSION}-${MUSL_CROSS_ARM64_BUILD_TIME}.tar.gz
curl https://dl.influxdata.com/influxdb-ci/musl/${MUSL_VERSION}/musl-cross/${MUSL_CROSS_MAKE_VERSION}/${MUSL_CROSS_ARM64_ARCHIVE} -O && \
sudo tar xzf ${MUSL_CROSS_ARM64_ARCHIVE} -C /usr/local && \
rm ${MUSL_CROSS_ARM64_ARCHIVE}
echo 'export PATH=/usr/local/musl-cross/bin:${PATH}' >> $BASH_ENV
OSXCROSS_ARCHIVE=osxcross-${OSXCROSS_VERSION}-${OSXCROSS_BUILD_TIME}.tar.gz
curl https://dl.influxdata.com/influxdb-ci/osxcross/${OSXCROSS_VERSION}/${OSXCROSS_ARCHIVE} -O && \
sudo tar xzf ${OSXCROSS_ARCHIVE} -C /usr/local && \
rm ${OSXCROSS_ARCHIVE}
echo 'export PATH=/usr/local/osxcross/target/bin:${PATH}' >> $BASH_ENV
mkdir -p ${GOPATH}/bin
cp scripts/ci/xcc.sh ${GOPATH}/bin/xcc
chmod a+x ${GOPATH}/bin/xcc
- run:
name: Install Rust cross-targets
command: |
rustup target add \
x86_64-unknown-linux-musl \
aarch64-unknown-linux-musl \
x86_64-apple-darwin
echo 'export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=/usr/local/musl/bin/musl-gcc' >> $BASH_ENV
echo 'export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/usr/local/musl-cross/bin/aarch64-unknown-linux-musl-gcc' >> $BASH_ENV
echo 'export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=/usr/local/osxcross/target/bin/x86_64-apple-darwin15-clang' >> $BASH_ENV
- run:
name: Install Docker cross-build kit and emulators
environment:
DOCKER_BUILDX_VERSION: 0.5.1
command: |
set -euo pipefail
# Install the QEMU emulators we need to cross-build.
docker run --rm --privileged tonistiigi/binfmt:latest --install arm64
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
mkdir -p ${HOME}/.docker/cli-plugins
curl -sfL -o ${HOME}/.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}/.docker/cli-plugins/docker-buildx
docker buildx install
echo 'export DOCKER_CLI_EXPERIMENTAL=enabled' >> $BASH_ENV
# Create a new buildx context using the freshly-installed emulators.
docker buildx create --name cross-builder --platform linux/amd64,linux/arm64
docker buildx use --default cross-builder
docker buildx inspect --bootstrap
- run:
name: Install goreleaser
environment:
GORELEASER_VERSION: 0.152.0
command: |
curl -sfL -o goreleaser-install https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh && \
sh goreleaser-install -b ${GOPATH}/bin v${GORELEASER_VERSION} && \
rm goreleaser-install
- run:
name: Install pkg-config
command: make pkg-config
- unless:
condition: << parameters.publish_release >>
steps:
- run:
name: Build release
# `goreleaser release --skip-publish` builds Docker images, but doesn't push them.
# As opposed to `goreleaser build`, which stops before building Dockers.
command: goreleaser release --skip-publish -p 1 --rm-dist --skip-validate
- when:
condition: << parameters.publish_release >>
steps:
- run:
name: Publish release
command: goreleaser release -p 1 --rm-dist --skip-validate
jobs:
####################
@ -213,7 +273,7 @@ jobs:
jsdeps:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6-node
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
steps:
- checkout
@ -238,7 +298,7 @@ jobs:
jstest:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6-node
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
steps:
- checkout
@ -267,7 +327,7 @@ jobs:
jslint:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6-node
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
parallelism: 8
steps:
@ -298,8 +358,7 @@ jobs:
godeps:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
resource_class: large
- image: cimg/go:1.15.6
environment:
GOCACHE: /tmp/go-cache
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
@ -321,7 +380,7 @@ jobs:
golint:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6
environment:
GOCACHE: /tmp/go-cache
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
@ -340,6 +399,7 @@ jobs:
echo unexpected go version $gomodversiondiff
exit 1
fi
- install_core_deps
- run: make vet
- run: make checkfmt
- run: make checktidy
@ -349,7 +409,7 @@ jobs:
gotest:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6
resource_class: large
environment:
GOCACHE: /tmp/go-cache
@ -363,12 +423,12 @@ jobs:
keys:
- influxdb-gotest-{{ .Branch }}-{{ .Revision }}
- influxdb-gotest-{{ .Branch }}-
- influxdb-gotest-
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- run: mkdir -p $TEST_RESULTS
- install_core_deps
- run:
name: run parallel race tests
command: |
@ -388,7 +448,7 @@ jobs:
influxql_validation:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6
resource_class: large
environment:
GOCACHE: /tmp/go-cache
@ -401,12 +461,12 @@ jobs:
keys:
- influxdb-iqlvalidation-{{ .Branch }}-{{ .Revision }}
- influxdb-iqlvalidation-{{ .Branch }}-
- influxdb-iqlvalidation-
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- run: mkdir -p $TEST_RESULTS
- install_core_deps
- run: make GO_TEST_CMD="gotestsum --format standard-quiet --junitfile /tmp/test-results/gotestsum.xml --" test-influxql-validation
- save_cache:
name: Save GOCACHE
@ -421,7 +481,7 @@ jobs:
influxql_integration:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6
resource_class: large
environment:
GOCACHE: /tmp/go-cache
@ -434,12 +494,12 @@ jobs:
keys:
- influxdb-iqlintegration-{{ .Branch }}-{{ .Revision }}
- influxdb-iqlintegration-{{ .Branch }}-
- influxdb-iqlintegration-
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- run: mkdir -p $TEST_RESULTS
- install_core_deps
- run: make GO_TEST_CMD="gotestsum --format standard-quiet --junitfile /tmp/test-results/gotestsum.xml --" test-influxql-integration
- save_cache:
name: Save GOCACHE
@ -458,13 +518,13 @@ jobs:
build:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6-node
resource_class: large
environment:
GOCACHE: /tmp/go-cache
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
steps:
- checkout
- run: make checkcommit
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
@ -474,11 +534,11 @@ jobs:
keys:
- influxdb-build-{{ .Branch }}-{{ .Revision }}
- influxdb-build-{{ .Branch }}-
- influxdb-build-
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- install_core_deps
- run: make build
- save_cache:
name: Save GOCACHE
@ -495,8 +555,9 @@ jobs:
- etc/litmus_fail_notify.sh
cross_build:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
machine:
image: ubuntu-2004:202010-01
resource_class: large
environment:
GOCACHE: /tmp/go-cache
steps:
@ -512,17 +573,16 @@ jobs:
- 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
- install_core_deps
- run_goreleaser:
publish_release: false
- save_cache:
name: Save GOCACHE
key: influxdb-cross-build-{{ .Branch }}-{{ .Revision }}
@ -530,8 +590,9 @@ jobs:
- /tmp/go-cache
deploy_nightly:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
machine:
image: ubuntu-2004:202010-01
resource_class: large
environment:
GOCACHE: /tmp/go-cache
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
@ -545,22 +606,21 @@ jobs:
name: Restore GOCACHE
keys:
- influxdb-nightly-{{ .Branch }}-{{ .Revision }}
- influxdb-cross-build-{{ .Branch }}-{{ .Revision }}
- influxdb-nightly-{{ .Branch }}-
- influxdb-cross-build-{{ .Branch }}-
- influxdb-build-{{ .Branch }}-{{ .Revision }}
- influxdb-build-{{ .Branch }}-
- influxdb-nightly-
- 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:
name: Build nightly
command: make nightly
- install_core_deps
- run_goreleaser:
publish_release: true
- save_cache:
name: Save GOCACHE
key: influxdb-nightly-{{ .Branch }}-{{ .Revision }}
@ -572,56 +632,13 @@ jobs:
- etc/litmus_success_notify.sh
- etc/litmus_fail_notify.sh
release:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
environment:
GOCACHE: /tmp/go-cache
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
steps:
- checkout
- restore_cache:
name: Restore GOPATH/pkg/mod
keys:
- influxdb-gomod-sum-{{ checksum "go.sum" }}
- restore_cache:
name: Restore GOCACHE
keys:
- influxdb-release-{{ .Branch }}-{{ .Revision }}
- influxdb-release-{{ .Branch }}-
- influxdb-build-{{ .Branch }}-{{ .Revision }}
- influxdb-build-{{ .Branch }}-
- influxdb-release-
- 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:
name: import GPG key
command: |
echo -e "$GPG_PRIVATE_KEY" > private.key
gpg --batch --import private.key
- run:
name: Build release
command: make release
- save_cache:
name: Save GOCACHE
key: influxdb-release-{{ .Branch }}-{{ .Revision }}
paths:
- /tmp/go-cache
#################################
### e2e/integration test jobs ###
#################################
e2e:
docker:
- image: quay.io/influxdb/influxdb-circleci:latest
- image: cimg/go:1.15.6-browsers
environment:
GOCACHE: /tmp/go-cache
working_directory: /home/circleci/go/src/github.com/influxdata/influxdb
@ -634,6 +651,7 @@ jobs:
name: Restore Yarn Cache
keys:
- yarn-deps-lock-{{ checksum "ui/yarn.lock" }}
- run: sudo apt-get update && sudo apt-get install netcat-openbsd
- run:
command: ./bin/linux/influxd --store=memory --e2e-testing=true --feature-flags=communityTemplates=true
background: true

View File

@ -1,143 +0,0 @@
project_name: influxdb2
builds:
- id: influx
goos:
- linux
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: darwin
goarch: arm64
main: ./cmd/influx/
flags:
- -tags={{if eq .Os "linux"}}osusergo,netgo,static_build{{if not (eq .Arch "amd64")}},noasm{{end}}{{end}}
env:
- GO111MODULE=on
- CGO_ENABLED=1
- CC=xcc
- PKG_CONFIG=$GOPATH/bin/pkg-config
- MACOSX_DEPLOYMENT_TARGET=10.11
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if eq .Os "linux"}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}}
binary: influx
- id: influxd
goos:
- linux
- darwin
goarch:
- amd64
- arm64
ignore:
- goos: darwin
goarch: arm64
main: ./cmd/influxd/
flags:
- -tags=assets{{if eq .Os "linux"}},osusergo,netgo,static_build{{if not (eq .Arch "amd64")}},noasm{{end}}{{end}}
env:
- GO111MODULE=on
- CGO_ENABLED=1
- CC=xcc
- PKG_CONFIG=$GOPATH/bin/pkg-config
- MACOSX_DEPLOYMENT_TARGET=10.11
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if eq .Os "linux"}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}}
binary: influxd
hooks:
pre: make generate
nfpms:
- id: "influxdb2"
builds: ["influx", "influxd"]
formats:
- deb
- rpm
bindir: /usr/bin
contents:
- src: scripts/init.sh
dst: /usr/lib/influxdb/scripts/init.sh
- src: scripts/influxdb.service
dst: /usr/lib/influxdb/scripts/influxdb.service
- src: scripts/logrotate
dst: /etc/logrotate.d/influxdb
- src: scripts/influxdb2-upgrade.sh
dst: /usr/share/influxdb/influxdb2-upgrade.sh
scripts:
preinstall: "scripts/pre-install.sh"
postinstall: "scripts/post-install.sh"
postremove: "scripts/post-uninstall.sh"
conflicts:
- influxdb
overrides:
rpm:
replacements:
amd64: x86_64
file_name_template: "influxdb2-nightly.{{ .Arch }}"
deb:
file_name_template: "influxdb2_nightly_{{ .Arch }}"
vendor: InfluxData
homepage: https://influxdata.com
maintainer: support@influxdb.com
description: Distributed time-series database.
license: MIT
archives:
- format: tar.gz
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
name_template: "influxdb2_nightly_{{ .Os }}_{{ .Arch }}"
files:
- LICENSE
- README.md
blobs:
- provider: "s3"
bucket: "dl.influxdata.com"
region: "us-east-1"
folder: "platform/nightlies/"
checksum:
name_template: "influxdb2_nightly.sha256"
algorithm: sha256
dockers:
- goos: linux
goarch: amd64
binaries:
- influxd
- influx
image_templates:
- "quay.io/influxdb/influxdb-amd64:nightly"
dockerfile: docker/influxd/Dockerfile
extra_files:
- docker/influxd/entrypoint.sh
build_flag_templates:
- "--platform=linux/amd64"
use_buildx: true
- goos: linux
goarch: arm64
binaries:
- influxd
- influx
image_templates:
- "quay.io/influxdb/influxdb-arm64v8:nightly"
dockerfile: docker/influxd/Dockerfile
extra_files:
- docker/influxd/entrypoint.sh
build_flag_templates:
- "--platform=linux/arm64/v8"
use_buildx: true
docker_manifests:
- name_template: "quay.io/influxdb/influxdb:nightly"
image_templates:
- "quay.io/influxdb/influxdb-amd64:nightly"
- "quay.io/influxdb/influxdb-arm64v8:nightly"
# Do not make github release
release:
disable: true

View File

@ -20,7 +20,7 @@ builds:
- PKG_CONFIG=$GOPATH/bin/pkg-config
- MACOSX_DEPLOYMENT_TARGET=10.11
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if eq .Os "linux"}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}}
- -s -w -X main.version=nightly -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if eq .Os "linux"}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}}
binary: influx
- id: influxd
@ -43,7 +43,7 @@ builds:
- PKG_CONFIG=$GOPATH/bin/pkg-config
- MACOSX_DEPLOYMENT_TARGET=10.11
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if eq .Os "linux"}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}}
- -s -w -X main.version=nightly -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if eq .Os "linux"}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}}
binary: influxd
hooks:
pre: make generate
@ -74,9 +74,9 @@ nfpms:
rpm:
replacements:
amd64: x86_64
file_name_template: "influxdb2-{{ .Version }}.{{ .Arch }}"
file_name_template: "influxdb2-nightly.{{ .Arch }}"
deb:
file_name_template: "influxdb2_{{ .Version }}_{{ .Arch }}"
file_name_template: "influxdb2_nightly_{{ .Arch }}"
vendor: InfluxData
homepage: https://influxdata.com
maintainer: support@influxdb.com
@ -84,24 +84,18 @@ nfpms:
license: MIT
archives:
- id: influxdb2_client
- id: influx_only
builds: ["influx"]
format: tar.gz
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
name_template: "influxdb2_client_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
name_template: "influxdb2_client_nightly_{{ .Os }}_{{ .Arch }}"
files:
- LICENSE
- README.md
- id: influxdb2_single_binary
- id: influx_and_influxd
format: tar.gz
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
name_template: "influxdb2-{{ .Version }}_{{ .Os }}_{{ .Arch }}"
name_template: "influxdb2_nightly_{{ .Os }}_{{ .Arch }}"
files:
- LICENSE
- README.md
@ -110,10 +104,10 @@ blobs:
- provider: "s3"
bucket: "dl.influxdata.com"
region: "us-east-1"
folder: "influxdb/releases/"
folder: "platform/nightlies/"
checksum:
name_template: "influxdb2_{{ .Version }}.sha256"
name_template: "influxdb2_nightly.sha256"
algorithm: sha256
dockers:
@ -123,7 +117,7 @@ dockers:
- influxd
- influx
image_templates:
- "quay.io/influxdb/influxdb-amd64:{{ .Tag }}"
- "quay.io/influxdb/influxdb-amd64:nightly"
dockerfile: docker/influxd/Dockerfile
extra_files:
- docker/influxd/entrypoint.sh
@ -136,7 +130,7 @@ dockers:
- influxd
- influx
image_templates:
- "quay.io/influxdb/influxdb-arm64v8:{{ .Tag }}"
- "quay.io/influxdb/influxdb-arm64v8:nightly"
dockerfile: docker/influxd/Dockerfile
extra_files:
- docker/influxd/entrypoint.sh
@ -145,10 +139,10 @@ dockers:
use_buildx: true
docker_manifests:
- name_template: "quay.io/influxdb/influxdb:{{ .Tag }}"
- name_template: "quay.io/influxdb/influxdb:nightly"
image_templates:
- "quay.io/influxdb/influxdb-amd64:{{ .Tag }}"
- "quay.io/influxdb/influxdb-arm64v8:{{ .Tag }}"
- "quay.io/influxdb/influxdb-amd64:nightly"
- "quay.io/influxdb/influxdb-arm64v8:nightly"
signs:
- signature: "${artifact}.asc"
@ -158,7 +152,4 @@ signs:
# Do not make github release
release:
name_template: "v{{.Version}}"
prerelease: auto # when we go to GA remove this line
draft: false # This needs to be false, or the container image will not be published
disable: true # we keep the artifacts in S3 and link from the website
disable: true

View File

@ -143,9 +143,6 @@ checktidy:
checkgenerate:
./etc/checkgenerate.sh
checkcommit:
# ./etc/circle-detect-committed-binaries.sh
generate: $(SUBDIRS)
test-js: node_modules
@ -180,18 +177,6 @@ build: all
pkg-config:
go build -o $(GOPATH)/bin/pkg-config github.com/influxdata/pkg-config
# Parallelism for goreleaser must be set to 1 so it doesn't
# attempt to invoke pkg-config, which invokes cargo,
# for multiple targets at the same time.
dist: pkg-config
goreleaser build -p 1 --skip-validate --rm-dist
release: pkg-config
goreleaser release -p 1 --rm-dist
nightly: pkg-config
goreleaser release -p 1 --skip-validate --rm-dist --config=.goreleaser-nightly.yml
clean:
@for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
$(RM) -r bin

View File

@ -1,92 +0,0 @@
FROM cimg/go:1.15.6-browsers
WORKDIR /tmp
# Install libc and cross-compilers for our target platforms.
ENV MUSL_VERSION=1.1.24
ENV MUSL_BUILD_TIME="20210105214054"
ENV MUSL_CROSS_MAKE_VERSION=0.9.9
ENV MUSL_CROSS_ARM64_BUILD_TIME="20210105204119"
ENV OSXCROSS_VERSION=c2ad5e859d12a295c3f686a15bd7181a165bfa82
ENV OSXCROSS_BUILD_TIME="20210105214145"
RUN sudo apt-get update && \
sudo apt-get install -y --no-install-recommends \
clang \
cmake \
libssl-dev \
libxml2-dev \
llvm-dev \
lzma-dev \
zlib1g-dev && \
sudo rm -rf /var/lib/apt/lists/*
# AMD64 musl
# Archive is built using `./xcc-builds/build-amd64-musl-gcc.sh`
ENV MUSL_ARCHIVE=musl-${MUSL_VERSION}-${MUSL_BUILD_TIME}.tar.gz
RUN curl https://dl.influxdata.com/influxdb-ci/musl/${MUSL_VERSION}/${MUSL_ARCHIVE} -O && \
sudo tar xzf ${MUSL_ARCHIVE} -C /usr/local && \
rm ${MUSL_ARCHIVE}
ENV PATH=/usr/local/musl/bin:${PATH}
# ARM64 musl
# Archive is built using `./xcc-builds/build-aarch64-musl-gcc.sh`
ENV MUSL_CROSS_ARM64_ARCHIVE=musl-${MUSL_VERSION}-cross-aarch64-${MUSL_CROSS_MAKE_VERSION}-${MUSL_CROSS_ARM64_BUILD_TIME}.tar.gz
RUN curl https://dl.influxdata.com/influxdb-ci/musl/${MUSL_VERSION}/musl-cross/${MUSL_CROSS_MAKE_VERSION}/${MUSL_CROSS_ARM64_ARCHIVE} -O && \
sudo tar xzf ${MUSL_CROSS_ARM64_ARCHIVE} -C /usr/local && \
rm ${MUSL_CROSS_ARM64_ARCHIVE}
ENV PATH=/usr/local/musl-cross/bin:${PATH}
# macOS clang.
# Archive is built using `./xcc-builds/build-osxcross-clang.sh`
ENV OSXCROSS_ARCHIVE=osxcross-${OSXCROSS_VERSION}-${OSXCROSS_BUILD_TIME}.tar.gz
RUN curl https://dl.influxdata.com/influxdb-ci/osxcross/${OSXCROSS_VERSION}/${OSXCROSS_ARCHIVE} -O && \
sudo tar xzf ${OSXCROSS_ARCHIVE} -C /usr/local && \
rm ${OSXCROSS_ARCHIVE}
ENV PATH=/usr/local/osxcross/target/bin:${PATH}
# Install the rust compiler.
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
ENV PATH=/home/circleci/.cargo/bin:${PATH}
# Install rust toolchains for cross-building.
RUN rustup target add \
x86_64-unknown-linux-musl \
aarch64-unknown-linux-musl \
x86_64-apple-darwin
# Configure linkers for new targets.
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
# 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 && \
sh goreleaser-install ${GORELEASER_VERSION} && \
rm goreleaser-install
# Install our cross-compiler.
COPY --chown=circleci:circleci ./xcc.sh $GOPATH/bin/xcc
RUN chmod a+x $GOPATH/bin/xcc
# Install build and test dependencies.
RUN sudo apt-get update && \
sudo apt-get install -y --no-install-recommends \
bzr \
libprotobuf-dev \
netcat-openbsd \
pkg-config \
protobuf-compiler && \
sudo rm -rf /var/lib/apt/lists/*

View File

@ -1,12 +0,0 @@
# CI Image
This Docker image is used to run all jobs in Circle CI. It includes all the test infrastructure needed
for unit and e2e tests, along with cross-compilers used to release InfluxDB for various architectures.
## Rebuilding the image
We haven't automated building the image on git-push (yet). For now, run the following from within this
directory whenever a change needs to be pushed:
```bash
VERSION=${VERSION:-latest} # Set some other version if you want
docker build -t quay.io/influxdb/influxdb-circleci:${VERSION} .
docker push quay.io/influxdb/influxdb-circleci:${VERSION}
```

View File

@ -1,6 +1,6 @@
# Cross-compiler Builds
The scripts in this directory are used to build cross-compilers for InfluxDB from source.
We build & cache these artifacts separately to speed up rebuilds of our CI [`Docker image`](../Dockerfile).
We build & cache these artifacts separately to speed up cross-builds in CI.
## Building archives
The build scripts are stand-alone, any required variables are defined as constants within
@ -17,7 +17,4 @@ After building a new archive, follow these steps to add it to our CI image:
* Cross-compilers for `musl-gcc` (i.e. ARM64) are hosted under `musl/<musl-version>/musl-cross/<musl-cross-make-version>/`
* Cross-compilers for macOS `clang` are hosted under `osxcross/<osxcross-hash>/`
4. Use the S3 console to upload the `.tar.gz` archive into the directory.
5. Update our CI `Dockerfile` to point at the new archive
* If bumping to a new build of an existing cross-compiler, update the appropriate `ENV` definitions for the software version(s) and build time
* If adding a new cross-compiler, add `ENV` definitions for the software version(s) and build time, and a `RUN` command to download & extract
the new archive
5. Update our CircleCI config to point at the new archive.

View File

@ -4,7 +4,7 @@ set -euo pipefail
declare -r SCRIPT_DIR=$(cd $(dirname ${0}) >/dev/null 2>&1 && pwd)
declare -r OUT_DIR=${SCRIPT_DIR}/out
declare -r BUILD_IMAGE=circleci/golang:1.15-node-browsers
declare -r BUILD_IMAGE=ubuntu:20.04
declare -r MUSL_VERSION=1.1.24
declare -r MUSL_CROSS_MAKE_VERSION=0.9.9
@ -12,15 +12,22 @@ docker run --rm -i -v ${OUT_DIR}:/out -w /tmp ${BUILD_IMAGE} bash <<EOF
set -euo pipefail
declare -r BUILD_TIME=\$(date -u '+%Y%m%d%H%M%S')
export DEBIAN_FRONTEND=noninteractive
# Install dependencies.
sudo apt-get update && sudo apt-get install -y --no-install-recommends patch
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
make \
patch
# Clone and build musl-cross-make's ARM64 target.
git clone https://github.com/richfelker/musl-cross-make.git && \
cd musl-cross-make && \
git checkout v${MUSL_CROSS_MAKE_VERSION} && \
make MUSL_VER=${MUSL_VERSION} TARGET=aarch64-unknown-linux-musl install && \
make MUSL_VER=${MUSL_VERSION} TARGET=aarch64-unknown-linux-musl DL_CMD="curl -C - -L -o" install && \
mv output /tmp/musl-cross && \
cd /tmp

View File

@ -4,7 +4,7 @@ set -euo pipefail
declare -r SCRIPT_DIR=$(cd $(dirname ${0}) >/dev/null 2>&1 && pwd)
declare -r OUT_DIR=${SCRIPT_DIR}/out
declare -r BUILD_IMAGE=circleci/golang:1.15-node-browsers
declare -r BUILD_IMAGE=ubuntu:20.04
declare -r MUSL_VERSION=1.1.24
docker run --rm -i -v ${OUT_DIR}:/out -w /tmp ${BUILD_IMAGE} bash <<EOF
@ -13,7 +13,11 @@ docker run --rm -i -v ${OUT_DIR}:/out -w /tmp ${BUILD_IMAGE} bash <<EOF
declare -r BUILD_TIME=\$(date -u '+%Y%m%d%H%M%S')
# Install dependencies.
sudo apt-get update && sudo apt-get install -y --no-install-recommends patch
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
patch
# Build MUSL from source.
curl https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz -O && \
@ -21,7 +25,7 @@ docker run --rm -i -v ${OUT_DIR}:/out -w /tmp ${BUILD_IMAGE} bash <<EOF
cd musl-${MUSL_VERSION} &&
./configure &&
make && \
sudo make install && \
make install && \
cd /tmp
# Archive the build output.

View File

@ -4,18 +4,23 @@ set -euo pipefail
declare -r SCRIPT_DIR=$(cd $(dirname ${0}) >/dev/null 2>&1 && pwd)
declare -r OUT_DIR=${SCRIPT_DIR}/out
declare -r BUILD_IMAGE=circleci/golang:1.15-node-browsers
declare -r BUILD_IMAGE=ubuntu:20.04
declare -r OSXCROSS_VERSION=c2ad5e859d12a295c3f686a15bd7181a165bfa82
docker run --rm -i -v ${OUT_DIR}:/out -w /tmp ${BUILD_IMAGE} bash <<EOF
set -euo pipefail
declare -r BUILD_TIME=\$(date -u '+%Y%m%d%H%M%S')
export DEBIAN_FRONTEND=noninteractive
# Install dependencies.
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
clang \
cmake \
curl \
git \
libssl-dev \
libxml2-dev \
llvm-dev \
@ -24,12 +29,12 @@ docker run --rm -i -v ${OUT_DIR}:/out -w /tmp ${BUILD_IMAGE} bash <<EOF
zlib1g-dev
# Clone and build osxcross.
sudo git clone https://github.com/tpoechtrager/osxcross.git /usr/local/osxcross && \
git clone https://github.com/tpoechtrager/osxcross.git /usr/local/osxcross && \
cd /usr/local/osxcross && \
sudo git checkout ${OSXCROSS_VERSION} && \
sudo curl -L -o ./tarballs/MacOSX10.11.sdk.tar.xz https://macos-sdks.s3.amazonaws.com/MacOSX10.11.sdk.tar.xz && \
sudo UNATTENDED=1 PORTABLE=true OCDEBUG=1 ./build.sh && \
sudo rm -rf .git build tarballs && \
git checkout ${OSXCROSS_VERSION} && \
curl -L -o ./tarballs/MacOSX10.11.sdk.tar.xz https://macos-sdks.s3.amazonaws.com/MacOSX10.11.sdk.tar.xz && \
UNATTENDED=1 PORTABLE=true OCDEBUG=1 ./build.sh && \
rm -rf .git build tarballs && \
cd /tmp
# Archive the build output.