Skip to content

Commit

Permalink
Cookie updated by NetworkToCode Cookie Drift Manager Tool (#253)
Browse files Browse the repository at this point in the history
* Cookie updated by NetworkToCode Cookie Drift Manager Tool
* fix lockfile
* fix badge url
* add docs url

---------

Co-authored-by: bakebot <info@networktocode.com>
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 18, 2024
1 parent eadf415 commit 2333153
Show file tree
Hide file tree
Showing 15 changed files with 1,158 additions and 817 deletions.
6 changes: 0 additions & 6 deletions .bandit.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
"_drift_manager": {
"template": "https://github.com/nautobot/cookiecutter-nautobot-app.git",
"template_dir": "nautobot-app",
"template_ref": "refs/tags/nautobot-app-v2.3.2",
"template_ref": "refs/tags/nautobot-app-v2.4.0",
"cookie_dir": "",
"branch_prefix": "drift-manager",
"pull_request_strategy": "create",
"post_actions": [
"black"
"ruff",
"poetry"
],
"draft": true,
"baked_commit_ref": "56195cad1cb296db964271e2ee9bf643e3d4404b"
"draft": false,
"baked_commit_ref": "0c65eb129a4fdeeeee9cd46c022c2e8247377320"
}
}
}
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v6"
- name: "Linting: ruff"
run: "poetry run invoke ruff"
run: "poetry run invoke ruff --action lint"
check-docs-build:
runs-on: "ubuntu-22.04"
env:
Expand Down Expand Up @@ -176,9 +176,9 @@ jobs:
- name: "Run Tests"
run: "poetry run invoke unittest"
changelog:
if: |
if: >
contains(fromJson('["develop","ltm-1.6"]'), github.base_ref) &&
(github.head_ref != 'main')
(github.head_ref != 'main') && (!startsWith(github.head_ref, 'release'))
runs-on: "ubuntu-22.04"
steps:
- name: "Check out repository code"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/upstream_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ name: "Nautobot Upstream Monitor"
on: # yamllint disable-line rule:truthy rule:comments
schedule:
- cron: "0 4 */2 * *" # every other day at midnight
workflow_dispatch:

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_DEVICE_ONBOARDING"
plugin_name: "nautobot-app-device-onboarding"
plugin_name: "nautobot-device-onboarding"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p align="center">
<img src="https://raw.githubusercontent.com/nautobot/nautobot-app-device-onboarding/develop/docs/images/icon-DeviceOnboarding.png" class="logo" height="200px">
<br>
<a href="https://github.com/nautobot/nautobot-app-device-onboarding/actions"><img src="https://github.com/nautobot/nautobot-app-device-onboarding/actions/workflows/ci.yml/badge.svg?branch=develop"></a>
<a href="https://github.com/nautobot/nautobot-app-device-onboarding/actions"><img src="https://github.com/nautobot/nautobot-app-device-onboarding/actions/workflows/ci.yml/badge.svg?branch=main"></a>
<a href="https://docs.nautobot.com/projects/device-onboarding/en/latest/"><img src="https://readthedocs.org/projects/nautobot-plugin-device-onboarding/badge/"></a>
<a href="https://pypi.org/project/nautobot-device-onboarding/"><img src="https://img.shields.io/pypi/v/nautobot-device-onboarding"></a>
<a href="https://pypi.org/project/nautobot-device-onboarding/"><img src="https://img.shields.io/pypi/dm/nautobot-device-onboarding"></a>
Expand Down
1 change: 1 addition & 0 deletions changes/+nautobot-app-v2.4.0.housekeeping
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rebaked from the cookie `nautobot-app-v2.4.0`.
6 changes: 4 additions & 2 deletions development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ WORKDIR /source
COPY . /source

# Build args must be declared in each stage
ARG NAUTOBOT_VER
ARG PYTHON_VER

# Constrain the Nautobot version to NAUTOBOT_VER
# Constrain the Nautobot version to NAUTOBOT_VER, fall back to installing from git branch if not available on PyPi
# In CI, this should be done outside of the Dockerfile to prevent cross-compile build failures
ARG CI
RUN if [ -z "${CI+x}" ]; then \
INSTALLED_NAUTOBOT_VER=$(pip show nautobot | grep "^Version" | sed "s/Version: //"); \
poetry add --lock nautobot@${INSTALLED_NAUTOBOT_VER} --python ${PYTHON_VER}; fi
poetry add --lock nautobot@${INSTALLED_NAUTOBOT_VER} --python ${PYTHON_VER} || \
poetry add --lock git+https://github.com/nautobot/nautobot.git#${NAUTOBOT_VER} --python ${PYTHON_VER}; fi

