diff --git a/.circleci/config.yml b/.circleci/config.yml index dd529ab933..42de0f513a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,6 +23,7 @@ commands: name: Running Kapacitor Tests no_output_timeout: 30m command: | + mkdir -p /go ./circle-test.sh deploy_nightly: description: > @@ -38,25 +39,40 @@ jobs: docker: - image: nathanielc/docker-client parallelism: 2 + resource_class: large working_directory: ~/kapacitor steps: - checkout - restore_cache: # restores saved cache if no changes are detected since last run keys: - - go-mod-{{ checksum "go.sum" }} + - v0-go-mod-{{ checksum "go.sum" }} + - v0-go-mod - setup_remote_docker: docker_layer_caching: true - run_tests + - save_cache: + key: v0-go-mod-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" release: docker: - image: nathanielc/docker-client working_directory: ~/kapacitor + resource_class: large steps: - checkout + - restore_cache: # restores saved cache if no changes are detected since last run + keys: + - v0-go-mod-{{ checksum "go.sum" }} + - v0-go-mod- - setup_remote_docker: docker_layer_caching: true - deploy_release_packages + - save_cache: + key: v0-go-mod-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" nightly-build: docker: @@ -64,9 +80,17 @@ jobs: working_directory: ~/kapacitor steps: - checkout + - restore_cache: # restores saved cache if no changes are detected since last run + keys: + - v0-go-mod-{{ checksum "go.sum" }} + - v0-go-mod - setup_remote_docker: docker_layer_caching: true - run_tests + - save_cache: + key: v0-go-mod-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" - deploy_nightly @@ -96,4 +120,4 @@ workflows: only: - master jobs: - - nightly-build + - nightly-build \ No newline at end of file diff --git a/Dockerfile_build_ubuntu64 b/Dockerfile_build_ubuntu64 index ba0ed8a1a5..8626db9cdb 100644 --- a/Dockerfile_build_ubuntu64 +++ b/Dockerfile_build_ubuntu64 @@ -36,7 +36,7 @@ RUN gem install fpm # Install protobuf3 protoc binary ENV PROTO_VERSION 3.11.1 RUN wget -q https://github.com/google/protobuf/releases/download/v${PROTO_VERSION}/protoc-${PROTO_VERSION}-linux-x86_64.zip \ - && unzip -j protoc-${PROTO_VERSION}-linux-x86_64.zip bin/protoc -d /bin \ + && unzip -oj protoc-${PROTO_VERSION}-linux-x86_64.zip bin/protoc -d /bin \ rm protoc-${PROTO_VERSION}-linux-x86_64.zip # Install protobuf3 python library diff --git a/build.sh b/build.sh index 467c58ca51..4b1fecf254 100755 --- a/build.sh +++ b/build.sh @@ -23,24 +23,42 @@ docker build -f Dockerfile_build_ubuntu64 -t $imagename --build-arg GO_VERSION=$ # Build new docker image docker build -f Dockerfile_build_ubuntu64 -t influxdata/kapacitor-builder --build-arg GO_VERSION=${GO_VERSION} $DIR -# Create data volume with code docker create \ - --name $dataname \ - -v "/go/src/github.com/influxdata/kapacitor" \ - $imagename /bin/true + --name $dataname \ + -v "/go/src/github.com/influxdata/kapacitor" \ + $imagename /bin/true docker cp "$DIR/" "$dataname:/go/src/github.com/influxdata/" echo "Running build.py" -# Run docker -docker run \ +if [ $GOPATH ];then + docker run \ + --rm \ + -v "$GOPATH"/pkg/mod:/go/pkg/mod + --volumes-from $dataname \ + -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \ + -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \ + $imagename \ + "$@" +elif [ -d "/go/pkg/mod" ];then + docker run \ --rm \ + -v "/go/pkg/mod:/go/pkg/mod" --volumes-from $dataname \ -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \ -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \ $imagename \ "$@" +else + docker run \ + --rm \ + --volumes-from $dataname \ + -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \ + -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \ + $imagename \ + "$@" +fi +# Run docker -docker cp "$dataname:/go/src/github.com/influxdata/kapacitor/build" \ - ./ +docker cp "$dataname:/go/src/github.com/influxdata/kapacitor/build" ./ docker rm -v $dataname diff --git a/gobuild.sh b/gobuild.sh deleted file mode 100755 index 9a96e7e9b7..0000000000 --- a/gobuild.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# This script run inside the Dockerfile_build_ubuntu64_git container and -# gets the latests Go source code and compiles it. -# Then passes control over to the normal build.py script - -set -e - -cd /go/src -git fetch --all -git checkout $GO_CHECKOUT -# Merge in recent changes if we are on a branch -# if we checked out a tag just ignore the error -git pull || true -./make.bash - -# Run normal build.py -cd "$PROJECT_DIR" -exec ./build.py "$@"