Skip to content

Commit

Permalink
build: add some caching and fix broken nightlies
Browse files Browse the repository at this point in the history
  • Loading branch information
docmerlin committed Aug 10, 2021
1 parent bc6c673 commit 3fdd61f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 29 deletions.
28 changes: 26 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ commands:
name: Running Kapacitor Tests
no_output_timeout: 30m
command: |
mkdir -p /go
./circle-test.sh
deploy_nightly:
description: >
Expand All @@ -38,35 +39,58 @@ 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:
- image: nathanielc/docker-client
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


Expand Down Expand Up @@ -96,4 +120,4 @@ workflows:
only:
- master
jobs:
- nightly-build
- nightly-build
2 changes: 1 addition & 1 deletion Dockerfile_build_ubuntu64
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 26 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 0 additions & 18 deletions gobuild.sh

This file was deleted.

0 comments on commit 3fdd61f

Please sign in to comment.