Skip to content

Commit

Permalink
Merge pull request #203 from nautobot/next-env
Browse files Browse the repository at this point in the history
Next env
  • Loading branch information
itdependsnetworks authored Feb 28, 2024
2 parents 797445c + adcfbbc commit c81c62b
Show file tree
Hide file tree
Showing 104 changed files with 5,075 additions and 3,956 deletions.
7 changes: 5 additions & 2 deletions .bandit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
skips: ["B308", "B703"]
skips:
- "B703"
- "B308"
# No need to check for security issues in the test scripts!
exclude_dirs:
- "./tests/"
- "./nautobot_version_control/tests/"
- "./.venv/"
25 changes: 25 additions & 0 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"cookiecutter": {
"codeowner_github_usernames": "@smith-ntc",
"full_name": "Network to Code, LLC",
"email": "[email protected]",
"github_org": "nautobot",
"plugin_name": "nautobot_version_control",
"verbose_name": "Nautobot Version Control",
"plugin_slug": "nautobot-version-control",
"project_slug": "nautobot-plugin-version-control",
"repo_url": "https://github.com/nautobot/nautobot-plugin-version-control",
"base_url": "nautobot-version-control",
"min_nautobot_version": "1.5.3",
"max_nautobot_version": "1.9999",
"nautobot_version": "latest",
"camel_name": "NautobotVersionControl",
"project_short_description": "Nautobot Version Control",
"version": "0.1.0",
"model_class_name": "None",
"open_source_license": "Apache-2.0",
"docs_base_url": "https://docs.nautobot.com",
"docs_app_url": "https://docs.nautobot.com/projects/nautobot-version-control/en/latest",
"_template": "../cookiecutter-ntc/nautobot-plugin"
}
}
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ development/Dockerfile
development/docker-compose*.yml
development/*.env
*.env
environments/

# Python
**/*.pyc
**/*.pyo
**/__pycache__/
**/.pytest_cache/
**/.venv/


# Other
Expand All @@ -18,3 +22,6 @@ FAQ.md
tasks.py
LICENSE
**/*.log
**/.vscode/
invoke*.yml
tasks.py
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
# E501: Line length is enforced by Black, so flake8 doesn't need to check it
# W503: Black disagrees with this rule, as does PEP 8; Black wins
ignore = E501, W503
exclude =
migrations,
__pycache__,
manage.py,
settings.py,
.venv
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Default owner(s) of all files in this repository
* @smith-ntc
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: 🐛 Bug Report
about: Report a reproducible bug in the current release of nautobot-version-control
---

### Environment
* Python version: <!-- Example: 3.7.7 -->
* Nautobot version: <!-- Example: 1.5.3 -->
* nautobot-version-control version: <!-- Example: 0.1.0 -->

<!-- What did you expect to happen? -->
### Expected Behavior


<!-- What happened instead? -->
### Observed Behavior

<!--
Describe in detail the exact steps that someone else can take to reproduce
this bug using the current release.
-->
### Steps to Reproduce
1.
2.
3.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: ✨ Feature Request
about: Propose a new feature or enhancement

---

### Environment
* Nautobot version: <!-- Example: 1.5.3 -->
* nautobot-version-control version: <!-- Example: 0.1.0 -->

<!--
Describe in detail the new functionality you are proposing.
-->
### Proposed Functionality

<!--
Convey an example use case for your proposed feature. Write from the
perspective of a user who would benefit from the proposed
functionality and describe how.
--->
### Use Case

10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## New Pull Request

Have you:
- [ ] Updated the README if necessary?
- [ ] Updated any configuration settings?
- [ ] Written a unit test?

## Change Notes

## Justification
118 changes: 57 additions & 61 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
---
name: "CI"
on: # yamllint disable
- "push"
- "pull_request"
concurrency: # Cancel any existing runs of this workflow for this same PR
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
on: # yamllint disable-line rule:truthy rule:comments
push:
branches:
- "main"
- "develop"
tags:
- "v*"
pull_request: ~

env:
PLUGIN_NAME: "nautobot-dolt"
PLUGIN_NAME: "nautobot-plugin-version-control"

