Skip to content

Commit 7755634

Browse files
authored
Merge pull request #821 from nautobot/release-3.8.0
2 parents 5acda21 + a3212ec commit 7755634

Some content is hidden

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

55 files changed

+1258
-849
lines changed

.cookiecutter.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"_drift_manager": {
2222
"template": "https://github.com/nautobot/cookiecutter-nautobot-app.git",
2323
"template_dir": "nautobot-app",
24-
"template_ref": "refs/tags/nautobot-app-v2.4.2",
24+
"template_ref": "refs/tags/nautobot-app-v2.5.0",
2525
"cookie_dir": "",
2626
"branch_prefix": "drift-manager",
2727
"pull_request_strategy": "create",
@@ -30,7 +30,7 @@
3030
"poetry"
3131
],
3232
"draft": false,
33-
"baked_commit_ref": "a9ba090fb8fb08d173c3c720a6dbe92a59f4c6f8"
33+
"baked_commit_ref": "a93c33a2e5583173d90b69dbc7268ca90083a248"
3434
}
3535
}
3636
}

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
Please feel free to update todos to keep track of your own notes for WIP PRs.
2828
-->
2929
- [ ] Explanation of Change(s)
30-
- [ ] Added change log fragment(s) (for more information see [the documentation](https://docs.nautobot.com/projects/core/en/stable/development/#creating-changelog-fragments))
30+
- [ ] Added change log fragment(s) (for more information see [the documentation](https://docs.nautobot.com/projects/core/en/stable/development/core/#creating-changelog-fragments))
3131
- [ ] Attached Screenshots, Payload Example
3232
- [ ] Unit, Integration Tests
3333
- [ ] Documentation Updates (when adding/changing features)

.github/workflows/ci.yml

Lines changed: 109 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,26 @@ jobs:
8181
poetry-version: "1.8.5"
8282
- name: "Linting: yamllint"
8383
run: "poetry run invoke yamllint"
84+
markdownlint:
85+
runs-on: "ubuntu-22.04"
86+
env:
87+
INVOKE_NAUTOBOT_SSOT_LOCAL: "True"
88+
steps:
89+
- name: "Check out repository code"
90+
uses: "actions/checkout@v4"
91+
- name: "Setup environment"
92+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
93+
with:
94+
poetry-version: "1.8.5"
95+
- name: "Linting: markdownlint"
96+
run: "poetry run invoke markdownlint"
8497
check-in-docker:
8598
needs:
8699
- "ruff-format"
87100
- "ruff-lint"
88101
- "poetry"
89102
- "yamllint"
103+
- "markdownlint"
90104
runs-on: "ubuntu-22.04"
91105
strategy:
92106
fail-fast: true
@@ -111,9 +125,9 @@ jobs:
111125
run: "poetry run invoke lock --constrain-nautobot-ver --constrain-python-ver"
112126
- name: "Set up Docker Buildx"
113127
id: "buildx"
114-
uses: "docker/setup-buildx-action@v3"
128+
uses: "docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10.0
115129
- name: "Build"
116-
uses: "docker/build-push-action@v5"
130+
uses: "docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25" # v5.4.0
117131
with:
118132
builder: "${{ steps.buildx.outputs.name }}"
119133
context: "./"
@@ -127,8 +141,6 @@ jobs:
127141
NAUTOBOT_VER=${{ matrix.nautobot-version }}
128142
PYTHON_VER=${{ matrix.python-version }}
129143
CI=true
130-
- name: "Copy credentials"
131-
run: "cp development/creds.example.env development/creds.env"
132144
- name: "Linting: pylint"
133145
run: "poetry run invoke pylint"
134146
- name: "Checking: App Config"
@@ -141,7 +153,7 @@ jobs:
141153
strategy:
142154
fail-fast: true
143155
matrix:
144-
python-version: ["3.9", "3.12"]
156+
python-version: ["3.9"] # 3.12 stable is tested in unittest_report stage.
145157
db-backend: ["postgresql"]
146158
nautobot-version: ["stable"]
147159
include:
@@ -170,9 +182,60 @@ jobs:
170182
run: "poetry run invoke lock --constrain-nautobot-ver --constrain-python-ver"
171183
- name: "Set up Docker Buildx"
172184
id: "buildx"
173-
uses: "docker/setup-buildx-action@v3"
185+
uses: "docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10.0
186+
- name: "Build"
187+
uses: "docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25" # v5.4.0
188+
with:
189+
builder: "${{ steps.buildx.outputs.name }}"
190+
context: "./"
191+
push: false
192+
load: true
193+
tags: "${{ env.APP_NAME }}/nautobot:${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
194+
file: "./development/Dockerfile"
195+
cache-from: "type=gha,scope=${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
196+
cache-to: "type=gha,scope=${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
197+
build-args: |
198+
NAUTOBOT_VER=${{ matrix.nautobot-version }}
199+
PYTHON_VER=${{ matrix.python-version }}
200+
CI=true
201+
- name: "Use Mysql invoke settings when needed"
202+
run: "cp invoke.mysql.yml invoke.yml"
203+
if: "matrix.db-backend == 'mysql'"
204+
- name: "Run Tests"
205+
run: "poetry run invoke unittest"
206+
207+
unittest_report:
208+
needs:
209+
- "check-in-docker"
210+
strategy:
211+
fail-fast: true
212+
matrix:
213+
python-version: ["3.12"]
214+
db-backend: ["postgresql"]
215+
nautobot-version: ["stable"]
216+
runs-on: "ubuntu-22.04"
217+
permissions:
218+
pull-requests: "write"
219+
contents: "write"
220+
env:
221+
INVOKE_NAUTOBOT_SSOT_PYTHON_VER: "${{ matrix.python-version }}"
222+
INVOKE_NAUTOBOT_SSOT_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
223+
steps:
224+
- name: "Check out repository code"
225+
uses: "actions/checkout@v4"
226+
- name: "Setup environment"
227+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
228+
with:
229+
poetry-version: "1.8.5"
230+
- name: "Constrain Nautobot version and regenerate lock file"
231+
env:
232+
INVOKE_NAUTOBOT_SSOT_LOCAL: "true"
233+
run: "poetry run invoke lock --constrain-nautobot-ver --constrain-python-ver"
234+
- name: "Set up Docker Buildx"
235+
id: "buildx"
236+
uses: "docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10.0
174237
- name: "Build"
175-
uses: "docker/build-push-action@v5"
238+
uses: "docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25" # v5.4.0
176239
with:
177240
builder: "${{ steps.buildx.outputs.name }}"
178241
context: "./"
@@ -192,7 +255,28 @@ jobs:
192255
run: "cp invoke.mysql.yml invoke.yml"
193256
if: "matrix.db-backend == 'mysql'"
194257
- name: "Run Tests"
195-
run: "poetry run invoke unittest"
258+
run: "poetry run invoke unittest --coverage"
259+
- name: "Generate Coverage Comment"
260+
if: >
261+
contains(fromJson('["develop","ltm-1.6"]'), github.base_ref) &&
262+
(github.head_ref != 'main') && (!startsWith(github.head_ref, 'release'))
263+
id: "coverage_comment"
264+
uses: "py-cov-action/python-coverage-comment-action@d1ff8fbb5ff80feedb3faa0f6d7b424f417ad0e1" # v3.30
265+
with:
266+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
267+
MINIMUM_GREEN: 90
268+
MINIMUM_ORANGE: 80
269+
ANNOTATE_MISSING_LINES: true
270+
ANNOTATION_TYPE: "warning"
271+
- name: "Store Pull Request comment to be posted"
272+
if: >
273+
contains(fromJson('["develop","ltm-1.6"]'), github.base_ref) &&
274+
(github.head_ref != 'main') && (!startsWith(github.head_ref, 'release'))
275+
uses: "actions/upload-artifact@v4"
276+
with:
277+
name: "python-coverage-comment-action"
278+
path: "python-coverage-comment-action.txt"
279+
196280
changelog:
197281
if: >
198282
contains(fromJson('["develop","ltm-1.6"]'), github.base_ref) &&
@@ -214,41 +298,39 @@ jobs:
214298
publish_gh:
215299
needs:
216300
- "unittest"
301+
- "unittest_report"
217302
name: "Publish to GitHub"
218303
runs-on: "ubuntu-22.04"
219304
if: "startsWith(github.ref, 'refs/tags/v')"
220305
env:
221306
INVOKE_NAUTOBOT_SSOT_LOCAL: "True"
307+
permissions:
308+
contents: "write"
222309
steps:
223310
- name: "Check out repository code"
224311
uses: "actions/checkout@v4"
225-
- name: "Set up Python"
226-
uses: "actions/setup-python@v5"
312+
- name: "Setup environment"
313+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
227314
with:
315+
poetry-version: "1.8.5"
228316
python-version: "3.12"
229-
- name: "Install Python Packages"
230-
run: "pip install poetry"
317+
poetry-install-options: "--no-root"
231318
- name: "Set env"
232319
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
233320
- name: "Run Poetry Version"
234321
run: "poetry version $RELEASE_VERSION"
235-
- name: "Install Dependencies (needed for mkdocs)"
236-
run: "poetry install --no-root"
237322
- name: "Build Documentation"
238323
run: "poetry run invoke build-and-check-docs"
239324
- name: "Run Poetry Build"
240325
run: "poetry build"
241326
- name: "Upload binaries to release"
242-
uses: "svenstaro/upload-release-action@v2"
243-
with:
244-
repo_token: "${{ secrets.GH_NAUTOBOT_BOT_TOKEN }}"
245-
file: "dist/*"
246-
tag: "${{ github.ref }}"
247-
overwrite: true
248-
file_glob: true
327+
run: "gh release upload ${{ github.ref_name }} dist/*.{tar.gz,whl}"
328+
env:
329+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
249330
publish_pypi:
250331
needs:
251332
- "unittest"
333+
- "unittest_report"
252334
name: "Push Package to PyPI"
253335
runs-on: "ubuntu-22.04"
254336
if: "startsWith(github.ref, 'refs/tags/v')"
@@ -257,24 +339,22 @@ jobs:
257339
steps:
258340
- name: "Check out repository code"
259341
uses: "actions/checkout@v4"
260-
- name: "Set up Python"
261-
uses: "actions/setup-python@v5"
342+
- name: "Setup environment"
343+
uses: "networktocode/gh-action-setup-poetry-environment@v6"
262344
with:
345+
poetry-version: "1.8.5"
263346
python-version: "3.12"
264-
- name: "Install Python Packages"
265-
run: "pip install poetry"
347+
poetry-install-options: "--no-root"
266348
- name: "Set env"
267349
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
268350
- name: "Run Poetry Version"
269351
run: "poetry version $RELEASE_VERSION"
270-
- name: "Install Dependencies (needed for mkdocs)"
271-
run: "poetry install --no-root"
272352
- name: "Build Documentation"
273353
run: "poetry run invoke build-and-check-docs"
274354
- name: "Run Poetry Build"
275355
run: "poetry build"
276356
- name: "Push to PyPI"
277-
uses: "pypa/gh-action-pypi-publish@release/v1"
357+
uses: "pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc" # v1.12.4
278358
with:
279359
user: "__token__"
280360
password: "${{ secrets.PYPI_API_TOKEN }}"
@@ -295,7 +375,7 @@ jobs:
295375
# ENVs cannot be used directly in job.if. This is a workaround to check
296376
# if SLACK_WEBHOOK_URL is present.
297377
if: "env.SLACK_WEBHOOK_URL != ''"
298-
uses: "slackapi/slack-github-action@v1"
378+
uses: "slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3" # v1.27.1
299379
with:
300380
payload: |
301381
{

.github/workflows/coverage.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: "Post coverage comment"
3+
4+
on: # yamllint disable-line rule:truthy rule:comments
5+
workflow_run:
6+
workflows: ["CI"]
7+
types:
8+
- "completed"
9+
10+
jobs:
11+
test:
12+
name: "Post coverage comment to PR"
13+
runs-on: "ubuntu-latest"
14+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' # yamllint disable-line rule:quoted-strings rule:comments
15+
permissions:
16+
# Gives the action the necessary permissions for publishing new
17+
# comments in pull requests.
18+
pull-requests: "write"
19+
# Gives the action the necessary permissions for editing existing
20+
# comments (to avoid publishing multiple comments in the same PR)
21+
contents: "write" # yamllint disable-line rule:indentation rule:comments
22+
# Gives the action the necessary permissions for looking up the
23+
# workflow that launched this workflow, and download the related
24+
# artifact that contains the comment to be published
25+
actions: "read"
26+
steps:
27+
# DO NOT run actions/checkout here, for security reasons
28+
# For details, refer to https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
29+
- name: "Post comment"
30+
uses: "py-cov-action/python-coverage-comment-action@d1ff8fbb5ff80feedb3faa0f6d7b424f417ad0e13" # v3.30
31+
with:
32+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
33+
GITHUB_PR_RUN_ID: "${{ github.event.workflow_run.id }}"
34+
# Update those if you changed the default values:
35+
# COMMENT_ARTIFACT_NAME: python-coverage-comment-action
36+
# COMMENT_FILENAME: python-coverage-comment-action.txt

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ coverage.xml
5656
*.py,cover
5757
.hypothesis/
5858
.pytest_cache/
59+
lcov.info
5960

6061
# Translations
6162
*.mo

development/creds.example.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ NAUTOBOT_APIC_VERIFY_DEVNET=False
5353

5454
SERVICENOW_PASSWORD="changeme"
5555

56-
IPFABRIC_API_TOKEN=secrettoken
56+
NAUTOBOT_SSOT_IPFABRIC_HOST="https://demo.ipfabric.io"
57+
NAUTOBOT_SSOT_IPFABRIC_API_TOKEN=secrettoken
5758

5859
MERAKI_ORG_ID='123456'
5960
MERAKI_TOKEN='vtx01710aa0fn452740055y1hs60ns8c107ho168'

development/development.env

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ MYSQL_USER=${NAUTOBOT_DB_USER}
3838
MYSQL_DATABASE=${NAUTOBOT_DB_NAME}
3939
MYSQL_ROOT_HOST=%
4040

41+
# Use a less verbose log level for Celery Beat
42+
NAUTOBOT_BEAT_LOG_LEVEL=INFO
43+
4144
NAUTOBOT_HOST="http://nautobot:8080"
4245

4346
NAUTOBOT_CELERY_TASK_SOFT_TIME_LIMIT=7200
@@ -60,10 +63,10 @@ NAUTOBOT_SSOT_ACI_COMMENTS="Created by ACI SSoT Integration"
6063
NAUTOBOT_SSOT_ENABLE_ARISTACV="False"
6164
NAUTOBOT_ARISTACV_CONTROLLER_SITE=""
6265
NAUTOBOT_ARISTACV_CREATE_CONTROLLER="True"
63-
NAUTOBOT_ARISTACV_CVAAS_URL="www.arista.io:443"
66+
NAUTOBOT_ARISTACV_CVAAS_URL="www.cv-prod-euwest-2.arista.io"
6467
NAUTOBOT_ARISTACV_CVP_HOST=""
6568
NAUTOBOT_ARISTACV_CVP_PORT="443"
66-
NAUTOBOT_ARISTACV_CVP_USERNAME="changeme"
69+
NAUTOBOT_ARISTACV_CVP_USERNAME="networktocode"
6770
NAUTOBOT_ARISTACV_DELETE_ON_SYNC="False"
6871
NAUTOBOT_ARISTACV_IMPORT_ACTIVE="False"
6972
NAUTOBOT_ARISTACV_IMPORT_TAG="False"
@@ -108,9 +111,9 @@ SERVICENOW_INSTANCE=""
108111
SERVICENOW_USERNAME=""
109112

110113
NAUTOBOT_SSOT_ENABLE_IPFABRIC="False"
111-
IPFABRIC_HOST="https://ipfabric.example.com"
112-
IPFABRIC_SSL_VERIFY="True"
113-
IPFABRIC_TIMEOUT=15
114+
NAUTOBOT_SSOT_IPFABRIC_HOST="https://ipfabric.example.com"
115+
NAUTOBOT_SSOT_IPFABRIC_SSL_VERIFY="True"
116+
NAUTOBOT_SSOT_IPFABRIC_TIMEOUT=15
114117

115118
NAUTOBOT_SSOT_ENABLE_ITENTIAL="True"
116119

@@ -123,4 +126,3 @@ NAUTOBOT_SSOT_LIBRENMS_SYSTEM_OF_RECORD="LibreNMS"
123126
NAUTOBOT_SSOT_LIBRENMS_HOSTNAME_FIELD="sysName" # hostname or sysName
124127

125128
NAUTOBOT_SSOT_ENABLE_SOLARWINDS="False"
126-

development/docker-compose.base.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ services:
4141
beat:
4242
entrypoint:
4343
- "sh"
44-
- "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env
45-
- "nautobot-server celery beat -l $$NAUTOBOT_LOG_LEVEL" ## $$ because of docker-compose
44+
- "-c" # this is to evaluate the $NAUTOBOT_BEAT_LOG_LEVEL from the env
45+
- "nautobot-server celery beat -l $$NAUTOBOT_BEAT_LOG_LEVEL" ## $$ because of docker-compose
4646
depends_on:
4747
nautobot:
4848
condition: "service_healthy"

development/docker-compose.dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ services:
4040
beat:
4141
entrypoint:
4242
- "sh"
43-
- "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env
44-
- "watchmedo auto-restart --directory './' --pattern '*.py' --recursive -- nautobot-server celery beat -l $$NAUTOBOT_LOG_LEVEL" ## $$ because of docker-compose
43+
- "-c" # this is to evaluate the $NAUTOBOT_BEAT_LOG_LEVEL from the env
44+
- "watchmedo auto-restart --directory './' --pattern '*.py' --recursive -- nautobot-server celery beat -l $$NAUTOBOT_BEAT_LOG_LEVEL" ## $$ because of docker-compose
4545
volumes:
4646
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
4747
- "../:/source"

development/docker-compose.mysql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
- "creds.env"
2323
- "development_mysql.env"
2424
db:
25-
image: "mysql:8"
25+
image: "mysql:lts"
2626
command:
2727
- "--max_connections=1000"
2828
env_file:

0 commit comments

Comments
 (0)