Skip to content

Commit 5d64db0

Browse files
Merge pull request #1 from ansible-middleware/initial-impl
Initial implementation
2 parents 9054f14 + c9ed81b commit 5d64db0

31 files changed

+1478
-2
lines changed

.ansible-lint

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# .ansible-lint
2+
exclude_paths:
3+
- .cache/
4+
- .github/
5+
- molecule/
6+
- .ansible-lint
7+
- .yamllint
8+
- meta/
9+
- playbooks/roles/
10+
11+
rulesdir:
12+
- ../../ansible-lint-custom-rules/rules/
13+
14+
enable_list:
15+
- fqcn-builtins # opt-in
16+
- no-log-password # opt-in
17+
18+
warn_list:
19+
- role_vars_start_with_role_name
20+
- vars_in_vars_files_have_valid_names
21+
- experimental
22+
- ignore-errors
23+
- no-handler
24+
- fqcn-builtins
25+
- no-log-password
26+
- no-empty-data-files
27+
- name[template]
28+
- fqcn[keyword]
29+
30+
skip_list:
31+
- vars_should_not_be_used
32+
- file_is_small_enough
33+
- jinja[spacing]
34+
35+
use_default_rules: true
36+
parseable: true
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: 🐛 Bug report
3+
about: Create a report to help us improve
4+
5+
---
6+
7+
##### SUMMARY
8+
<!-- Explain the problem briefly -->
9+
10+
11+
##### ISSUE TYPE
12+
- Bug Report
13+
14+
15+
##### ANSIBLE VERSION
16+
<!-- Paste, BELOW THIS COMMENT, verbatim output from "ansible --version"-->
17+
```
18+
19+
```
20+
21+
##### COLLECTION VERSION
22+
<!-- Paste, BELOW THIS COMMENT, verbatim output from "ansible-galaxy collection list"-->
23+
<!-- If using virtual environments or execution environments, remember to activate them-->
24+
```
25+
26+
```
27+
28+
##### STEPS TO REPRODUCE
29+
<!-- List the steps to reproduce the problem, using a minimal test-case. -->
30+
31+
<!-- Paste example playbook below -->
32+
```yaml
33+
34+
```
35+
36+
##### EXPECTED RESULTS
37+
<!-- What did you expect to happen when running the steps above? -->
38+
39+
40+
##### ACTUAL RESULTS
41+
<!-- What actually happened? If possible run with extra verbosity (-vvvv) and diff (--diff) -->
42+
<!-- Please also include check mode (--check --diff) output if the API returns an error -->
43+
<!-- Be sure to mask any sensitive information -->
44+
45+
<!--- Paste verbatim command output between quotes below -->
46+
```
47+
48+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: ✨ Feature request
3+
about: Suggest an idea for this project
4+
5+
---
6+
7+
##### SUMMARY
8+
<!--- Explain the problem briefly -->
9+
10+
11+
##### ISSUE TYPE
12+
- Feature Idea

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: CI
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
COLORTERM: 'yes'
11+
TERM: 'xterm-256color'
12+
PYTEST_ADDOPTS: '--color=yes'
13+
14+
jobs:
15+
CI:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python_version: ["3.10"]
20+
steps:
21+
- name: Check out code
22+
uses: actions/checkout@v2
23+
with:
24+
path: ansible_collections/middleware_automation/common
25+
26+
- name: Set up Python ${{ matrix.python_version }}
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ matrix.python_version }}
30+
31+
- name: Install yamllint, ansible and molecule
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install yamllint 'molecule[docker]~=3.5.2' ansible-core flake8 ansible-lint voluptuous
35+
if [ -f ansible_collections/middleware_automation/common/requirements.txt ]; then
36+
pip install -r ansible_collections/middleware_automation/common/requirements.txt
37+
fi
38+
39+
- name: Create default collection path
40+
run: |
41+
mkdir -p /home/runner/.ansible/
42+
ln -s /home/runner/work/common/common /home/runner/.ansible/collections
43+
44+
- name: Install ansible-lint custom rules
45+
uses: actions/checkout@v2
46+
with:
47+
repository: ansible-middleware/ansible-lint-custom-rules
48+
path: ansible_collections/ansible-lint-custom-rules/
49+
50+
- name: Run sanity tests
51+
run: ansible-test sanity -v --color --python ${{ matrix.python_version }} --exclude changelogs/fragments/.gitignore --skip-test symlinks
52+
working-directory: ./ansible_collections/middleware_automation/common

.github/workflows/docs.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
name: Documentation
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "[0-9]+.[0-9]+.[0-9]+"
9+
workflow_dispatch:
10+
11+
env:
12+
COLORTERM: 'yes'
13+
TERM: 'xterm-256color'
14+
PYTEST_ADDOPTS: '--color=yes'
15+
16+
jobs:
17+
docs:
18+
runs-on: ubuntu-latest
19+
if: github.repository == 'ansible-middleware/amq'
20+
permissions:
21+
actions: write
22+
checks: write
23+
contents: write
24+
deployments: write
25+
packages: write
26+
pages: write
27+
steps:
28+
- name: Check out code
29+
uses: actions/checkout@v2
30+
with:
31+
path: ansible_collections/middleware_automation/common
32+
fetch-depth: 0
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v2
36+
with:
37+
python-version: 3.9
38+
39+
- name: Install doc dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install -r ansible_collections/middleware_automation/common/docs/requirements.txt
43+
if [ -f ansible_collections/middleware_automation/common/requirements.txt ]; then
44+
pip install -r ansible_collections/middleware_automation/common/requirements.txt
45+
fi
46+
sudo apt install -y sed hub
47+
48+
- name: Create default collection path
49+
run: |
50+
mkdir -p /home/runner/.ansible/
51+
ln -s /home/runner/work/common/common /home/runner/.ansible/collections
52+
53+
- name: Create changelog and documentation
54+
uses: ansible-middleware/collection-docs-action@main
55+
with:
56+
collection_fqcn: middleware_automation.common
57+
collection_repo: ansible-middleware/common
58+
dependencies: false
59+
commit_changelog: false
60+
commit_ghpages: true
61+
changelog_release: false
62+
generate_docs: true
63+
path: ansible_collections/middleware_automation/common
64+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
name: Release collection
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
if: github.repository == 'ansible-middleware/common'
10+
permissions:
11+
actions: write
12+
checks: write
13+
contents: write
14+
deployments: write
15+
packages: write
16+
pages: write
17+
outputs:
18+
tag_version: ${{ steps.get_version.outputs.TAG_VERSION }}
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
token: ${{ secrets.TRIGGERING_PAT }}
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v1
28+
with:
29+
python-version: "3.x"
30+
31+
- name: Get current version
32+
id: get_version
33+
run: echo "::set-output name=TAG_VERSION::$(grep version galaxy.yml | awk -F'"' '{ print $2 }')"
34+
35+
- name: Check if tag exists
36+
id: check_tag
37+
run: echo "::set-output name=TAG_EXISTS::$(git tag | grep ${{ steps.get_version.outputs.TAG_VERSION }})"
38+
39+
- name: Fail if tag exists
40+
if: ${{ steps.get_version.outputs.TAG_VERSION == steps.check_tag.outputs.TAG_EXISTS }}
41+
uses: actions/github-script@v3
42+
with:
43+
script: |
44+
core.setFailed('Release tag already exists')
45+
46+
- name: Install dependencies
47+
run: |
48+
python -m pip install --upgrade pip
49+
pip install ansible-core antsibull
50+
sudo apt install -y sed hub
51+
52+
- name: Build collection
53+
run: |
54+
ansible-galaxy collection build .
55+
56+
- name: Create changelog and documentation
57+
uses: ansible-middleware/collection-docs-action@main
58+
with:
59+
collection_fqcn: middleware_automation.common
60+
collection_repo: ansible-middleware/common
61+
dependencies: false
62+
commit_changelog: true
63+
commit_ghpages: false
64+
changelog_release: true
65+
generate_docs: false
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Publish collection
69+
env:
70+
ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }}
71+
run: |
72+
ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY
73+
74+
- name: Create release tag
75+
run: |
76+
git config user.name github-actions
77+
git config user.email github-actions@github.com
78+
git tag -a ${{ steps.get_version.outputs.TAG_VERSION }} -m "Release v${{ steps.get_version.outputs.TAG_VERSION }}" || true
79+
git push origin --tags
80+
81+
- name: Publish Release
82+
uses: softprops/action-gh-release@v1
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
with:
86+
tag_name: ${{ steps.get_version.outputs.TAG_VERSION }}
87+
files: "*.tar.gz"
88+
body_path: gh-release.md
89+
90+
dispatch:
91+
needs: release
92+
strategy:
93+
matrix:
94+
repo: ['ansible-middleware/ansible-middleware-ee']
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: Repository Dispatch
98+
uses: peter-evans/repository-dispatch@v1
99+
with:
100+
token: ${{ secrets.TRIGGERING_PAT }}
101+
repository: ${{ matrix.repo }}
102+
event-type: "Dependency released - Common v${{ needs.release.outputs.tag_version }}"
103+
client-payload: '{ "github": ${{toJson(github)}} }'

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
*.pyc
2+
*.retry
3+
.vscode
4+
5+
__pycache__/
6+
7+
# Galaxy artifacts.
8+
*.tar.gz
9+
*.zip
10+
11+
# Temporary test files.
12+
tests/output
13+
14+
.tmp
15+
.cache
16+
docs/plugins/
17+
docs/roles/
18+
docs/_build/
19+
.pytest_cache/
20+
.mypy_cache/
21+
*.retry
22+
23+
inventory
24+
changelogs/.plugin-cache.yaml

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
=======================================
2+
middleware_automation.common Release Notes
3+
=======================================
4+
5+
.. contents:: Topics
6+
7+

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
## Contributor's Guidelines
3+
4+
- All YAML files named with `.yml` extension
5+
- Use spaces around jinja variables. `{{ var }}` over `{{var}}`
6+
- Variables that are internal to the role should be lowercase and start with the role name
7+
- Keep roles self contained - Roles should avoid including tasks from other roles when possible
8+
- Plays should do nothing more than include a list of roles except where `pre_tasks` and `post_tasks` are required when possible
9+
- Separators - Use valid name, ie. underscores (e.g. `my_role` `my_playbook`) not dashes (`my-role`)
10+
- Paths - When defining paths, do not include trailing slashes (e.g. `my_path: /foo` not `my_path: /foo/`). When concatenating paths, follow the same convention (e.g. `{{ my_path }}/bar` not `{{ my_path }}bar`)
11+
- Indentation - Use 2 spaces for each indent
12+
- `vars/` vs `defaults/` - internal or interpolated variables that don't need to change or be overridden by user go in `vars/`, those that a user would likely override, go under `defaults/` directory
13+
- All arguments have a specification in `meta/argument_specs.yml`
14+
- All playbooks/roles should be focused on compatibility with Ansible Automation Platform

0 commit comments

Comments
 (0)