jobs:
black:
Expand All @@ -14,9 +22,9 @@ jobs:
INVOKE_NAUTOBOT_VERSION_CONTROL_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Linting: black"
run: "poetry run invoke black"
bandit:
Expand All @@ -25,9 +33,9 @@ jobs:
INVOKE_NAUTOBOT_VERSION_CONTROL_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Linting: bandit"
run: "poetry run invoke bandit"
pydocstyle:
Expand All @@ -36,9 +44,9 @@ jobs:
INVOKE_NAUTOBOT_VERSION_CONTROL_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Linting: pydocstyle"
run: "poetry run invoke pydocstyle"
flake8:
Expand All @@ -47,9 +55,9 @@ jobs:
INVOKE_NAUTOBOT_VERSION_CONTROL_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Linting: flake8"
run: "poetry run invoke flake8"
yamllint:
Expand All @@ -58,32 +66,32 @@ jobs:
INVOKE_NAUTOBOT_VERSION_CONTROL_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Linting: yamllint"
run: "poetry run invoke yamllint"
pylint:
needs:
- "black"
- "bandit"
- "pydocstyle"
- "flake8"
- "yamllint"
- "black"
runs-on: "ubuntu-20.04"
strategy:
fail-fast: true
matrix:
python-version: ["3.9"]
nautobot-version: ["1.2.0"]
python-version: ["3.8"]
nautobot-version: ["1.5.3"]
env:
INVOKE_NAUTOBOT_VERSION_CONTROL_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_VERSION_CONTROL_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Set up Docker Buildx"
id: "buildx"
uses: "docker/setup-buildx-action@v1"
Expand All @@ -101,21 +109,6 @@ jobs:
build-args: |
NAUTOBOT_VER=${{ matrix.nautobot-version }}
PYTHON_VER=${{ matrix.python-version }}
- name: "List images"
run: "docker image ls"
- name: "Build"
uses: "docker/build-push-action@v2"
with:
builder: "${{ steps.buildx.outputs.name }}"
context: "./"
push: false
load: true
tags: "nautobot_version_control_dolt:latest"
file: "./development/Dockerfile-dolt"
cache-from: "type=gha,scope=dolt"
cache-to: "type=gha,scope=dolt"
- name: "Display images"
run: "docker image ls"
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Linting: pylint"
Expand All @@ -126,17 +119,24 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
nautobot-version: ["1.2.0-beta.1"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
nautobot-version: ["stable"]
include:
- python-version: "3.10"
nautobot-version: "1.5.3"
- python-version: "3.7"
nautobot-version: "1.5.3"
- python-version: "3.10"
nautobot-version: "stable"
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_VERSION_CONTROL_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_VERSION_CONTROL_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
uses: "networktocode/gh-action-setup-poetry-environment@v4"
- name: "Set up Docker Buildx"
id: "buildx"
uses: "docker/setup-buildx-action@v1"
Expand All @@ -154,25 +154,10 @@ jobs:
build-args: |
NAUTOBOT_VER=${{ matrix.nautobot-version }}
PYTHON_VER=${{ matrix.python-version }}
- name: "List images"
run: "docker image ls"
- name: "Build"
uses: "docker/build-push-action@v2"
with:
builder: "${{ steps.buildx.outputs.name }}"
context: "./"
push: false
load: true
tags: "nautobot_version_control_dolt:latest"
file: "./development/Dockerfile-dolt"
cache-from: "type=gha,scope=dolt"
cache-to: "type=gha,scope=dolt"
- name: "Display images"
run: "docker image ls"
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Run Tests"
run: "poetry run invoke unittest"
run: "poetry run invoke unittest --keepdb"
publish_gh:
needs:
- "unittest"
Expand All @@ -181,7 +166,7 @@ jobs:
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
Expand Down Expand Up @@ -210,7 +195,7 @@ jobs:
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v3"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
Expand All @@ -232,23 +217,34 @@ jobs:
needs:
- "publish_gh"
- "publish_pypi"
name: "Send notification to the Slack"
runs-on: "ubuntu-20.04"
env:
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
SLACK_MESSAGE: >-
*NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
Repository: <${{ github.server_url }}}/${{ github.repository }}|${{ github.repository }}>\n
Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
Release: <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>\n
Published by: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>
steps:
- name: "Send a notification to Slack"
# ENVs cannot be used directly in job.if. This is a workaround to check
# if SLACK_WEBHOOK_URL is present.
if: "${{ env.SLACK_WEBHOOK_URL != '' }}"
uses: "slackapi/slack-github-action@v1.16.0"
if: "env.SLACK_WEBHOOK_URL != ''"
uses: "slackapi/slack-github-action@v1.17.0"
with:
payload: '{ "type": "mrkdwn", "text": "${{ env.SLACK_MESSAGE }}" }' # yamllint disable-line rule:quoted-strings
payload: |
{
"text": "${{ env.SLACK_MESSAGE }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ env.SLACK_MESSAGE }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
SLACK_WEBHOOK_TYPE: "INCOMING_WEBHOOK"
13 changes: 13 additions & 0 deletions .github/workflows/upstream_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: "Nautobot Upstream Monitor"

on: # yamllint disable-line rule:truthy rule:comments
schedule:
- cron: "0 4 */2 * *" # every other day at midnight

jobs:
upstream-test:
uses: "nautobot/nautobot/.github/workflows/plugin_upstream_testing_base.yml@develop"
with: # Below could potentially be collapsed into a single argument if a concrete relationship between both is enforced
invoke_context_name: "NAUTOBOT_VERSION_CONTROL"
plugin_name: "nautobot-plugin-version-control"
Loading

0 comments on commit c81c62b

Please sign in to comment.