Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
path: test-results/
- store_artifacts:
path: test-results/
- store_artifacts:
path: /go/bin/vault-plugin-splunk

- save_cache:
name: Saving Cache for vendor
Expand All @@ -59,3 +61,38 @@ jobs:
key: build-cache-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_BUILD_NUM }}
paths:
- /tmp/go/cache

- persist_to_workspace:
root: /go/bin
# Must be relative path from root
paths:
- vault-plugin-splunk

publish-github-release:
docker:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: ./artifacts
- run:
name: "Publish Release on GitHub"
command: |
VERSION=$(artifacts/vault-plugin-splunk -version)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./artifacts/

workflows:
version: 2
tagged-build:
jobs:
- build:
filters:
tags:
only: /^\d+\.\d+\.\d+$/
- publish-github-release:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := 0.1.0
VERSION := $(shell git describe --tags --always 2>/dev/null)
SHORT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo dev)
GO_VERSION := $(shell go version | awk '{ print $$3}' | sed 's/^go//')

Expand Down
14 changes: 14 additions & 0 deletions cmd/vault-plugin-splunk/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"os"

"github.com/hashicorp/go-hclog"
Expand All @@ -10,13 +11,26 @@ import (
splunk "github.com/splunk/vault-plugin-splunk"
)

var (
version string
goVersion string
)

func main() {
apiClientMeta := &pluginutil.APIClientMeta{}
flags := apiClientMeta.FlagSet()
printVersion := flags.Bool("version", false, "Prints version")

// all plugins ignore Parse errors
// #nosec G104
flags.Parse(os.Args[1:])

switch {
case *printVersion:
fmt.Printf("%s %s (golang %s)\n", os.Args[0], version, goVersion)
os.Exit(0)
}

tlsConfig := apiClientMeta.GetTLSConfig()
tlsProviderFunc := pluginutil.VaultPluginTLSProvider(tlsConfig)

Expand Down