diff --git a/.circleci/bash_env.sh b/.circleci/bash_env.sh new file mode 100644 index 0000000000..1ca31b6223 --- /dev/null +++ b/.circleci/bash_env.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export GIT_COMMIT=$(git rev-parse --short HEAD) +export GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true) +export GIT_DESCRIBE=$(git describe --tags --always --match "v*") +export GIT_IMPORT=github.com/hashicorp/consul/version +export GOLDFLAGS="-X ${GIT_IMPORT}.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X ${GIT_IMPORT}.GitDescribe=${GIT_DESCRIBE}" \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index 33f25493ab..23b336dcc8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,6 +21,7 @@ references: GIT_AUTHOR_NAME: circleci-consul GIT_COMMITTER_NAME: circleci-consul S3_ARTIFACT_BUCKET: consul-dev-artifacts + BASH_ENV: .circleci/bash_env.sh jobs: # lint consul tests @@ -140,6 +141,7 @@ jobs: docker: - image: *GOLANG_IMAGE environment: &build-env + <<: *ENVIRONMENT GOXPARALLEL: 2 # CircleCI containers are 2 CPU x 4GB RAM steps: - checkout @@ -167,17 +169,42 @@ jobs: XC_ARCH: "amd64" # build all arm/arm64 architecture supported OS binaries - build-arm-arm64: - <<: *build-distros + build-arm: + docker: + - image: *GOLANG_IMAGE environment: - <<: *build-env - XC_OS: linux - XC_ARCH: "arm arm64" + <<: *ENVIRONMENT + CGO_ENABLED: 1 + GOOS: linux + steps: + - checkout + - run: sudo apt-get update && sudo apt-get install -y gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu + - run: + environment: + GOARM: 5 + CC: arm-linux-gnueabi-gcc + GOARCH: arm + command: go build -o ./pkg/bin/linux_armel/consul -ldflags="${GOLDFLAGS}" + - run: + environment: + GOARM: 6 + CC: arm-linux-gnueabihf-gcc + GOARCH: arm + command: go build -o ./pkg/bin/linux_armhf/consul -ldflags="${GOLDFLAGS}" + - run: + environment: + CC: aarch64-linux-gnu-gcc + GOARCH: arm64 + command: go build -o ./pkg/bin/linux_aarch64/consul -ldflags="${GOLDFLAGS}" + - store_artifacts: + path: ./pkg/bin # create a development build dev-build: docker: - image: *GOLANG_IMAGE + environment: + <<: *ENVIRONMENT steps: - checkout - restore_cache: @@ -493,7 +520,7 @@ workflows: jobs: - build-386 - build-amd64 - - build-arm-arm64 + - build-arm test-integrations: jobs: - dev-build