Skip to content

Commit

Permalink
Improved terraform output, move to GitHub Actions
Browse files Browse the repository at this point in the history
xanmanning committed Mar 13, 2021
1 parent 2a3c2f8 commit 68a801c
Showing 24 changed files with 331 additions and 167 deletions.
56 changes: 56 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: Bug report
about: Create a report to help us improve
---

<!-- Please first verify that your issue is not already reported on GitHub -->
<!-- Complete *all* sections as described. -->

### Summary

<!-- Explain the problem briefly below -->

### Issue Type

- Bug Report

### Controller Environment and Configuration

<!--
Please also include information about the versions of:
- Ansible (ansible --version)
- Python (python --version)
- This role
-->

```text
```

### Steps to Reproduce

<!-- Describe exactly how to reproduce the problem, using a minimal test-case -->

<!-- Paste example playbooks or commands between quotes below -->

```yaml

```

### Expected Result

<!-- Describe what you expected to happen when running the steps above -->

```text
```

### Actual Result

<!-- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->

<!-- Paste verbatim command output between quotes -->

```text
```
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

blank_issues_enabled: true
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Feature request
about: Suggest an idea for this project
---

<!-- Please first verify that your feature was not already discussed on GitHub -->
<!-- Complete *all* sections as described, this form is processed automatically -->

### Summary

<!-- Describe the new feature/improvement briefly below -->

### Issue Type

- Feature Request

### User Story

<!-- If you can, please provide a user story, if you don't know what this is don't worry, it will be refined by PyratLabs. -->
<!-- Describe who would use it, why it is needed and the benefit -->

_As a_ <!-- (Insert Persona) --> \
_I want to_ <!-- (Insert Action) --> \
_So that_ <!-- (Insert Benefit) -->

### Additional Information

<!-- Please include any relevant documentation, URLs, etc. -->
<!-- Paste example playbooks or commands between quotes below -->

```yaml

```
37 changes: 37 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## TITLE

### Summary

<!-- Describe the change below, including rationale and design decisions -->

<!-- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->

### Issue type

<!-- Pick one below and delete the rest -->
- Bugfix
- Documentation
- Feature

### Test instructions

<!-- Please provide instructions for testing this PR -->

### Acceptance Criteria

<!-- Please list criteria required to ensure this change has been sufficiently reviewed. -->

<!-- Example ticklist:
- [ ] GitHub Actions Build passes.
- [ ] Documentation updated.
-->

### Additional Information

<!-- Include additional information to help people understand the change here -->

<!-- Paste verbatim command output below, e.g. before and after your change -->

```text
```
18 changes: 18 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---

name: CI
'on':
pull_request:
push:
branches:
- main
- master
schedule:
- cron: "0 1 1 * *"

defaults:
run:
working-directory: "xanmanning.terraform_project"

jobs:
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: debian10
scenario: default
- distro: ubuntu2004
scenario: default
- distro: centos7
scenario: destroy
- distro: ubuntu1804
scenario: destroy
- distro: debian9
scenario: target
- distro: centos8
scenario: target

steps:
- name: Checkout codebase
uses: actions/checkout@v2
with:
path: "xanmanning.terraform_project"

- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install test dependencies
run: pip3 install -r molecule/requirements.txt

- name: Run Molecule check
run: molecule check --scenario-name "${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}

- name: Run Molecule test
run: molecule test --scenario-name "${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---

name: Release
'on':
push:
tags:
- '*'

defaults:
run:
working-directory: "xanmanning.terraform_project"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v2
with:
path: "xanmanning.terraform_project"

- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install Ansible
run: pip3 install -r requirements.txt

- name: Trigger a new import on Galaxy
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -8,3 +8,4 @@ vagramt/fetch
vagrant/ubuntu-*.log
__pycache__
*.pyc
.cache
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Ansible Role: Terraform Project

Ansible Role that wraps around and builds a workflow around [Hashicorp Terraform](https://www.terraform.io/) projects.
Ansible Role that wraps around and builds a workflow for [Hashicorp Terraform](https://www.terraform.io/) projects.

[![Build Status](https://www.travis-ci.org/PyratLabs/ansible-role-terraform-project.svg?branch=master)](https://www.travis-ci.org/PyratLabs/ansible-role-terraform-project)
[![CI](https://github.com/PyratLabs/ansible-role-terraform-project/actions/workflows/ci.yml/badge.svg)](https://github.com/PyratLabs/ansible-role-terraform-project/actions/workflows/ci.yml)

## Requirements

@@ -12,10 +12,8 @@ This role has been tested on Ansible 2.7.0+ against the following Linux Distribu
- CentOS 8
- CentOS 7
- Debian 10
- Fedora 29
- Fedora 30
- Fedora 31
- Ubuntu 18.04 LTS
- Ubuntu 20.04 LTS

## Disclaimer

1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
galaxy_info:
role_name: terraform_project
namespace: xanmanning
author: Xan Manning
description: Ansible Role that wraps around and builds a workflow around Terraform projects.
company: Pyrat Ltd.
43 changes: 4 additions & 39 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,9 @@
---

# dependency:
# name: galaxy
# driver:
# name: docker
# lint:
# name: yamllint
# platforms:
# - name: terraform_project
# image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest"
# command: ${MOLECULE_DOCKER_COMMAND:-""}
# pre_build_image: true
# scenario:
# check_sequence:
# - lint
# - cleanup
# - dependency
# - syntax
# - create
# - prepare
# - check
# test_sequence:
# - converge
# - destroy
# provisioner:
# name: ansible
# options:
# verbose: true
# lint:
# name: ansible-lint
# playbooks:
# prepare: ${MOLECULE_PREPARE_PLAYBOOK:-prepare.yml}
# check: ${MOLECULE_PLAYBOOK:-playbook.yml}
# converge: ${MOLECULE_PLAYBOOK:-playbook.yml}
# verifier:
# name: testinfra
# lint:
# name: flake8

dependency:
name: galaxy
options:
role-file: molecule/requirements.yml
driver:
name: docker
lint: |
@@ -53,14 +17,15 @@ platforms:
pre_build_image: ${MOLECULE_PREBUILT:-true}
scenario:
check_sequence:
- dependency
- lint
- cleanup
- dependency
- syntax
- create
- prepare
- check
test_sequence:
- dependency
- converge
- destroy
provisioner:
Loading

0 comments on commit 68a801c

Please sign in to comment.