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

Cookie initialy baked by NetworkToCode Cookie Drift Manager Tool #583

Merged
merged 9 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion .bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# No need to check for security issues in the test scripts!
exclude_dirs:
- "./nautobot_golden_config/tests/"

- "./.venv/"
skips:
- "B404"
33 changes: 33 additions & 0 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"cookiecutter": {
"codeowner_github_usernames": "@itdependsnetworks @jeffkala @nkallergis",
"full_name": "Network to Code, LLC",
"email": "[email protected]",
"github_org": "nautobot",
"plugin_name": "nautobot_golden_config",
"verbose_name": "Golden Config",
"plugin_slug": "nautobot-golden-config",
"project_slug": "nautobot-plugin-golden-config",
"repo_url": "https://github.com/nautobot/nautobot-plugin-golden-config",
"base_url": "golden-config",
"min_nautobot_version": "1.4.0",
"max_nautobot_version": "1.9999",
"nautobot_version": "latest",
"camel_name": "NautobotGoldenConfig",
"project_short_description": "A plugin for configuration on nautobot",
"version": "1.0.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/golden-config/en/latest",
"_drift_manager": {
"template": "https://github.com/nautobot/cookiecutter-nautobot-app.git",
"template_dir": "nautobot-app",
"template_ref": "develop",
"cookie_dir": "",
"branch_prefix": "drift-manager",
"pull_request_strategy": "create",
"post_actions": []
}
}
}
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Docker related
development/Dockerfile
development/docker-compose*.yml
development/*.env
*.env
environments/

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


# Other
docs/_build
FAQ.md
.git/
.gitignore
.github
tasks.py
LICENSE
**/*.log
**/.vscode/
invoke*.yml
tasks.py
17 changes: 14 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
[flake8]
# 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, F811, F401, F405, E203
ignore =
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
# TODO: Review the following rules, not in the template
F811,
F401,
F405,
E203,
exclude =
migrations,
__pycache__,
manage.py,
settings.py,
.venv
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Default owners for all files in this repository
# Default owner(s) of all files in this repository
* @itdependsnetworks @jeffkala @nkallergis
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ about: Report a reproducible bug in the current release of nautobot-golden-confi

### Environment
* Python version: <!-- Example: 3.7.7 -->
* Nautobot version: <!-- Example: 1.0.1 -->
* Nautobot version: <!-- Example: 1.4.0 -->
* nautobot-golden-config version: <!-- Example: 1.0.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.
Expand All @@ -16,10 +23,3 @@ about: Report a reproducible bug in the current release of nautobot-golden-confi
1.
2.
3.

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


<!-- What happened instead? -->
### Observed Behavior
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
name: ✨ Feature Request
about: Propose a new feature or enhancement

---

### Environment
* Python version: <!-- Example: 3.7.7 -->
* Nautobot version: <!-- Example: 1.0.1 -->
* Nautobot version: <!-- Example: 1.4.0 -->
* nautobot-golden-config version: <!-- Example: 1.0.0 -->

<!--
Expand Down
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
28 changes: 17 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
name: "CI"
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:
Expand All @@ -10,6 +13,8 @@ on: # yamllint disable-line rule:truthy rule:comments
pull_request: ~

env:
# TODO Fix to be repository name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we go to 2.0, this makes sense to fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

# PLUGIN_NAME: "nautobot-plugin-golden-config"
PLUGIN_NAME: "nautobot-golden-config"

