-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
NAUTOBOT_DJANGO_EXTENSIONS_ENABLED=True | ||
NAUTOBOT_DJANGO_TOOLBAR_ENABLED=True |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the template as well: https://github.com/networktocode-llc/cookiecutter-ntc/blob/nautobot-plugin-v1.0/nautobot-plugin/%7B%7B%20cookiecutter.project_slug%20%7D%7D/development/development.env#L10
Should I remove these 2 lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather keep it aligned with the template: https://github.com/networktocode-llc/cookiecutter-ntc/blob/nautobot-plugin-v1.0/nautobot-plugin/%7B%7B%20cookiecutter.project_slug%20%7D%7D/development/docker-compose.postgres.yml#L14
Will probably be removed with the next template mint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not gone in main
either, might want to include it in the cleanup PR if it's not useful at all https://github.com/networktocode-llc/cookiecutter-ntc/blob/main/nautobot-plugin/%7B%7B%20cookiecutter.project_slug%20%7D%7D/development/docker-compose.postgres.yml
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
development/nautobot_config.py
Outdated
DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", True)) | ||
DEBUG = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this configurability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
docs/admin/compatibility_matrix.md
Outdated
!!! 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix these
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Pin this to the lowest supported version of Nautobot | ||
nautobot = "^1.4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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
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" |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
All comments are addressed now, ready for review. |
base_url = "secrets" | ||
base_url = "secrets-providers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
project_name: "nautobot_secrets_providers" | ||
nautobot_ver: "1.4.10" | ||
project_name: "nautobot-secrets-providers" | ||
nautobot_ver: "latest" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
python-version: "3.10" | ||
python-version: "3.9" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
# 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} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
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
.github/workflows/rebake.yml
Outdated
on: # yamllint disable | ||
schedule: | ||
# every Saturday at 4:00 | ||
- cron: "0 4 * * 6" |
There was a problem hiding this comment.
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
There was a problem hiding this 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
- [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
* 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>
* 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
* 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
* 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
* 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
Closes NaN
What's Changed
nautobot-plugin-v1.0