Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance, workflow and lint changes #215

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .github/CODEOWNERS
Empty file.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
labels:
- "skip-changelog"
3 changes: 3 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# see https://github.com/ansible-community/devtools
_extends: ansible-community/devtools
15 changes: 15 additions & 0 deletions .github/workflows/ack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml
name: ack

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on: # yamllint disable-line rule:truthy
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]

jobs:
ack:
uses: ansible/devtools/.github/workflows/ack.yml@main
15 changes: 15 additions & 0 deletions .github/workflows/codecoverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: code_coverage

on: # yamllint disable-line rule:truthy
push:
pull_request:
branches: [ main ]

jobs:
codecoverage:
uses: ansible-network/github_actions/.github/workflows/coverage_network_devices.yml@main
with:
collection_pre_install: >-
git+https://github.com/ansible-collections/ansible.utils.git
git+https://github.com/ansible-collections/ansible.netcommon.git
12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: ansible-lint
on: # yamllint disable-line rule:truthy
pull_request:
branches: ["main"]
jobs:
build:
name: Ansible Lint
runs-on: ubuntu-latest
steps:
- name: Run ansible-lint
uses: ansible/ansible-lint@main
27 changes: 27 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
# push workflow is shared and expected to perform actions after a merge happens
# on a maintenance branch (default or release). For example updating the
# draft release-notes.
# based on great work from
# https://github.com/T-Systems-MMS/ansible-collection-icinga-director
name: push

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on: # yamllint disable-line rule:truthy
workflow_dispatch:

env:
NAMESPACE: cisco
COLLECTION_NAME: asa
ANSIBLE_COLLECTIONS_PATHS: ./

jobs:
update_release_draft:
uses: ansible/devtools/.github/workflows/push_network.yml@main
with:
repo: ansible-collections/cisco.asa
secrets:
BOT_PAT: ${{ secrets.BOT_PAT }}
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: release
on: # yamllint disable-line rule:truthy
release:
types: [published]

jobs:
release:
uses: ansible/devtools/.github/workflows/release_collection.yml@main
with:
environment: release
secrets:
ah_token: ${{ secrets.AH_TOKEN }}
ansible_galaxy_api_key: ${{ secrets.ANSIBLE_GALAXY_API_KEY }}
19 changes: 10 additions & 9 deletions .github/workflows/test.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
---
name: Test collection
name: test_collection

concurrency:
group: ${{ github.head_ref }}
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on: # yamllint disable-line rule:truthy
pull_request:
branches: [main]
workflow_dispatch:
schedule:
- cron: '0 0 * * *'


jobs:
ansible-lint:
uses: ansible-network/github_actions/.github/workflows/ansible-lint.yml@main
changelog:
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
if: github.event_name != 'schedule'
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
unit-galaxy:
Expand All @@ -26,20 +28,19 @@ jobs:
git+https://github.com/ansible-collections/ansible.utils.git
git+https://github.com/ansible-collections/ansible.netcommon.git
all_green:
if: ${{ always() }}
if: ${{ always() && (github.event_name != 'schedule') }}
needs:
- ansible-lint
- changelog
- sanity
- unit-galaxy
- unit-source
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert set([
'${{ needs.ansible-lint.result }}',
python -c "assert 'failure' not in
set([
'${{ needs.changelog.result }}',
'${{ needs.sanity.result }}',
'${{ needs.unit-galaxy.result }}',
'${{ needs.unit-source.result }}'
]) == {'success'}"
])"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,10 @@ venv.bak/

# mypy
.mypy_cache/

# ide
*.code-workspace
.vscode/
.DS_Store

changelogs/.plugin-cache.yaml
12 changes: 8 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
- repo: https://github.com/ansible-network/collection_prep
rev: 1.1.1
hooks:
- id: autoversion
# - id: autoversion # removed as being handled by GHA push and release drafter
- id: update-docs

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -18,14 +18,17 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.5.1
rev: v3.1.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.9-for-vscode"
rev: "v3.0.3"
hooks:
- id: prettier
entry: env CI=1 bash -c "prettier --list-different . || ec=$? && prettier --loglevel=error --write . && exit $ec"
pass_filenames: false
args: []
additional_dependencies:
- prettier
- prettier-plugin-toml
Expand All @@ -35,8 +38,9 @@ repos:
hooks:
- id: isort
name: Sort import statements using isort
args: ["--filter-files"]

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.9.1
hooks:
- id: black
4 changes: 2 additions & 2 deletions plugins/module_utils/network/asa/rm_templates/ogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _tmplt_services_object(config_data):
if config_data["services_object"].get("source_port"):
if config_data["services_object"]["source_port"].get("range"):
cmd += " source range {start} {end}".format(
**config_data["services_object"]["source_port"]["range"]
**config_data["services_object"]["source_port"]["range"],
)
else:
key = list(config_data["services_object"]["source_port"])[0]
Expand All @@ -104,7 +104,7 @@ def _tmplt_services_object(config_data):
if config_data["services_object"].get("destination_port"):
if config_data["services_object"]["destination_port"].get("range"):
cmd += " destination range {start} {end}".format(
**config_data["services_object"]["destination_port"]["range"]
**config_data["services_object"]["destination_port"]["range"],
)
else:
key = list(config_data["services_object"]["destination_port"])[0]
Expand Down
Loading