Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.

Commit f386e5f

Browse files
author
Michael Weber
committed
Add CircleCI configuration
1 parent 0b238b7 commit f386e5f

File tree

4 files changed

+69
-3
lines changed

4 files changed

+69
-3
lines changed

.circleci/config.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: 2
2+
3+
defaultenv: &defaultenv
4+
environment:
5+
SPLUNK_ADDR: https://localhost:8089
6+
SPLUNK_PASSWORD: test1234
7+
SPLUNK_START_ARGS: --accept-license
8+
9+
jobs:
10+
build:
11+
working_directory: /go/src/github.com/splunk/vault-plugin-splunk
12+
docker:
13+
- image: circleci/golang:1.12
14+
<<: *defaultenv
15+
- image: splunk/splunk:latest
16+
user: root
17+
<<: *defaultenv
18+
environment:
19+
- GOCACHE: /tmp/go/cache
20+
steps:
21+
- checkout
22+
23+
- restore_cache:
24+
name: Restoring Cache for vendor
25+
key: gopkg-{{ arch }}-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
26+
paths:
27+
- /go/src/github.com/splunk/vault-plugin-splunk/vendor
28+
- restore_cache:
29+
name: Restoring Cache for build
30+
keys:
31+
- build-cache-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
32+
paths:
33+
- /tmp/go/cache
34+
35+
- run:
36+
name: Build
37+
command: make build DEPFLAGS=-v
38+
- run:
39+
name: Wait for Splunk Container
40+
command: curl -4sSk --retry 40 --retry-connrefused --retry-delay 3 -o /dev/null ${SPLUNK_ADDR}
41+
- run:
42+
name: Test
43+
command: make test TESTREPORT=test-results/go/results.xml
44+
- store_test_results:
45+
path: test-results/
46+
- store_artifacts:
47+
path: test-results/
48+
49+
- save_cache:
50+
name: Saving Cache for vendor
51+
key: gopkg-{{ arch }}-{{ .Branch }}-{{ checksum "Gopkg.lock" }}
52+
paths:
53+
- /go/src/github.com/splunk/vault-plugin-splunk/vendor
54+
- save_cache:
55+
name: Saving Cache for build
56+
key: build-cache-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_BUILD_NUM }}
57+
paths:
58+
- /tmp/go/cache

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@
1717
/vendor/
1818

1919
/vault.hcl
20+
/test-results.xml
21+
/test-results/

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ VERSION := 0.1.0
22
SHORT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo dev)
33
GO_VERSION := $(shell go version | awk '{ print $$3}' | sed 's/^go//')
44

5+
TESTREPORT := test-results.xml
6+
57
# XXX BUG(mweber) "go env GOBIN" is empty?
68
GOBIN := $(shell go env GOPATH)/bin
79

@@ -16,7 +18,7 @@ all: dep build lint test
1618

1719
.PHONY: dep
1820
dep: prereq
19-
dep ensure
21+
dep ensure $(DEPFLAGS)
2022

2123
.PHONY: build
2224
build: dep vault.hcl
@@ -37,7 +39,8 @@ dev: build
3739
.PHONY: test
3840
test: build
3941
@test -n "$$SPLUNK_ADDR" || { echo 'warning: SPLUNK_ADDR not set, creating new Splunk instances. This will be slow.'; }
40-
go test -v ./...
42+
mkdir -p $(dir $(TESTREPORT))
43+
gotestsum --junitfile $(TESTREPORT) -- -cover -v ./...
4144

4245
.PHONY: lint
4346
lint: dep
@@ -48,8 +51,9 @@ lint: dep
4851
prereq:
4952
go get github.com/golang/dep/cmd/dep
5053
go get golang.org/x/lint/golint
54+
go get gotest.tools/gotestsum
5155

5256
.PHONY: clean
5357
clean:
5458
# XXX clean
55-
rm -rf vault.hcl vendor/
59+
rm -rf vault.hcl $(TESTREPORT) vendor/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ vault-plugin-splunk
44
A Hashicorp Vault[1] plugin that aims to securely manage Splunk admin
55
accounts, including secrets rotation for compliance purposes.
66

7+
[![CircleCI](https://circleci.com/gh/splunk/vault-plugin-splunk.svg?style=svg)](https://circleci.com/gh/splunk/vault-plugin-splunk)
8+
79
[1] https://www.vaultproject.io/
810

911
# Building from Source

0 commit comments

Comments
 (0)