-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
1,891 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Lint GitHub Actions Workflows | ||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/**' | ||
jobs: | ||
actionlint: | ||
# using `main` as the ref will keep your workflow up-to-date | ||
uses: hashicorp/vault-workflows-common/.github/workflows/actionlint.yaml@main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Upgrade dependencies | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Runs 12:00AM on the first of every month | ||
- cron: '0 0 1 * *' | ||
jobs: | ||
upgrade: | ||
# using `main` as the ref will keep your workflow up-to-date | ||
uses: hashicorp/vault-workflows-common/.github/workflows/bulk-dependency-updates.yaml@main | ||
secrets: | ||
VAULT_ECO_GITHUB_TOKEN: ${{ secrets.VAULT_ECO_GITHUB_TOKEN }} | ||
with: | ||
reviewer-team: hashicorp/vault-ecosystem-applications | ||
repository: ${{ github.repository }} | ||
run-id: ${{ github.run_id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,19 @@ | ||
name: Jira Sync | ||
on: | ||
issues: | ||
types: [opened, closed, deleted, reopened] | ||
pull_request_target: | ||
types: [opened, closed, reopened] | ||
issue_comment: # Also triggers when commenting on a PR from the conversation view | ||
types: [created] | ||
|
||
name: Jira Sync | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
name: Jira sync | ||
steps: | ||
- name: Login | ||
uses: atlassian/[email protected] | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_SYNC_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_SYNC_USER_EMAIL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_SYNC_API_TOKEN }} | ||
|
||
- name: Preprocess | ||
if: github.event.action == 'opened' || github.event.action == 'created' | ||
id: preprocess | ||
run: | | ||
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then | ||
echo "::set-output name=type::PR" | ||
else | ||
echo "::set-output name=type::ISS" | ||
fi | ||
- name: Create ticket | ||
if: github.event.action == 'opened' | ||
uses: tomhjp/[email protected] | ||
with: | ||
project: VAULT | ||
issuetype: "GH Issue" | ||
summary: "${{ github.event.repository.name }} [${{ steps.preprocess.outputs.type }} #${{ github.event.issue.number || github.event.pull_request.number }}]: ${{ github.event.issue.title || github.event.pull_request.title }}" | ||
description: "${{ github.event.issue.body || github.event.pull_request.body }}\n\n_Created from GitHub Action for ${{ github.event.issue.html_url || github.event.pull_request.html_url }} from ${{ github.actor }}_" | ||
# customfield_10089 is Issue Link custom field | ||
# customfield_10091 is team custom field | ||
extraFields: '{"fixVersions": [{"name": "TBD"}], "customfield_10091": ["ecosystem", "applications"], "customfield_10089": "${{ github.event.issue.html_url || github.event.pull_request.html_url }}"}' | ||
|
||
- name: Search | ||
if: github.event.action != 'opened' | ||
id: search | ||
uses: tomhjp/[email protected] | ||
with: | ||
# cf[10089] is Issue Link custom field | ||
jql: 'project = "VAULT" and cf[10089]="${{ github.event.issue.html_url || github.event.pull_request.html_url }}"' | ||
|
||
- name: Sync comment | ||
if: github.event.action == 'created' && steps.search.outputs.issue | ||
uses: tomhjp/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
comment: "${{ github.actor }} ${{ github.event.review.state || 'commented' }}:\n\n${{ github.event.comment.body || github.event.review.body }}\n\n${{ github.event.comment.html_url || github.event.review.html_url }}" | ||
|
||
- name: Close ticket | ||
if: (github.event.action == 'closed' || github.event.action == 'deleted') && steps.search.outputs.issue | ||
uses: atlassian/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
transition: Closed | ||
|
||
- name: Reopen ticket | ||
if: github.event.action == 'reopened' && steps.search.outputs.issue | ||
uses: atlassian/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
transition: "Pending Triage" | ||
uses: hashicorp/vault-workflows-common/.github/workflows/jira.yaml@main | ||
# assuming you use Vault to get secrets | ||
# if you use GitHub secrets, use secrets.XYZ instead of steps.secrets.outputs.XYZ | ||
secrets: | ||
JIRA_SYNC_BASE_URL: ${{ secrets.JIRA_SYNC_BASE_URL }} | ||
JIRA_SYNC_USER_EMAIL: ${{ secrets.JIRA_SYNC_USER_EMAIL }} | ||
JIRA_SYNC_API_TOKEN: ${{ secrets.JIRA_SYNC_API_TOKEN }} | ||
with: | ||
teams-array: '["ecosystem", "applications"]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,7 @@ | ||
name: Tests | ||
|
||
# Run this workflow on pushes and manually | ||
on: [push, workflow_dispatch] | ||
|
||
name: Run Tests | ||
on: | ||
push: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
GO111MODULE: on | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# cache/restore go mod | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.18.1 | ||
|
||
- name: Build | ||
run: go build | ||
|
||
- name: Test | ||
run: make test | ||
run-tests: | ||
# using `main` as the ref will keep your workflow up-to-date | ||
uses: hashicorp/vault-workflows-common/.github/workflows/tests.yaml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.20.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Copyright (c) 2018 HashiCorp, Inc. | ||
|
||
Mozilla Public License, version 2.0 | ||
|
||
1. Definitions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,91 @@ | ||
TOOL?=vault-gcp-secrets-plugin | ||
TEST?=$$(go list ./... | grep -v /vendor/) | ||
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr | ||
EXTERNAL_TOOLS=\ | ||
github.com/mitchellh/gox \ | ||
github.com/kardianos/govendor | ||
EXTERNAL_TOOLS= | ||
BUILD_TAGS?=${TOOL} | ||
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) | ||
# bin generates the releaseable binaries for this plugin | ||
|
||
PLUGIN_NAME?=$(shell command ls bin/) | ||
PLUGIN_DIR?=$$GOPATH/vault-plugins | ||
PLUGIN_PATH?=local-gcp | ||
|
||
# bin generates the releasable binaries for this plugin | ||
.PHONY: bin | ||
bin: fmtcheck generate | ||
@CGO_ENABLED=0 BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/build.sh'" | ||
|
||
.PHONY: default | ||
default: dev | ||
|
||
# dev creates binaries for testing Vault locally. These are put | ||
# into ./bin/ as well as $GOPATH/bin, except for quickdev which | ||
# is only put into /bin/ | ||
.PHONY: quickdev | ||
quickdev: generate | ||
@CGO_ENABLED=0 go build -i -tags='$(BUILD_TAGS)' -o bin/vault-gcp-auth-plugin | ||
@CGO_ENABLED=0 go build -tags='$(BUILD_TAGS)' -o bin/vault-plugin-secrets-gcp cmd/vault-plugin-secrets-gcp/main.go | ||
.PHONY: dev | ||
dev: fmtcheck generate | ||
@CGO_ENABLED=0 BUILD_TAGS='$(BUILD_TAGS)' VAULT_DEV_BUILD=1 sh -c "'$(CURDIR)/scripts/build.sh'" | ||
.PHONY: dev-dynamic | ||
dev-dynamic: generate | ||
@CGO_ENABLED=1 BUILD_TAGS='$(BUILD_TAGS)' VAULT_DEV_BUILD=1 sh -c "'$(CURDIR)/scripts/build.sh'" | ||
|
||
.PHONY: testcompile | ||
testcompile: fmtcheck generate | ||
@for pkg in $(TEST) ; do \ | ||
go test -v -c -tags='$(BUILD_TAGS)' $$pkg -parallel=4 ; \ | ||
done | ||
|
||
.PHONY: test | ||
test: | ||
@go test -short ./... $(TESTARGS) | ||
|
||
test-acc: | ||
.PHONY: testacc | ||
testacc: | ||
@go test ./... $(TESTARGS) | ||
|
||
# generate runs `go generate` to build the dynamically generated | ||
# source files. | ||
.PHONY: generate | ||
generate: | ||
@go generate $(go list ./... | grep -v /vendor/) | ||
|
||
# bootstrap the build by downloading additional tools | ||
.PHONY: bootstrap | ||
bootstrap: | ||
@for tool in $(EXTERNAL_TOOLS) ; do \ | ||
echo "Installing/Updating $$tool" ; \ | ||
go get -u $$tool; \ | ||
done | ||
|
||
.PHONY: fmtcheck | ||
fmtcheck: | ||
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" | ||
|
||
.PHONY: fmt | ||
fmt: | ||
gofmt -w $(GOFMT_FILES) | ||
gofmt -w $(GOFMT_FILES) && cd bootstrap/terraform && terraform fmt | ||
|
||
.PHONY: update-resources | ||
update-resources: | ||
pushd $(CURDIR)/plugin/iamutil && \ | ||
go build -o generate ./internal && \ | ||
./generate && \ | ||
rm generate && \ | ||
popd | ||
|
||
.PHONY: setup-env | ||
setup-env: | ||
cd bootstrap/terraform && terraform init && terraform apply -auto-approve | ||
|
||
.PHONY: teardown-env | ||
teardown-env: | ||
cd bootstrap/terraform && terraform init && terraform destroy -auto-approve | ||
|
||
.PHONY: bin default generate test vet bootstrap fmt fmtcheck update-resources | ||
.PHONY: configure | ||
configure: dev | ||
@./bootstrap/configure.sh \ | ||
$(PLUGIN_DIR) \ | ||
$(PLUGIN_NAME) \ | ||
$(PLUGIN_PATH) \ | ||
$(GOOGLE_TEST_CREDENTIALS) |
Oops, something went wrong.