Skip to content

Commit

Permalink
initial commit (#1)
Browse files Browse the repository at this point in the history
* initial commit

Signed-off-by: Brian Menges <[email protected]>
  • Loading branch information
mengesb authored Mar 5, 2021
1 parent 4986c58 commit 32af946
Show file tree
Hide file tree
Showing 27 changed files with 1,523 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Each line is a file pattern followed by one or more owners.

# Everything
* @mengesb
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Pull Request

## Description
<!-- Describe your changes in detail -->
<!-- Cite ALL GitHub issues -->
- DESCRIPTION_HERE

## Types of changes
<!--- Put an `x` in **ONE** the boxes. -->
<!--- To fill in a selection, place an `x` in the box like so: [x] -->
<!--- Questions? Don't hesitate to ask. We're here to help! -->
- [ ] PATCH change (a.b.PATCH) - adding configuration or non-breaking fix
- [ ] FEATURE change (a.FEATURE.0) - non-breaking change which adds
functionality
- [ ] MAJOR change (MAJOR.0.0) - fix or feature that would cause existing
functionality to not work as expected

## Gists
<!--- Please include any gists in code blocks here -->
```text
this is a code block for gists, feel free to use whatever codeblock fencing
you wish
```

## Checklist
<!--- Put an `x` in all the boxes that apply. -->
<!--- Questions? Don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project (linting).
- [ ] Associated workspace speculative plans pass and/or tests appear correct
- [ ] My change requires a change to the documentation and have been completed
45 changes: 45 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'documentation'
autolabeler:
- label: 'documentation'
files:
- '*.md'
branch:
- '/docs{0,1}\/.+/'
- label: 'bug'
branch:
- '/fix\/.+/'
title:
- '/fix/i'
- label: 'enhancement'
branch:
- '/feature\/.+/'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&#@`'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## Changes
$CHANGES
48 changes: 48 additions & 0 deletions .github/workflows/bats-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Unit - BATS
on: [push, pull_request]
jobs:
unit:
runs-on: ubuntu-20.04
steps:
- name: Setup BATS
uses: mig4/setup-bats@v1
with:
bats-version: 1.2.1

- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
submodules: true

- name: Checkout shdoc
uses: actions/checkout@v2
with:
path: shdoc
repository: reconquest/shdoc
submodules: recursive

- name: Setup requirements
shell: bash
run: |
sudo curl -Lo /usr/local/bin/ec2-metadata-mock https://github.com/aws/amazon-ec2-metadata-mock/releases/download/v1.8.1/ec2-metadata-mock-`uname | tr '[:upper:]' '[:lower:]'`-amd64
sudo chmod a+x /usr/local/bin/ec2-metadata-mock
cd shdoc
sudo make install
cd ..
rm -rf shdoc
- name: Test
shell: bash
run: |
echo "Test: test/requirements.bats"
bats test/requirements.bats
for f in $(ls test/*.bats | grep -v requirements); do
echo "TEST: $f" && bats $f
RET=$?
[[ "${RET}" -eq 0 ]] && sleep 1 && echo ""
[[ "${RET}" -ne 0 ]] && exit 1
done
exit "${RET}"
18 changes: 18 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release Drafter

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/shell-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Generate shell script docs
on:
- pull_request

jobs:
docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Install gawk
shell: bash
run: |
sudo apt install -y gawk
- name: Setup shdoc
shell: bash
run: |
git clone --recursive https://github.com/reconquest/shdoc
cd shdoc
sudo make install
cd ..
rm -rf shdoc
- name: Render shdoc
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for FILE in $(find . -type f -iname "*.sh" | grep -v test | sed 's/\.\///')
do
BAREFILE="${FILE##*/}"
shdoc < ${FILE} > docs/${BAREFILE:0:-3}.md
done
git config user.email [email protected]
git config user.name github-actions
git commit -am "shdoc: Automated shell script document updates"
git push
28 changes: 28 additions & 0 deletions .github/workflows/shellcheck-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Shell script lint
on:
- pull_request

jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
submodules: true

- name: Setup shellcheck
shell: bash
run: |
sudo apt-get -y install shellcheck
- name: shellcheck
shell: bash
run: |
for FILE in $(find . -type f -iname "*.sh" | grep -v test | sed 's/\.\///')
do
shellcheck $FILE
done
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "test/libs/bats"]
path = test/libs/bats
url = https://github.com/sstephenson/bats
[submodule "test/libs/bats-support"]
path = test/libs/bats-support
url = https://github.com/ztombol/bats-support
[submodule "test/libs/bats-assert"]
path = test/libs/bats-assert
url = https://github.com/ztombol/bats-assert
68 changes: 68 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Contributing

All contributors are welcome to submit patches but please keep the following in
mind:

- [Coding Standards](#coding-standards)
- [Testing](#testing)
- [Prerequisites](#prerequisites)

Please also keep in mind:

- Be patient as not all items will be tested or reviewed immediately by the Cloud Platform team.
- Be receptive and responsive to feedback about your additions or changes. Myself and/or other community members may make suggestions or ask questions about your change. This is part of the review process, and helps everyone to understand what is happening, why it is happening, and potentially optimizes your code.
- Be understanding

If you're looking to contribute but aren't sure where to start, check out the
open issues.

## Will Not Merge

This details Pull Requests that we will **not** be merged.

- New features without accompanying tests or proof of operation
- New features without accompanying usage documentation

## Coding Standards

The submitted code should be compatible with the following standards

- 2-space indentation style
- First curl brace on the same line as the method
- Closing curl brace on its own aligned newline
- Variable and value assignment does not need to be aligned with assignment operator

## Testing

Please indicate the results of your tests in a comment along with the pull request. Supplying tests and the method used to run/validate the changes are highly encouraged. This repository follows [Bats: Bash Automated Testing System](https://github.com/sstephenson/bats) standards.

## Linting

This repository follows [shellcheck](https://github.com/koalaman/shellcheck) standards for linting.

## Documentation

This repository uses `shdoc` to generate shell documentation. Please see [reconquest/shdoc](https://github.com/reconquest/shdoc#features) for annotations to document shell scripts

## Prerequisites

Familiarize yourself with BASH v4+ and be well versed in special variables.

- [Advanced Bash-Scripting Guide](https://tldp.org/LDP/abs/html/index.html)

## Process

1. Fork the git repository from GitHub:
2. Create a branch for your changes:
git checkout -b my_bug_fix
3. Make any changes
4. Write tests to support those changes.
5. Run the tests:
6. Assuming the tests pass, open a Pull Request on GitHub and add results

## Do's and Don't's

- **Do** include tests for your contribution
- **Do** request feedback via GitHub issues or other contact
- **Do NOT** break existing behavior (unless intentional)
- **Do NOT** modify the markdown documentation files
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,61 @@
# vault-iam-auth

Using IAM to auth for Vault

## Requirements

- Bash 4+
- IAM

## Usage

This repo contains a number of scripts segmented by cloud. There are some common functions to the clouds in the [functions](functions) directory.

### AWS

The following scripts are available for the AWS platform

| Name | File | Documentation | Purpose |
| ---- | ---- | ------------- | ------- |
| python-vault-iam | [python-vault-iam.py](aws/python-vault-iam.py) | | script |
| vault-iam-auth | [vault-iam-auth.sh](aws/vault-iam-auth.sh) | [vault-iam-auth.md](docs/vault-iam-auth.md) | script |
| vault-ec2-auth | TBD<!-- [vault-ec2-auth.sh](aws/vault-ec2-auth.sh) --> | TBD<!-- [vault-ec2-auth.md](docs/vault-ec2-auth.md) --> | TBD<!-- script --> |
| aws4-sign | [aws4-sign.sh](aws/aws4-sign.sh) | [aws4-sign.md](docs/aws4-sign.md) | library |
| aws-credentials | [aws-credentials.sh](aws/aws-credentials.sh) | [aws-credentials.md](docs/aws-credentials.md) | script/library |

### GCP

Currently there are no scripts for the GCP platform. Check back later for future updates.

### Functions

Scripts in the [functions](functions) directory support scripts beyond a single platform

| Name | File | Documentation | Purpose |
| ---- | ---- | ------------- | ------- |
| parse-url | [parse-url.sh](functions/parse-url.sh) | [parse-url.md](docs/parse-url.md) | script/library |

## Contributing

Contributions are always welcome. Please consult our [CONTRIBUTING.md](CONTRIBUTING.md) file for more information on how to submit quality contributions.

## License & Authors

Author: Brian Menges (@mengesb)

```text
Copyright 2021 Brian Menges
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
```
Loading

0 comments on commit 32af946

Please sign in to comment.