# Install the app
RUN poetry install --extras all --with dev
Expand Down
1 change: 1 addition & 0 deletions development/development.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ NAUTOBOT_BANNER_TOP="Local"
NAUTOBOT_CHANGELOG_RETENTION=0

NAUTOBOT_DEBUG=True
NAUTOBOT_LOG_DEPRECATION_WARNINGS=True
NAUTOBOT_LOG_LEVEL=DEBUG
NAUTOBOT_METRICS_ENABLED=True
NAUTOBOT_NAPALM_TIMEOUT=5
Expand Down
15 changes: 15 additions & 0 deletions development/towncrier_template.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@

# v{{ versiondata.version.split(".")[:2] | join(".") }} Release Notes

This document describes all new features and changes in the release. The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html).

## Release Overview

- Major features or milestones
- Changes to compatibility with Nautobot and/or other apps, libraries etc.

{% if render_title %}
## [v{{ versiondata.version }} ({{ versiondata.date }})](https://github.com/nautobot/nautobot-app-device-onboarding/releases/tag/v{{ versiondata.version}})

Expand All @@ -12,7 +23,11 @@
{% if definitions[category]['showcontent'] %}
{% for text, values in sections[section][category].items() %}
{% for item in text.split('\n') %}
{% if values %}
- {{ values|join(', ') }} - {{ item.strip() }}
{% else %}
- {{ item.strip() }}
{% endif %}
{% endfor %}
{% endfor %}

Expand Down
24 changes: 7 additions & 17 deletions docs/dev/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,14 @@ The branching policy includes the following tenets:

Device Onboarding will observe semantic versioning, as of 1.0. This may result in a quick turnaround in minor versions to keep pace with an ever-growing feature set.

### Backporting to Older Releases