jobs:
Expand All @@ -19,7 +24,7 @@ jobs:
INVOKE_NAUTOBOT_GOLDEN_CONFIG_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@v4"
- name: "Linting: black"
Expand All @@ -30,7 +35,7 @@ jobs:
INVOKE_NAUTOBOT_GOLDEN_CONFIG_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@v4"
- name: "Linting: bandit"
Expand All @@ -41,7 +46,7 @@ jobs:
INVOKE_NAUTOBOT_GOLDEN_CONFIG_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@v4"
- name: "Linting: pydocstyle"
Expand All @@ -52,7 +57,7 @@ jobs:
INVOKE_NAUTOBOT_GOLDEN_CONFIG_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@v4"
- name: "Linting: flake8"
Expand All @@ -63,7 +68,7 @@ jobs:
INVOKE_NAUTOBOT_GOLDEN_CONFIG_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@v4"
- name: "Linting: yamllint"
Expand All @@ -86,7 +91,7 @@ jobs:
INVOKE_NAUTOBOT_GOLDEN_CONFIG_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@v4"
- name: "Set up Docker Buildx"
Expand Down Expand Up @@ -138,7 +143,7 @@ jobs:
INVOKE_NAUTOBOT_GOLDEN_CONFIG_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@v4"
- name: "Set up Docker Buildx"
Expand Down Expand Up @@ -173,7 +178,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 @@ -202,7 +207,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 @@ -226,7 +231,7 @@ jobs:
- "publish_pypi"
runs-on: "ubuntu-20.04"
env:
SLACK_WEBHOOK_URL: "${{ '{{ secrets.SLACK_WEBHOOK_URL }}' }}"
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
SLACK_MESSAGE: >-
*NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
Expand All @@ -236,11 +241,12 @@ jobs:
- 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 != '' }}"
if: "env.SLACK_WEBHOOK_URL != ''"
uses: "slackapi/[email protected]"
with:
payload: |
{
"text": "${{ env.SLACK_MESSAGE }}",
"blocks": [
{
"type": "section",
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/rebake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: "Rebake Cookie"
on: # yamllint disable-line rule:truthy
schedule:
# Every Saturday at 5:00 am UTC
- cron: "0 5 * * 6"
workflow_dispatch:
inputs:
template-ref:
description: "The branch or tag to use for the template, using the value from .cookiecutter.json when empty"
default: ""
jobs:
rebake:
runs-on: "ubuntu-22.04"
permissions:
actions: "write"
contents: "write"
packages: "read"
pull-requests: "write"
container: "ghcr.io/nautobot/cookiecutter-nautobot-app-drift-manager/prod:latest"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
- name: "Configure"
id: "config"
run: |
export REBAKE_ARGS='--push'
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
export REBAKE_ARGS="$REBAKE_ARGS --template-ref='${{ github.event.inputs.template-ref }}'"
fi
echo "rebake-args='$REBAKE_ARGS'" >> $GITHUB_OUTPUT
- name: "Rebake"
run: |
python -m ntc_cookie_drift_manager rebake ${{ steps.config.outputs.rebake-args }} '${{ github.repositoryUrl }}'
6 changes: 4 additions & 2 deletions .github/workflows/upstream_testing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "Nautobot Upstream Testing"
name: "Nautobot Upstream Monitor"

on: # yamllint disable-line rule:truthy rule:comments
on: # yamllint disable-line rule:truthy rule:comments
itdependsnetworks marked this conversation as resolved.
Show resolved Hide resolved
schedule:
- cron: "0 4 */2 * *" # every other day at midnight

Expand All @@ -10,4 +10,6 @@ jobs:
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_GOLDEN_CONFIG"
# TODO Fix to be repository name
# plugin_name: "nautobot-plugin-golden-config"
plugin_name: "nautobot-golden-config"
24 changes: 13 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# Specific ignores
nautobot_backup.dump
.creds.env
creds.env
nautobot_golden_config/transposer.py
docker-compose.override.yml
packages/
invoke.yml

# Ansible Retry Files
*.retry
Expand Down Expand Up @@ -201,9 +194,6 @@ $RECYCLE.BIN/
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# Jetbrains IDE configs
.idea/

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
Expand Down Expand Up @@ -305,4 +295,16 @@ fabric.properties

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

# Rando
creds.env
development/*.txt

# Invoke overrides
invoke.yml

# Docs
public
/compose.yaml
/dump.sql
5 changes: 4 additions & 1 deletion .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
extends: "default"
rules:
comments: "enable"
empty-values: "enable"
empty-values: "disable"
indentation:
indent-sequences: "consistent"
line-length: "disable"
quoted-strings:
quote-type: "double"
ignore: |
.venv/
compose.yaml
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Apache Software License 2.0

Copyright (c) 2021, Network to Code, LLC
Copyright (c) 2023, Network to Code, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading
Loading