Skip to content

Commit

Permalink
Merge pull request #110 from nautobot/next-2.0
Browse files Browse the repository at this point in the history
Next 2.0 to develop
  • Loading branch information
HanlinMiao authored Sep 29, 2023
2 parents 5acedaf + 301f028 commit 792cad8
Show file tree
Hide file tree
Showing 31 changed files with 2,746 additions and 1,466 deletions.
58 changes: 28 additions & 30 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
{
"cookiecutter": {
"codeowner_github_usernames": "@smith-ntc",
"full_name": "Network to Code, LLC",
"email": "[email protected]",
"github_org": "nautobot",
"base_name": "secrets_providers",
"plugin_name": "nautobot_secrets_providers",
"verbose_name": "Nautobot's Secrets Providers Plugin",
"plugin_slug": "nautobot-secrets-providers",
"project_slug": "nautobot-plugin-secrets-providers",
"repo_url": "https://github.com/nautobot/nautobot-plugin-secrets-providers",
"base_url": "secrets-providers",
"min_nautobot_version": "1.4.0",
"max_nautobot_version": "1.9999",
"nautobot_version": "latest",
"camel_name": "NautobotSecretsProviders",
"project_short_description": "Nautobot's Secrets Providers Plugin",
"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/secrets-providers/en/latest",
"_template_directory": "nautobot-plugin",
"_drift_manager": {
"template": "https://github.com/networktocode-llc/cookiecutter-ntc.git",
"template_dir": "nautobot-plugin",
"template_ref": "nautobot-plugin-v1.0",
"cookie_dir": "",
"branch_prefix": "drift-manager"
"cookiecutter": {
"codeowner_github_usernames": "@smith-ntc",
"full_name": "Network to Code, LLC",
"email": "[email protected]",
"github_org": "nautobot",
"plugin_name": "nautobot_secrets_providers",
"verbose_name": "Nautobot's Secrets Providers Plugin",
"plugin_slug": "nautobot-secrets-providers",
"project_slug": "nautobot-plugin-secrets-providers",
"repo_url": "https://github.com/nautobot/nautobot-plugin-secrets-providers",
"base_url": "secrets-providers",
"min_nautobot_version": "1.4.0",
"max_nautobot_version": "1.9999",
"nautobot_version": "latest",
"camel_name": "NautobotSecretsProviders",
"project_short_description": "Nautobot's Secrets Providers Plugin",
"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/secrets-providers/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"
}
}
}
}
6 changes: 3 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[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
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
exclude =
migrations,
__pycache__,
Expand Down
43 changes: 18 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on: # yamllint disable-line rule:truthy rule:comments
branches:
- "main"
- "develop"
- "next-2.0"
tags:
- "v*"
pull_request: ~
Expand All @@ -22,7 +23,7 @@ jobs:
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_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 @@ -33,7 +34,7 @@ jobs:
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_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 @@ -44,7 +45,7 @@ jobs:
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_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 @@ -55,7 +56,7 @@ jobs:
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_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 @@ -66,30 +67,30 @@ jobs:
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_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"
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.8"]
nautobot-version: ["1.4.0"]
nautobot-version: ["2.0.0"]
env:
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_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 @@ -119,26 +120,18 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10"]
db-backend: ["postgresql"]
nautobot-version: ["stable"]
include:
- python-version: "3.10"
db-backend: "postgresql"
nautobot-version: "1.4.0"
- python-version: "3.8"
db-backend: "mysql"
nautobot-version: "1.4.0"
- python-version: "3.10"
db-backend: "mysql"
nautobot-version: "stable"
# TBD: Fix tested versions
# python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8"]
nautobot-version: ["2.0.0"]
db-backend: ["postgresql", "mysql"]
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_SECRETS_PROVIDERS_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 +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 All @@ -189,7 +182,7 @@ jobs:
- name: "Upload binaries to release"
uses: "svenstaro/upload-release-action@v2"
with:
repo_token: "${{ secrets.NTC_GITHUB_TOKEN }}"
repo_token: "${{ secrets.NTC_GITHUB_TOKEN }}" # use GH_NAUTOBOT_BOT_TOKEN for Nautobot Org repos.
file: "dist/*"
tag: "${{ github.ref }}"
overwrite: true
Expand All @@ -202,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 Down
2 changes: 1 addition & 1 deletion .github/workflows/upstream_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Nautobot Upstream Monitor"

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

jobs:
upstream-test:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,5 @@ invoke.yml
docs/README.md
docs/CHANGELOG.md
public
/compose.yaml
/dump.sql
1 change: 1 addition & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ rules:
quote-type: "double"
ignore: |
.venv/
compose.yaml
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Nautobot Secrets Providers Changelog

## v2.0.0 (TBD)

### Changed

- [#105](https://github.com/nautobot/nautobot-plugin-secrets-providers/pull/106) Updated `nautobot` to `2.0`.

### Removed

- [#105](https://github.com/nautobot/nautobot-plugin-secrets-providers/pull/106) Removed `slug` field from `Secret` model. Can be replaced with `name` field or [natural keys](https://docs.nautobot.com/projects/core/en/next/development/apps/migration/model-updates/global/#replace-the-usage-of-slugs-with-composite-keys).

## v1.4.0 (2023-04-19)

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nautobot Secrets Providers

Nautobot Secrets Providers is a plugin for [Nautobot](https://github.com/nautobot/nautobot) 1.2.0 or higher that bundles Secrets Providers for integrating with popular secrets backends. Nautobot 1.2.0 added support for integrating with retrieving secrets from various secrets providers.
Nautobot Secrets Providers is a plugin for [Nautobot](https://github.com/nautobot/nautobot) 1.4.0 or higher that bundles Secrets Providers for integrating with popular secrets backends. Nautobot 1.4.0 added support for integrating with retrieving secrets from various secrets providers.

This plugin publishes secrets providers that are not included in the within the Nautobot core software package so that it will be easier to maintain and extend support for various secrets providers without waiting on Nautobot software releases.

Expand Down
4 changes: 2 additions & 2 deletions development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# -------------------------------------------------------------------------------------
# !!! USE CAUTION WHEN MODIFYING LINES BELOW

# Accepts a desired Nautobot version as build argument, default to 1.4
ARG NAUTOBOT_VER="1.4"
# Accepts a desired Nautobot version as build argument, default to `2.0.0`
ARG NAUTOBOT_VER="2.0.0"

# Accepts a desired Python version as build argument, default to 3.8
ARG PYTHON_VER="3.8"
Expand Down
2 changes: 1 addition & 1 deletion development/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ services:
db:
condition: "service_healthy"
<<:
- *nautobot-build
- *nautobot-base
- *nautobot-build
worker:
entrypoint:
- "sh"
Expand Down
4 changes: 4 additions & 0 deletions development/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ services:
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
healthcheck:
test: ["CMD", "true"] # Due to layering, disable: true won't work. Instead, change the test
docs:
entrypoint: "mkdocs serve -v -a 0.0.0.0:8080"
ports:
Expand All @@ -30,6 +32,8 @@ services:
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
healthcheck:
test: ["CMD", "true"] # Due to layering, disable: true won't work. Instead, change the test
# To expose postgres or redis to the host uncomment the following
# postgres:
# ports:
Expand Down
8 changes: 7 additions & 1 deletion development/docker-compose.mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ services:
image: "mysql:8"
command:
- "--default-authentication-plugin=mysql_native_password"
- "--max_connections=1000"
env_file:
- "development.env"
- "creds.env"
- "development_mysql.env"
volumes:
- "mysql_data:/var/lib/mysql"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
test:
- "CMD"
- "mysqladmin"
- "ping"
- "-h"
- "localhost"
timeout: "20s"
retries: 10
volumes:
Expand Down
3 changes: 3 additions & 0 deletions development/docker-compose.postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ services:
- "NAUTOBOT_DB_ENGINE=django.db.backends.postgresql"
db:
image: "postgres:13-alpine"
command:
- "-c"
- "max_connections=200"
env_file:
- "development.env"
- "creds.env"
Expand Down
34 changes: 21 additions & 13 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
"""Nautobot development configuration file."""
# pylint: disable=invalid-envvar-default
import os
import sys

from nautobot.core.settings import * # noqa: F403
from nautobot.core.settings_funcs import is_truthy, parse_redis_connection
from django.core.exceptions import ImproperlyConfigured
from nautobot.core.settings import * # noqa: F403 # pylint: disable=wildcard-import,unused-wildcard-import
from nautobot.core.settings_funcs import parse_redis_connection, is_truthy

# Enforce required configuration parameters
for key in [
"NAUTOBOT_ALLOWED_HOSTS",
"NAUTOBOT_SECRET_KEY",
"POSTGRES_DB",
"POSTGRES_PASSWORD",
"POSTGRES_USER",
]:
if not os.environ.get(key):
raise ImproperlyConfigured(f"Required environment variable {key} is missing.")

#
# Misc. settings
Expand Down Expand Up @@ -45,24 +56,21 @@
# Debug
#

DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", True))

# Django Debug Toolbar
DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": lambda _request: DEBUG and not TESTING}
DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", False))
TESTING = len(sys.argv) > 1 and sys.argv[1] == "test"

if DEBUG and "debug_toolbar" not in INSTALLED_APPS: # noqa: F405
INSTALLED_APPS.append("debug_toolbar") # noqa: F405
if DEBUG and "debug_toolbar.middleware.DebugToolbarMiddleware" not in MIDDLEWARE: # noqa: F405
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405
if DEBUG and not TESTING:
if "debug_toolbar" not in INSTALLED_APPS: # noqa: F405
INSTALLED_APPS.append("debug_toolbar") # noqa: F405
if "debug_toolbar.middleware.DebugToolbarMiddleware" not in MIDDLEWARE: # noqa: F405
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405

#
# Logging
#

LOG_LEVEL = "DEBUG" if DEBUG else "INFO"

TESTING = len(sys.argv) > 1 and sys.argv[1] == "test"

# Verbose logging during normal development operation, but quiet logging during unit test execution
if not TESTING:
LOGGING = {
Expand Down
8 changes: 8 additions & 0 deletions docs/admin/compatibility_matrix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Compatibility Matrix

!!! warning "Developer Note - Remove Me!"
Explain how the release models of the plugin and of Nautobot work together, how releases are supported, how features and older releases are deprecated etc.

| Nautobot's Secrets Providers Plugin Version | Nautobot First Support Version | Nautobot Last Support Version |
| ------------- | -------------------- | ------------- |
| 1.0.X | 1.4.0 | 1.99.99 |
Loading

0 comments on commit 792cad8

Please sign in to comment.