If you are backporting any fixes to a prior major or minor version of this app, please open an issue, comment on an existing issue, or post in the [Network to Code Slack](https://networktocode.slack.com/) (channel `#nautobot`).

We will create a `release-X.Y` branch for you to open your PR against and cut a new release once the PR is successfully merged.

## Release Policy

Device Onboarding has currently no intended scheduled release schedule, and will release new features in minor versions.

When a new release, from `develop` to `main`, is created the following should happen.

- A release PR is created from `develop` with:
- Update the release notes in `docs/admin/release_notes/version_<major>.<minor>.md` file to reflect the changes.
- Change the version from `<major>.<minor>.<patch>-beta` to `<major>.<minor>.<patch>` in `pyproject.toml`.
- Set the PR to the `main` branch.
- Ensure the tests for the PR pass.
- Merge the PR.
- Create a new tag:
- The tag should be in the form of `v<major>.<minor>.<patch>`.
- The title should be in the form of `v<major>.<minor>.<patch>`.
- The description should be the changes that were added to the `version_<major>.<minor>.md` document.
- If merged into `main`, then push from `main` to `develop`, in order to retain the merge commit created when the PR was merged
- A post release PR is created with:
- Change the version from `<major>.<minor>.<patch>` to `<major>.<minor>.<patch + 1>-beta` in both `pyproject.toml` and `nautobot.__init__.__version__`.
- Set the PR to the proper branch, `develop`.
- Once tests pass, merge.
The steps taken by maintainers when creating a new release are documented in the [release checklist](./release_checklist.md).
214 changes: 214 additions & 0 deletions docs/dev/release_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
# Release Checklist

This document is intended for app maintainers and outlines the steps to perform when releasing a new version of the app.

!!! important
Before starting, make sure your **local** `develop`, `main`, and (if applicable) the current LTM branch are all up to date with upstream!

```
git fetch
git switch develop && git pull # and repeat for main/ltm
```

Choose your own adventure:

- LTM release? Jump [here](#ltm-releases).
- Patch release from `develop`? Jump [here](#all-releases-from-develop).
- Minor release? Continue with [Minor Version Bumps](#minor-version-bumps) and then [All Releases from `develop`](#all-releases-from-develop).

## Minor Version Bumps

### Update Requirements

Every minor version release should refresh `poetry.lock`, so that it lists the most recent stable release of each package. To do this:

0. Run `poetry update --dry-run` to have Poetry automatically tell you what package updates are available and the versions it would upgrade to. This requires an existing environment created from the lock file (i.e. via `poetry install`).
1. Review each requirement's release notes for any breaking or otherwise noteworthy changes.
2. Run `poetry update <package>` to update the package versions in `poetry.lock` as appropriate.
3. If a required package requires updating to a new release not covered in the version constraints for a package as defined in `pyproject.toml`, (e.g. `Django ~3.1.7` would never install `Django >=4.0.0`), update it manually in `pyproject.toml`.
4. Run `poetry install` to install the refreshed versions of all required packages.
5. Run all tests (`poetry run invoke tests`) and check that the UI and API function as expected.

### Update Documentation

If there are any changes to the compatibility matrix (such as a bump in the minimum supported Nautobot version), update it accordingly.

Commit any resulting changes from the following sections to the documentation before proceeding with the release.

!!! tip
Fire up the documentation server in your development environment with `poetry run mkdocs serve`! This allows you to view the documentation site locally (the link is in the output of the command) and automatically rebuilds it as you make changes.

### Verify the Installation and Upgrade Steps

Follow the [installation instructions](../admin/install.md) to perform a new production installation of the app. If possible, also test the [upgrade process](../admin/upgrade.md) from the previous released version.

The goal of this step is to walk through the entire install process *as documented* to make sure nothing there needs to be changed or updated, to catch any errors or omissions in the documentation, and to ensure that it is current with each release.

---

## All Releases from `develop`

### Verify CI Build Status

Ensure that continuous integration testing on the `develop` branch is completing successfully.

### Bump the Version

Update the package version using `poetry version` if necessary. This command shows the current version of the project or bumps the version of the project and writes the new version back to `pyproject.toml` if a valid bump rule is provided.

The new version must be a valid semver string or a valid bump rule: `patch`, `minor`, `major`, `prepatch`, `preminor`, `premajor`, `prerelease`. Always try to use a bump rule when you can.

Display the current version with no arguments:

```no-highlight
> poetry version
nautobot-device-onboarding 1.0.0-beta.2
```

Bump pre-release versions using `prerelease`:

```no-highlight
> poetry version prerelease
Bumping version from 1.0.0-beta.2 to 1.0.0-beta.3
```

For major versions, use `major`:

```no-highlight
> poetry version major
Bumping version from 1.0.0-beta.2 to 1.0.0
```

For patch versions, use `minor`:

```no-highlight
> poetry version minor
Bumping version from 1.0.0 to 1.1.0
```

And lastly, for patch versions, you guessed it, use `patch`:

```no-highlight
> poetry version patch
Bumping version from 1.1.0 to 1.1.1
```

Please see the [official Poetry documentation on `version`](https://python-poetry.org/docs/cli/#version) for more information.

### Update the Changelog

!!! important
The changelog must adhere to the [Keep a Changelog](https://keepachangelog.com/) style guide.

This guide uses `1.4.2` as the new version in its examples, so change it to match the version you bumped to in the previous step! Every. single. time. you. copy/paste commands :)

First, create a release branch off of `develop` (`git switch -c release-1.4.2 develop`).

> You will need to have the project's poetry environment built at this stage, as the towncrier command runs **locally only**. If you don't have it, run `poetry install` first.
Generate release notes with `invoke generate-release-notes --version 1.4.2` and answer `yes` to the prompt `Is it okay if I remove those files? [Y/n]:`. This will update the release notes in `docs/admin/release_notes/version_X.Y.md`, stage that file in git, and `git rm` all the fragments that have now been incorporated into the release notes.

There are two possibilities:

1. If you're releasing a new major or minor version, rename the `version_X.Y.md` file accordingly (e.g. rename to `docs/admin/release_notes/version_1.4.md`). Update the `Release Overview` and add this new page to the table of contents within `mkdocs.yml`.
2. If you're releasing a patch version, copy your version's section from the `version_X.Y.md` file into the already existing `docs/admin/release_notes/version_1.4.md` file. Delete the `version_X.Y.md` file.

Stage all the changes (`git add`) and check the diffs to verify all of the changes are correct (`git diff --cached`).

Commit `git commit -m "Release v1.4.2"` and `git push` the staged changes.

### Submit Release Pull Request

Submit a pull request titled `Release v1.4.2` to merge your release branch into `main`. Copy the documented release notes into the pull request's body.

!!! important
Do not squash merge this branch into `main`. Make sure to select `Create a merge commit` when merging in GitHub.

Once CI has completed on the PR, merge it.

### Create a New Release in GitHub

Draft a [new release](https://github.com/nautobot/nautobot-app-device-onboarding/releases/new) with the following parameters.

* **Tag:** Input current version (e.g. `v1.4.2`) and select `Create new tag: v1.4.2 on publish`
* **Target:** `main`
* **Title:** Version and date (e.g. `v1.4.2 - 2024-04-02`)

Click "Generate Release Notes" and edit the auto-generated content as follows:

- Change the entries generated by GitHub to only the usernames of the contributors. e.g. `* Updated dockerfile by @nautobot_user in https://github.com/nautobot/nautobot-app-device-onboarding/pull/123` -> `* @nautobot_user`.
- This should give you the list for the new `Contributors` section.
- Make sure there are no duplicated entries.
- Replace the content of the `What's Changed` section with the description of changes from the release PR (what towncrier generated).
- If it exists, leave the `New Contributors` list as it is.

The release notes should look as follows:

```markdown
## What's Changed

**Towncrier generated Changed/Fixed/Housekeeping etc. sections here**

## Contributors

* @alice
* @bob

## New Contributors

* @bob

**Full Changelog**: https://github.com/nautobot/nautobot-app-device-onboarding/compare/v1.4.1...v1.4.2
```

Publish the release!

### Create a PR from `main` back to `develop`

First, sync your `main` branch with upstream changes: `git switch main && git pull`.

Create a new branch from `main` called `release-1.4.2-to-develop` and use `poetry version prepatch` to bump the development version to the next release.

For example, if you just released `v1.4.2`:

```no-highlight
> git switch -c release-1.4.2-to-develop main
Switched to a new branch 'release-1.4.2-to-develop'
> poetry version prepatch
Bumping version from 1.4.2 to 1.4.3a1
> git add pyproject.toml && git commit -m "Bump version"
> git push
```

!!! important
Do not squash merge this branch into `develop`. Make sure to select `Create a merge commit` when merging in GitHub.

Open a new PR from `release-1.4.2-to-develop` against `develop`, wait for CI to pass, and merge it.

### Final checks

At this stage, the CI should be running or finished for the `v1.4.2` tag and a package successfully published to PyPI and added into the GitHub Release. Double check that's the case.

Documentation should also have been built for the tag on ReadTheDocs and if you're reading this page online, refresh it and look for the new version in the little version fly-out menu down at the bottom right of the page.

All done!


## LTM Releases

For projects maintaining a Nautobot LTM compatible release, all development and release management is done through the `ltm-x.y` branch. The `x.y` relates to the LTM version of Nautobot it's compatible with, for example `1.6`.

The process is similar to releasing from `develop`, but there is no need for post-release branch syncing because you'll release directly from the LTM branch:

1. Make sure your `ltm-1.6` branch is passing CI.
2. Create a release branch from the `ltm-1.6` branch: `git switch -c release-1.2.3 ltm-1.6`.
3. Bump up the patch version `poetry version patch`. If you're backporting a feature instead of bugfixes, bump the minor version instead with `poetry version minor`.
4. Generate the release notes: `invoke generate-release-notes --version 1.2.3`.
5. Move the release notes from the generated `docs/admin/release_notes/version_X.Y.md` to `docs/admin/release_notes/version_1.2.md`.
6. Add all the changes and `git commit -m "Release v1.2.3"`, then `git push`.
7. Open a new PR against `ltm-1.6`. Once CI is passing in the PR, `Create a merge commit` (don't squash!).
8. Create a New Release in GitHub - use the same steps documented [here](#create-a-new-release-in-github).
9. Open a separate PR against `develop` to synchronize all LTM release changelogs into the latest version of the docs for visibility.
1 change: 1 addition & 0 deletions nautobot_device_onboarding/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class NautobotDeviceOnboardingConfig(NautobotAppConfig):
"object_match_strategy": "loose",
}
caching_config = {}
docs_view_name = "plugins:nautobot_device_onboarding:docs"


config = NautobotDeviceOnboardingConfig # pylint:disable=invalid-name
9 changes: 9 additions & 0 deletions nautobot_device_onboarding/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Django urlpatterns declaration for nautobot_device_onboarding app."""

from django.templatetags.static import static
from django.urls import path
from django.views.generic import RedirectView

urlpatterns = [
path("docs/", RedirectView.as_view(url=static("nautobot_device_onboarding/docs/index.html")), name="docs"),
]
Loading

0 comments on commit 2333153

Please sign in to comment.