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

Bake cookie from nautobot-plugin-v1.0 #100

Merged
merged 15 commits into from
Aug 24, 2023
Merged

Bake cookie from nautobot-plugin-v1.0 #100

merged 15 commits into from
Aug 24, 2023

Conversation

snaselj
Copy link
Contributor

@snaselj snaselj commented Aug 1, 2023

Closes NaN

What's Changed

  • Rebaked cookie from nautobot-plugin-v1.0

.gitignore Show resolved Hide resolved
Comment on lines +10 to +11
NAUTOBOT_DJANGO_EXTENSIONS_ENABLED=True
NAUTOBOT_DJANGO_TOOLBAR_ENABLED=True
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not familiar with these two flags? I don't see any reference to them in core or in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cmsirbu Seems like these env variables are not used in the nautobot-plugin template, should I remove it from there?

Copy link

Choose a reason for hiding this comment

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

Go for it, opening a cleanup PR doesn't hurt... and might give you feedback from folks that remember why they were there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's still used in templates to enable Django debug toolbar.

https://github.com/networktocode-llc/cookiecutter-ntc/blob/527dedf686f6ea3cacad773cd7b7e96ee5c1f6ea/nautobot-plugin-ssot/%7B%7B%20cookiecutter.project_slug%20%7D%7D/development/nautobot_config.py#L343

Will align all templates to use the same envs and configuration for this. Keeping it here for now.

- "development.env"
- "creds.env"
volumes:
# - "./nautobot.sql:/tmp/nautobot.sql"
Copy link
Contributor

Choose a reason for hiding this comment

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

remove?

Copy link
Contributor Author

@snaselj snaselj Aug 1, 2023

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its still used in nautobot template.

https://github.com/networktocode-llc/cookiecutter-ntc/blob/527dedf686f6ea3cacad773cd7b7e96ee5c1f6ea/nautobot/%7B%7B%20cookiecutter.project_slug%20%7D%7D/tasks.py#L258

Will replace these tasks in the template with the newer version, that doesn't require this binded volume. Keeping it here for now.

@@ -1,4 +1,5 @@
"""Nautobot development configuration file."""
# pylint: disable=invalid-envvar-default
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big fan of global pylint disables. What specific issues is this hiding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 39 to 48
DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", True))
DEBUG = True
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove this configurability?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted

Comment on lines 3 to 4
!!! 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the plan for addressing all these "Remove Me!" items and generally making sure all these newly added docs are actually relevant/accurate to the app? Part of this PR or future work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix these

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cmsirbu What do you think about the documentation? Does it make sense to rewrite it from README and if so, to do it in the separater PR?

Copy link

Choose a reason for hiding this comment

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

Once an app has docs, I think we should not attempt to update markdown files. Stick to assets/css/requirements etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After the settlement with @cmsirbu , removed all changes to docs. Kept updated docs requirements in pyproject.toml and docs/requirements. Docs update should be done here: #54

Comment on lines -21 to -22
# Pin this to the lowest supported version of Nautobot
nautobot = "^1.4.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why removed?

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

Comment on lines +52 to +62
Markdown = "*"
toml = "*"
# Rendering docs to HTML
mkdocs = "1.3.1"
# Material for MkDocs theme
mkdocs-material = "8.4.2"
# Render custom markdown for version added/changed/remove notes
mkdocs-version-annotations = "1.0.0"
# Automatic documentation from sources, for MkDocs
mkdocstrings = "0.19"
mkdocstrings-python = "0.7.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally we've tried to keep dependencies in alphabetical order in pyproject.toml for ease of maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will sort it in the templates, keeping it here for now.

tasks.py Outdated
Comment on lines 330 to 390
command = (
"nautobot-server --config=nautobot_secrets_providers/tests/nautobot_config.py makemigrations --dry-run --check"
)
command = "nautobot-server --config=nautobot/core/tests/nautobot_config.py makemigrations --dry-run --check"
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks wrong to me...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I'm overlooking something it doesn't look like CI exercises this invoke command. I suspect if you try it locally with this change it will fail - I think it needs to be reverted but would need to test it to be sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted, will fix it in the templates.

