Skip to content

Commit 0547482

Browse files
authored
Merge pull request #595 from netbox-community/devel
Catch up Master (D2M)
2 parents 65f1f38 + 3679960 commit 0547482

File tree

403 files changed

+38328
-3130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+38328
-3130
lines changed

.github/workflows/main.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: All CI related tasks
2+
3+
# Run this workflow every time a new commit pushed to your repository
4+
on: [push, pull_request]
5+
6+
jobs:
7+
linting_unit_testing:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
python-version: [3.6, 3.7, 3.8, 3.9]
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v2
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install and configure Poetry
21+
uses: snok/install-poetry@v1.1.1
22+
with:
23+
virtualenvs-create: false
24+
- name: Install Python packages
25+
run: poetry install
26+
- name: Build and install collection
27+
run: |
28+
ansible-galaxy collection build .
29+
ansible-galaxy collection install netbox*.tar.gz -p /home/runner/.ansible/collections
30+
- name: Run Black
31+
run: black . --check --diff
32+
- name: Run Ansible Sanity tests
33+
run: ansible-test sanity -v --requirements --python ${{ matrix.python-version }} --skip-test pep8 plugins/
34+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
35+
- name: Run Ansible Unit tests
36+
run: ansible-test units -vvv --coverage --python ${{ matrix.python-version }}
37+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
38+
- name: Run Ansible Coverage
39+
run: ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing
40+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
41+
integration:
42+
runs-on: ubuntu-latest
43+
needs: linting_unit_testing
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
include:
48+
- python-version: 3.6
49+
VERSION: "v2.10"
50+
INTEGRATION_TESTS: "v2.10"
51+
- python-version: 3.6
52+
VERSION: "v2.11"
53+
INTEGRATION_TESTS: "v2.11"
54+
#- python-version: 3.6
55+
# VERSION: "v3.0"
56+
# INTEGRATION_TESTS: "v3.0"
57+
steps:
58+
- name: Checkout repo
59+
uses: actions/checkout@v2
60+
- name: Set up Python ${{ matrix.python-version }}
61+
uses: actions/setup-python@v2
62+
with:
63+
python-version: ${{ matrix.python-version }}
64+
- name: Clone & Start netbox-docker containers - 2.10
65+
env:
66+
VERSION: ${{ matrix.VERSION }}
67+
run: |
68+
cd ..
69+
git clone https://github.com/netbox-community/netbox-docker.git
70+
cd netbox-docker
71+
git checkout 1.1.0
72+
tee docker-compose.override.yml <<EOF
73+
version: '3.4'
74+
services:
75+
netbox:
76+
image: netboxcommunity/netbox:v2.10
77+
ports:
78+
- 32768:8080
79+
EOF
80+
docker-compose up -d --quiet-pull
81+
docker container ls
82+
cd ..
83+
if: matrix.VERSION == 'v2.10'
84+
- name: Clone & Start netbox-docker containers - 2.11
85+
env:
86+
VERSION: ${{ matrix.VERSION }}
87+
run: |
88+
cd ..
89+
git clone https://github.com/netbox-community/netbox-docker.git
90+
cd netbox-docker
91+
git checkout 1.2.0
92+
tee docker-compose.override.yml <<EOF
93+
version: '3.4'
94+
services:
95+
netbox:
96+
image: netboxcommunity/netbox:v2.11
97+
ports:
98+
- 32768:8080
99+
EOF
100+
docker-compose up -d --quiet-pull
101+
docker container ls
102+
cd ..
103+
if: matrix.VERSION == 'v2.11'
104+
- name: Clone & Start netbox-docker containers - 3.0
105+
env:
106+
VERSION: ${{ matrix.VERSION }}
107+
run: |
108+
cd ..
109+
git clone https://github.com/netbox-community/netbox-docker.git
110+
cd netbox-docker
111+
git checkout 1.3.1
112+
tee docker-compose.override.yml <<EOF
113+
version: '3.4'
114+
services:
115+
netbox:
116+
image: netboxcommunity/netbox:v3.0
117+
ports:
118+
- 32768:8080
119+
EOF
120+
docker-compose up -d --quiet-pull
121+
docker container ls
122+
cd ..
123+
if: matrix.VERSION == 'v3.0'
124+
- name: Install and configure Poetry
125+
uses: snok/install-poetry@v1.1.1
126+
with:
127+
virtualenvs-create: false
128+
- name: Install Python packages
129+
run: poetry install
130+
- name: Build and install collection
131+
run: |
132+
ansible-galaxy collection install community.general -p /home/runner/.ansible/collections
133+
ansible-galaxy collection build .
134+
ansible-galaxy collection install netbox*.tar.gz -p /home/runner/.ansible/collections
135+
- name: Wait for NetBox to be available
136+
run: |
137+
docker container ls
138+
docker logs netbox-docker_netbox_1
139+
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:32768)" != "200" ]]; do echo "waiting for Netbox"; sleep 5; done' || false
140+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
141+
- name: Pre-populate NetBox
142+
run: ./tests/integration/netbox-deploy.py
143+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
144+
- name: Allow scripts to be executed
145+
# Set runme.sh execute permissions stripped by ansible-galaxy. Should be fixed in Ansible 2.10
146+
# https://github.com/ansible/ansible/issues/68415
147+
# Run render_config.sh to pass environment variables to integration tests
148+
# https://www.ansible.com/blog/adding-integration-tests-to-ansible-content-collections
149+
run: |
150+
chmod +x tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/runme.sh
151+
chmod +x tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/compare_inventory_json.py
152+
chmod +x tests/integration/render_config.sh
153+
tests/integration/render_config.sh tests/integration/targets/inventory/runme_config.template > tests/integration/targets/inventory-${{ matrix.INTEGRATION_TESTS }}/runme_config
154+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
155+
- name: Run integration tests
156+
# Run regression and integration tests
157+
# Run the inventory test first, in case any of the other tests modify the data.
158+
run: |
159+
ansible-test integration -v --coverage --python ${{ matrix.python-version }} inventory-${{ matrix.INTEGRATION_TESTS }}
160+
ansible-test integration -v --coverage --python ${{ matrix.python-version }} regression-${{ matrix.INTEGRATION_TESTS }}
161+
ansible-test integration -v --coverage --python ${{ matrix.python-version }} ${{ matrix.INTEGRATION_TESTS }}
162+
ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing
163+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Deploy collection to Ansible Galaxy
2+
on:
3+
create:
4+
tags:
5+
- "v*"
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repo
11+
uses: actions/checkout@v2
12+
- name: Set up Python 3.6
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.6
16+
- name: Install ansible-core to deploy collection
17+
run: pip install ansible-core
18+
- name: Build and Deploy Collection
19+
uses: artis3n/ansible_galaxy_collection@v2
20+
with:
21+
api_key: "${{ secrets.GALAXY_API_KEY }}"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ __pycache__/
44
tests/output/*
55
venv/
66
.vscode/
7+
changelogs/.plugin-cache.yaml
78
docs/_build/*
9+
.python-version
810

911
# https://github.com/ansible/ansible/issues/68499
1012
# ansible_collections/

.readthedocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2
2-
sphinx:
3-
configuration: docs/conf.py
2+
#sphinx:
3+
# configuration: docs/conf.py
44

55
python:
66
version: 3.6

.travis.yml

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)