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

Commit

Permalink
feat(IMPORT): import role from legacy provisioner project
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Jun 23, 2021
1 parent 46b5418 commit ed024df
Show file tree
Hide file tree
Showing 26 changed files with 397 additions and 543 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
# .ansible-lint
skip_list: []
12 changes: 12 additions & 0 deletions .cookiecutter/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"_template": "https://github.com/shared-vision-solutions/ansible-workbench.git",
"author": "Niall Byrne",
"company": "Shared Vision Solutions",
"description": "Ansible role that wraps geerlingguy.homebrew in a retry loop to deal with connectivity issues.",
"email": "[email protected]",
"galaxy_namespace_slug": "osx_provisioner",
"galaxy_role_slug": "homebrew_retry",
"github_handle": "osx-provisioner",
"project_name": "role-homebrew-retry",
"project_slug": "role-homebrew-retry"
}
12 changes: 12 additions & 0 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -o pipefail

main() {

pip install poetry
poetry install

}

main "$@"
3 changes: 3 additions & 0 deletions .github/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ main() {
}

main

# Create Empty Results File
touch /tmp/results.yml
239 changes: 168 additions & 71 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,21 @@ on:

jobs:

build:
documentation_test:

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
- name: Documentation Test -- Checkout Repository
uses: actions/checkout@v1

- name: Build -- Setup Environment
- name: Documentation Test -- 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 -- Documentation Validation
uses: gaurav-nelson/[email protected]
with:
Expand All @@ -67,70 +33,124 @@ jobs:

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

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

steps:
- name: Security Test -- Set up Python ${{ matrix.python-version }}

- name: Molecule Lint -- Checkout Repository
uses: actions/checkout@v1

- name: Molecule Lint -- 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 -- Run Gitleaks
uses: zricethezav/gitleaks-action@master
- name: Molecule Lint -- Setup Environment
run: |
source ./.github/scripts/setup.sh
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

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

runs-on: ubuntu-latest
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: molecule linting has failed!"
osx_build:

runs-on: macos-${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
os: [10.15]
platform: [x86_64]
python-version: [3.8.10]
scenario: ["one_of_each"]

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

- name: Release -- Setup Environment

- name: OSX Build -- Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

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

- name: Release -- Prepare Content

- name: OSX Build -- Molecule Scenario
run: |
touch /tmp/results.yml
poetry run molecule test -s "${SCENARIO}"
env:
SCENARIO: ${{ matrix.scenario}}

- name: OSX Build -- Report Job Status (Success)
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":white_check_mark: OSX ${{ matrix.os }}, molecule test scenario '${SCENARIO}' was successful"
env:
SCENARIO: ${{ matrix.scenario}}

- name: OSX Build -- Report Job Status (Failure)
if: failure()
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: OSX ${{ matrix.os }}, molecule test scenario '${SCENARIO}' failed!"
env:
SCENARIO: ${{ matrix.scenario}}

release:
needs: [documentation_test, molecule_lint, osx_build, security_test]

runs-on: ubuntu-latest

steps:

- name: Release -- Checkout Repository
if: contains(github.ref, '/tags/v')
uses: actions/checkout@v1

- name: Release -- Setup Environment
if: contains(github.ref, '/tags/v')
run: |
source ./.github/scripts/setup.sh
NEWTAG=${BRANCH_OR_TAG}
echo "NEWTAG=${NEWTAG}" >> $GITHUB_ENV
echo "{}" > package.json
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

- name: Release -- Generate Changelog
if: contains(github.ref, '/tags/v')
uses: scottbrenner/generate-changelog-action@1.0.3
uses: scottbrenner/generate-changelog-action@v1.3.3
id: Changelog
env:
REPO: ${{ github.repository }}
Expand All @@ -146,14 +166,91 @@ jobs:
${{ 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"
./.github/scripts/notifications.sh "${NOTIFICATION}" ":white_check_mark: automated release has been created:\nhttps://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!"
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: automated release generation failed!"
security_test:

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

steps:

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

- 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: Security Test -- Report Job Status on Success
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":white_check_mark: security checks were successful!"
- name: Security Test -- Report Job Status on Failure
if: failure()
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: security checks failed!"
workflow_lint:

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

steps:

- name: Workflow Lint -- Checkout Repository
uses: actions/checkout@v1
- name: Workflow Lint -- Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Workflow Lint -- Setup Environment
run: |
source ./.github/scripts/setup.sh
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
- name: Workflow Lint -- Install Requirements
run: |
pip install yamllint
- name: Workflow Lint -- Run Linter
run: |
yamllint .github/workflows -f standard
- name: Workflow Lint -- Report Job Status (Success)
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":white_check_mark: workflow linting was successful!"
- name: Workflow Lint -- Report Job Status (Failure)
if: failure()
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: workflow linting has failed!"
13 changes: 7 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ jobs:
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'
Expand All @@ -42,6 +38,11 @@ jobs:
with:
fetch-depth: 0

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

- name: Publish to Galaxy -- Setup Environment
run: |
source .github/scripts/setup.sh
Expand All @@ -60,8 +61,8 @@ jobs:

- name: Publish to Galaxy -- Report Job Status (Success)
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" "automated galaxy import has been completed!"
./.github/scripts/notifications.sh "${NOTIFICATION}" ":white_check_mark: automated ansible 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!"
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: automated ansible galaxy import has failed!"
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit ed024df

Please sign in to comment.