tasks.py Outdated
@@ -340,7 +398,6 @@ def check_migrations(context):
"label": "specify a directory or module to test instead of running all Nautobot tests",
"failfast": "fail as soon as a single test fails don't run the entire test suite",
"buffer": "Discard output from passing tests",
"verbose": "Enable verbose test output.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why removed here when it's present at line 346/403 below as a kwarg?

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

@snaselj snaselj marked this pull request as ready for review August 3, 2023 13:51
@snaselj snaselj requested a review from a team as a code owner August 3, 2023 13:51
@snaselj
Copy link
Contributor Author

snaselj commented Aug 3, 2023

All comments are addressed now, ready for review.

base_url = "secrets"
base_url = "secrets-providers"
Copy link
Member

Choose a reason for hiding this comment

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

Breaking change?

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

Comment on lines -3 to +4
project_name: "nautobot_secrets_providers"
nautobot_ver: "1.4.10"
project_name: "nautobot-secrets-providers"
nautobot_ver: "latest"
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't match what's in the tasks.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix the template, keeping it here for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

version = "1.4.1-beta.1"
version = "1.4.1b1"
Copy link
Member

Choose a reason for hiding this comment

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

We follow the 1.4.1-beta.1 convention in Core. Is there a reason to change this?

I know there is a test failing but I think that test can be removed/changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should IMHO use normalized version in pyproject.toml to have Docker image tags on par with pip package versions.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting... Reading Poetry documentation, it's version command, PEP440 (https://peps.python.org/pep-0440/#semantic-versioning) it should have always been this way. Curious @nautobot/maintain-core, any prior knowledge why we use the full SemVer in Core?

Copy link
Member

Choose a reason for hiding this comment

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

Seems like this change/clarification happen last year: python-poetry/poetry#5576

plugin_name: "nautobot-secrets-provider"
plugin_name: "nautobot-plugin-secrets-providers"
Copy link
Member

Choose a reason for hiding this comment

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

Want to make sure we're using the right name. I see in some places we have -plugin and in other places we don't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

plugin_name input is used to composite Docker image name inside called action. Seems this input argument should be repository name, so the value provided here is correct as well as the template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should fix the argument name to repository-name, to better reflect what's expected.

Comment on lines -158 to +180
python-version: "3.10"
python-version: "3.9"
Copy link
Member

Choose a reason for hiding this comment

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

Reason to go to an older Python version? Template?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it's in the template. Should I bump it to 3.10 / 3.11 in the template? Newer Python versions has better performance.

Copy link
Member

Choose a reason for hiding this comment

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

No need to bump. I think this is yet another good case for cookie version 1.2

@bryanculver bryanculver added emergent Unplanned work that is brought into a sprint after it's started. type: housekeeping labels Aug 21, 2023
Comment on lines +16 to +22
# Postgres
POSTGRES_PASSWORD=${NAUTOBOT_DB_PASSWORD}
PGPASSWORD=${NAUTOBOT_DB_PASSWORD}

# Needed for Redis, must match the values for Nautobot above
REDIS_PASSWORD=notverysecurepwd
# MySQL Credentials
MYSQL_ROOT_PASSWORD=${NAUTOBOT_DB_PASSWORD}
MYSQL_PASSWORD=${NAUTOBOT_DB_PASSWORD}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make a distinction between Postgres and MySQL credentials? It is rare that they use the same environmental variable as passwords right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally I would prefer to remove binding from Docker Compose configs to these creds.env and development.env, and rather specify environment variables for each compose service independently. (Remove key env_file and use environment instead). The current solution exposes all environment files to most services, even when they do not consume it. However such change is not necessary now IMHO.

