Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
build(COOKIECUTTER): initial generation
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed May 21, 2021
0 parents commit c6e5f0b
Show file tree
Hide file tree
Showing 27 changed files with 949 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# .ansible-lint
skip_list: []
46 changes: 46 additions & 0 deletions .github/markdown/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at niall@niallbyrne.ca. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
3 changes: 3 additions & 0 deletions .github/markdown/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contribution Guide

[Code of Conduct](./CODE_OF_CONDUCT.md)
15 changes: 15 additions & 0 deletions .github/markdown/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#### What's going wrong?

#### How can the role-jumpcloud team reproduce the problem?

<!-- Please add a complete description of how to reproduce the problem -->

#### Is this a problem with a fresh install of the project?

- [ ] Yes
- [ ] No

<!--
- Participation in this open source project is subject to the Code of Conduct:
[Code of Conduct](./CODE_OF_CONDUCT.md)
-->
1 change: 1 addition & 0 deletions .github/markdown/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Closes # for release #.
7 changes: 7 additions & 0 deletions .github/scripts/notifications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Takes two text arguments
# Message Format: <ARG1>: <ARG2>

[[ -z ${WEBHOOK_URL} ]] && exit 0
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"${1}: ${2}\"}" "${WEBHOOK_URL}"
15 changes: 15 additions & 0 deletions .github/scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# shellcheck disable=SC2129

main() {
BRANCH_OR_TAG="$(echo "${GITHUB_REF}" | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')"
PROJECT_NAME="role-jumpcloud"
echo "BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> "$GITHUB_ENV"
echo "WEBHOOK_URL=${WEBHOOK_URL}" >> "$GITHUB_ENV"
echo "PROJECT_NAME=${PROJECT_NAME}" >> "$GITHUB_ENV"
echo "NOTIFICATION=${PROJECT_NAME} [${BRANCH_OR_TAG}]" >> "$GITHUB_ENV"
echo "USERNAME=osx-provisioner" >> "$GITHUB_ENV"
}

main
171 changes: 171 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
---
name: role-jumpcloud-push

# Workflow Secrets:
# SLACK_WEBHOOK (Required, for slack notifications...)

on:
push:
workflow_dispatch:

jobs:

build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Build -- Checkout Repository
uses: actions/checkout@v1

- name: Build -- Setup Environment
run: |
source ./.github/scripts/setup.sh
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

- name: Build -- Install Requirements
run: |
pip install poetry
poetry install
- name: Build -- Run Linter
run: |
poetry run molecule lint
- name: Build -- Run docker1 Scenario
run: |
poetry run molecule test -s docker1
- name: Build -- Report Job Status (Success)
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "build was successful!"
- name: Build -- Report Job Status (Failure)
if: failure()
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "build has failed!"
documentation_test:

runs-on: ubuntu-latest

steps:
- name: Documentation Test -- Checkout Repository
uses: actions/checkout@v1
- name: Documentation Test -- Setup Environment
run: |
source ./.github/scripts/setup.sh
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

- name: Documentation Test -- Documentation Validation
uses: gaurav-nelson/github-action-markdown-link-check@1.0.11
with:
use-quiet-mode: 'no'
use-verbose-mode: 'yes'

- name: Documentation Test -- Report Success
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "documentation test has passed!"
- name: Documentation Test -- Report Failure
if: failure()
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "documentation test has failed!"
security_test:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]

steps:
- name: Security Test -- Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Security Test -- Checkout Repository
uses: actions/checkout@v1
- name: Security Test -- Setup Environment
run: |
source ./.github/scripts/setup.sh
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

- name: Security Test -- Run Gitleaks
uses: zricethezav/gitleaks-action@master

- name: Security Test -- Check Dependencies
run: |
pip install safety poetry
pip install --upgrade pip
poetry install
safety check
- name: Shellcheck -- Report Job Status on Success
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "security checks succeeded!"
- name: Shellcheck -- Report Job Status on Failure
if: failure()
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "security checks failed!"
release:
needs: [build, documentation_test, security_test]

runs-on: ubuntu-latest

steps:
- name: Release -- Checkout
uses: actions/checkout@v1

- name: Release -- Setup Environment
run: |
source ./.github/scripts/setup.sh
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

- name: Release -- Prepare Content
if: contains(github.ref, '/tags/v')
run: |
NEWTAG=${BRANCH_OR_TAG}
echo "NEWTAG=${NEWTAG}" >> $GITHUB_ENV
echo "{}" > package.json
- name: Release -- Generate Changelog
if: contains(github.ref, '/tags/v')
uses: scottbrenner/generate-changelog-action@1.0.3
id: Changelog
env:
REPO: ${{ github.repository }}
- name: Release -- Create Github Release
if: contains(github.ref, '/tags/v')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.NEWTAG }}
release_name: Release ${{ env.NEWTAG }}
body: |
${{ steps.Changelog.outputs.changelog }}
draft: true
prerelease: false

- name: Release -- Report Job Status (Success)
if: contains(github.ref, '/tags/v')
run: |
./.github/scripts/notifications.sh \
"${NOTIFICATION}" \
"automated release has been created: https://github.com/${USERNAME}/${PROJECT_NAME}/releases"
- name: Release -- Report Job Status (Failure)
if: failure() && contains(github.ref, '/tags/v')
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "automated release generation failed!"
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: role-jumpcloud-publish-to-galaxy

# Workflow Secrets:
# SLACK_WEBHOOK (Required, for slack notifications...)
# GALAXY_API_KEY (Required, for Ansible Galaxy Import...)

on:
release:
types: [published]
workflow_dispatch:
inputs:
TAG:
description: 'Tag to Deploy'
required: true
default: ''

jobs:
publish_to_galaxy:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Publish to Galaxy -- Code Checkout (workflow dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.inputs.TAG }}
- name: Publish to Galaxy -- Code Checkout (published release)
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Publish to Galaxy -- Setup Environment
run: |
source .github/scripts/setup.sh
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

- name: Publish to Galaxy -- Install Requirements
run: |
pip install poetry
poetry install
- name: Publish to Galaxy -- Trigger Ansible Galaxy Import
run: |
ansible-galaxy role import ${USERNAME} ${PROJECT_NAME} --token ${API_KEY}
env:
API_KEY: ${{ secrets.GALAXY_API_KEY }}

- name: Publish to Galaxy -- Report Job Status (Success)
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "automated galaxy import has been completed!"
- name: Publish to Galaxy -- Report Job Status (Failure)
if: failure()
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "automated galaxy import has failed!"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.txt
.cache
poetry.lock
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
sudo: required
language: bash
jobs:
include:
- os: osx
osx_image: xcode12.5
env:
- SCENARIO=hostmachine1
before_install: []
install:
- sudo python3 -m pip install poetry
- poetry install
script:
- poetry run molecule lint
- poetry run molecule test -s "${SCENARIO}"
notifications:
slack:
onOocckzUfSjYwx/o1tD1wvWvOGsLYRp8LXEUDU79ycPjm/MQy2rSYiOFxkd54bn75MQZEagUm48ehVOgRzmBKEfBqcSbY7oVYinjaE3FrTedplnwbP7/925d1fWr+zqd2XshU7IQZHRNepFKw7Uux8L+tSYrGUFpgak4zS/KBDpfEzyQbqyiYeu/BycF21Mc+hgoNPzwi3oIOWhN+W6xQmIWdkqwHDi8Ut/37nLMCOtoljIVGLjHjy64Wk5Kf88xZQNMJU34BSBK5lYgsZQ8eDJlAn/yGGkxW+qUCZ1EgP9c6+jAsjLOpCUgwR7IvkYCtYQV9svK+TwIHnoLJ1XRmuhiL8aYKfEFeIkysttkBcn4jLCUR1QL13f8wsCBszoqK4QLbhMikkOWMveFziKRZHfQv10jDOlVGWIuWqQ9M0yVwPLoTgKL1Kp+QZq0/1mJLdC0hiEXpv3ewF6AzPrP5+FJQxO/ZxR57v78xJ52T9blF/6iiSMISH7vaM0XGjw5uNW7vx6nLs/PQlelCmooCRZ1klM0bB4rkQyPEtDaMSOXPzUdkLp6Xpc13GgyjsWudzdaenO0HNADMDgDQY5dZHGSJ43F1yNVDOgqMvkKNLxbxpWgZZZpNkGGHfZEfzrX378e/4d4lGwGyPE2VhjblZZaePlLKn+BmX9z4llL1E=
Loading

0 comments on commit c6e5f0b

Please sign in to comment.