Skip to content

Commit 48d2d15

Browse files
authored
Merge pull request #1490 from cernymi/cernymi/yamllint
add yamllint to project pipeline and fix errors
2 parents 001d241 + 757cecd commit 48d2d15

23 files changed

+88
-8
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ body:
6767
Describe in detail the exact steps that someone else can take to
6868
reproduce this bug using the current stable release of the Ansible NetBox collection.
6969
Include any sanatized playbooks, variables, & tasks specifically showing just the issue.
70-
#placeholder: |
70+
# placeholder: |
7171

7272
validations:
7373
required: true

.github/workflows/main.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ jobs:
1515
- name: Run black
1616
uses: psf/black@stable
1717

18+
- name: Run yamllint
19+
uses: ibiqlik/action-yamllint@v3
20+
with:
21+
file_or_dir: .
22+
config_file: .yamllint.yml
23+
strict: true
24+
1825
unit_testing:
1926
runs-on: ubuntu-24.04
2027
needs: linting
@@ -66,7 +73,7 @@ jobs:
6673
strategy:
6774
fail-fast: false
6875
matrix:
69-
include:
76+
include:
7077
- VERSION: "v4.1"
7178
NETBOX_DOCKER_VERSION: 3.0.1
7279
- VERSION: "v4.2"
@@ -114,7 +121,7 @@ jobs:
114121
docker container ls
115122
docker logs netbox-docker-netbox-1
116123
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:32768/login/)" != "200" ]]; do echo "waiting for NetBox"; sleep 5; done' || false
117-
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
124+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
118125

119126
- name: Pre-populate NetBox
120127
run: ./tests/integration/netbox-deploy.py
@@ -126,13 +133,13 @@ jobs:
126133
ansible-test integration -v --color --coverage --python ${{ env.python-version }} inventory-${{ matrix.VERSION }}
127134
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
128135

129-
- name: Run regression tests
136+
- name: Run regression tests
130137
continue-on-error: true
131-
run: |
132-
ansible-test integration -v --color --coverage --python ${{ env.python-version }} regression-${{ matrix.VERSION }}
138+
run: |
139+
ansible-test integration -v --color --coverage --python ${{ env.python-version }} regression-${{ matrix.VERSION }}
133140
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
134141

135-
- name: Run integration tests
142+
- name: Run integration tests
136143
run: |
137144
ansible-test integration -v --color --coverage --python ${{ env.python-version }} ${{ matrix.VERSION }}
138145
ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
'${{ needs.unit-galaxy.result }}',
4848
'${{ needs.unit-source.result }}',
4949
'${{ needs.ansible-lint.result }}'
50-
])"
50+
])"

.yamllint.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
extends: default
3+
4+
# see rules at https://yamllint.readthedocs.io/en/latest/rules.html
5+
ignore: |
6+
- .cache/
7+
- .venv/
8+
- .github/
9+
10+
rules:
11+
braces:
12+
max-spaces-inside: 20
13+
level: error
14+
brackets:
15+
max-spaces-inside: 20
16+
level: error
17+
colons:
18+
max-spaces-before: 1
19+
max-spaces-after: 20
20+
level: error
21+
commas:
22+
max-spaces-before: 50
23+
min-spaces-after: 1
24+
max-spaces-after: 20
25+
level: error
26+
comments:
27+
min-spaces-from-content: 1
28+
comments-indentation: disable
29+
document-start:
30+
present: true
31+
empty-lines:
32+
max: 3
33+
level: error
34+
hyphens:
35+
level: error
36+
indentation:
37+
spaces: 2
38+
indent-sequences: whatever
39+
check-multi-line-strings: false
40+
key-duplicates: enable
41+
line-length:
42+
max: 230
43+
level: warning
44+
allow-non-breakable-words: true
45+
allow-non-breakable-inline-mappings: true
46+
new-line-at-end-of-file: enable
47+
new-lines:
48+
type: unix
49+
trailing-spaces: enable
50+
truthy: disable
51+
octal-values:
52+
forbid-explicit-octal: true

changelogs/changelog.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
ancestor: null
23
releases:
34
0.1.0:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
minor_changes:
23
- Change `netbox_contact.contact_group` to `contact_groups`
34
- Add integration tests for contact groups
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
---
12
minor_changes:
23
- Add support for custom headers for all modules
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
---
12
bugfixes:
23
- Fix task duplicate task name in documentation that cause ansible-lint error
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
---
12
bugfixes:
23
- nb_inventory - Fix service collection for version greater than 4.3

changelogs/fragments/1439-fix-sevral-bug-discovered-by-integration-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
bugfixes:
23
- Add netbox version check to support service creation for netbox version prior of 4.3
34
- Use dedicated function to check netbox version istead of self.full_version for rack.

0 commit comments

Comments
 (0)