I use proposed solution here:

https://github.com/nautobot/cookiecutter-nautobot-app-drift-manager/blob/develop/development/compose.yaml

Environment is loaded and altered when using invoke.

https://github.com/nautobot/cookiecutter-nautobot-app-drift-manager/blob/develop/tasks.py#L38
https://github.com/nautobot/cookiecutter-nautobot-app-drift-manager/blob/develop/development/default.env#L1

on: # yamllint disable
schedule:
# every Saturday at 4:00
- cron: "0 4 * * 6"
Copy link
Member

Choose a reason for hiding this comment

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

Since this is open source and we want to make a lot of changes/test this out, let's add a manual trigger as well as run it every other night.

* chore: Drop Python 3.7 support

* chore: Remove unnecessary importlib-metadata
Copy link
Member

@bryanculver bryanculver left a comment

Choose a reason for hiding this comment

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

If CI passes now, let's ship

@bryanculver bryanculver merged commit 5acedaf into develop Aug 24, 2023
15 checks passed
@snaselj snaselj deleted the drift-manager/pr branch August 25, 2023 11:16
bryanculver pushed a commit to nautobot/cookiecutter-nautobot-app that referenced this pull request Aug 31, 2023
- [Based on](nautobot/nautobot-app-secrets-providers#100).
- Fixed invoke tasks:
  - Don't specify nautobot config for `invoke check-migrations`
- Arguments added to invoke tasks:
  - `invoke unittest --verbose`
  - `invoke tests --keepdb`
  - `invoke tests --lint-only`
- Removed obsolete environment variables:
  - `NAUTOBOT_DJANGO_EXTENSIONS_ENABLED`
  - `NAUTOBOT_DJANGO_TOOLBAR_ENABLED`
- Better organized `development/nautobot_config.py` file.
  - Removed unnecessary linter rules.
  - Moved `Debug` section to the top, to be easily reused.
  - Moved `Redis` section next to `Database` section.
  - Renamed `TESTING` to `_TESTING` as it's the local variable only.
  - Removed `RQ` related comments.
  - Renamed `plugin` => `App` in comments.
- Removed obsoleted commented out docker-compose postgres mount `nautobot.sql`.
- Alphabetically sorted requirements and removed obvious comments.
- Aligned nautobot-plugin and nautobot-plugin-ssot templates:
  - `development/nautobot_config.py`
  - invoke tasks
  - docs requirements and configuration

fix: Tasks formatting

fix: Use `plugin_slug` for compose project name
bryanculver added a commit to nautobot/cookiecutter-nautobot-app that referenced this pull request Sep 7, 2023
* Move poetry dev dependencies to tool.poetry.group.dev.dependencies

* Update .flake8

* feat: Support Drift Manager

fix: yamllint

* fix: Comments from secrets providers PR

- [Based on](nautobot/nautobot-app-secrets-providers#100).
- Fixed invoke tasks:
  - Don't specify nautobot config for `invoke check-migrations`
- Arguments added to invoke tasks:
  - `invoke unittest --verbose`
  - `invoke tests --keepdb`
  - `invoke tests --lint-only`
- Removed obsolete environment variables:
  - `NAUTOBOT_DJANGO_EXTENSIONS_ENABLED`
  - `NAUTOBOT_DJANGO_TOOLBAR_ENABLED`
- Better organized `development/nautobot_config.py` file.
  - Removed unnecessary linter rules.
  - Moved `Debug` section to the top, to be easily reused.
  - Moved `Redis` section next to `Database` section.
  - Renamed `TESTING` to `_TESTING` as it's the local variable only.
  - Removed `RQ` related comments.
  - Renamed `plugin` => `App` in comments.
- Removed obsoleted commented out docker-compose postgres mount `nautobot.sql`.
- Alphabetically sorted requirements and removed obvious comments.
- Aligned nautobot-plugin and nautobot-plugin-ssot templates:
  - `development/nautobot_config.py`
  - invoke tasks
  - docs requirements and configuration

fix: Tasks formatting

fix: Use `plugin_slug` for compose project name

* Min bump to Python 3.8 and Core 1.6

Update nautobot-plugin/{{ cookiecutter.project_slug }}/pyproject.toml

Co-authored-by: Christian Adell <chadell@gmail.com>

Address review feedback

Update docs links

Update link

Copy changes to ssot template

* Merge misses

* Delete nautobot-app/{{ cookiecutter.project_slug }}/.github/workflows/rebake.yml

* Address feedback

* Save before commit

* Alpha sorted features only

* Duplicate docs deps

---------

Co-authored-by: itdependsnetworks <ken@celenza.org>
Co-authored-by: nniehoff <nick.niehoff@networktocode.com>
Co-authored-by: Jan Snasel <jan.snasel@networktocode.com>
Co-authored-by: Cristian Sirbu <cmsirbu@users.noreply.github.com>
EdificomSA pushed a commit to EdificomSA/nautobot-app-secrets-providers-keeper that referenced this pull request Dec 6, 2023
* chore: First rebake without docs

* docs: From first rebake

* fix: Dependencies

* fix: Format

* fix: Install all deps

* fix: Normalize package version

* fix: pylint issue

* fix: PR comments

* fix: invoke check-migrations

* revert: Docs

* fix: Removed obsoleted docker-compose.docs.yml

* fix: Revert base_url change

* feat: Auto rebake cookie

* fix: Run every day and add a manual trigger

* Drop Python 3.7 support (nautobot#102)

* chore: Drop Python 3.7 support

* chore: Remove unnecessary importlib-metadata
EdificomSA pushed a commit to EdificomSA/nautobot-app-secrets-providers-keeper that referenced this pull request Dec 6, 2023
* chore: First rebake without docs

* docs: From first rebake

* fix: Dependencies

* fix: Format

* fix: Install all deps

* fix: Normalize package version

* fix: pylint issue

* fix: PR comments

* fix: invoke check-migrations

* revert: Docs

* fix: Removed obsoleted docker-compose.docs.yml

* fix: Revert base_url change

* feat: Auto rebake cookie

* fix: Run every day and add a manual trigger

* Drop Python 3.7 support (nautobot#102)

* chore: Drop Python 3.7 support

* chore: Remove unnecessary importlib-metadata
EdificomSA pushed a commit to EdificomSA/nautobot-app-secrets-providers-keeper that referenced this pull request Dec 11, 2023
* chore: First rebake without docs

* docs: From first rebake

* fix: Dependencies

* fix: Format

* fix: Install all deps

* fix: Normalize package version

* fix: pylint issue

* fix: PR comments

* fix: invoke check-migrations

* revert: Docs

* fix: Removed obsoleted docker-compose.docs.yml

* fix: Revert base_url change

* feat: Auto rebake cookie

* fix: Run every day and add a manual trigger

* Drop Python 3.7 support (nautobot#102)

* chore: Drop Python 3.7 support

* chore: Remove unnecessary importlib-metadata
EdificomSA pushed a commit to EdificomSA/nautobot-app-secrets-providers-keeper that referenced this pull request Dec 11, 2023
* chore: First rebake without docs

* docs: From first rebake

* fix: Dependencies

* fix: Format

* fix: Install all deps

* fix: Normalize package version

* fix: pylint issue

* fix: PR comments

* fix: invoke check-migrations

* revert: Docs

* fix: Removed obsoleted docker-compose.docs.yml

* fix: Revert base_url change

* feat: Auto rebake cookie

* fix: Run every day and add a manual trigger

* Drop Python 3.7 support (nautobot#102)

* chore: Drop Python 3.7 support

* chore: Remove unnecessary importlib-metadata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emergent Unplanned work that is brought into a sprint after it's started. type: housekeeping
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants