Skip to content

Commit

Permalink
Get linters and unit tests passing as a baseline (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmatthews authored Jul 1, 2024
1 parent c81c62b commit 50df6b2
Show file tree
Hide file tree
Showing 24 changed files with 118 additions and 126 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8"]
nautobot-version: ["1.5.3"]
python-version: ["3.11"]
nautobot-version: ["2.0.3"]
env:
INVOKE_NAUTOBOT_VERSION_CONTROL_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_VERSION_CONTROL_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand Down Expand Up @@ -119,15 +119,13 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
nautobot-version: ["stable"]
include:
- python-version: "3.10"
nautobot-version: "1.5.3"
- python-version: "3.7"
nautobot-version: "1.5.3"
- python-version: "3.10"
nautobot-version: "stable"
- python-version: "3.11"
nautobot-version: "2.0.3"
- python-version: "3.8"
nautobot-version: "2.0.3"
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_VERSION_CONTROL_PYTHON_VER: "${{ matrix.python-version }}"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ fabric.properties
# Rando
creds.env
development/*.txt
nautobot_version_control/static/nautobot_version_control/docs

# Invoke overrides
invoke.yml
Expand All @@ -310,4 +311,4 @@ public
# Custom
hosted_ca.pem
.idea
creds_hosted.env
creds_hosted.env
1 change: 0 additions & 1 deletion development/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ x-nautobot-base: &nautobot-base
- "creds.env"
tty: true

version: "3.8"
services:
nautobot:
depends_on:
Expand Down
42 changes: 19 additions & 23 deletions development/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# any override will need to include these volumes to use them.
# see: https://github.com/docker/compose/issues/3729
---
version: "3.8"
services:
nautobot:
command: "nautobot-server runserver 0.0.0.0:8080"
Expand All @@ -12,29 +11,26 @@ services:
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
# TODO: Re-enable
# docs:
# entrypoint: "mkdocs serve -v -a 0.0.0.0:8080"
# ports:
# - "8001:8080"
# volumes:
# - "../:/source"
# image: "nautobot-version-control/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
# healthcheck:
# disable: true
# tty: true
#worker:
# entrypoint:
# - "sh"
# - "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env
# - "watchmedo auto-restart --directory './' --pattern '*.py' --recursive -- nautobot-server celery worker -l $$NAUTOBOT_LOG_LEVEL --events" ## $$ because of docker-compose
# volumes:
# - "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
# - "../:/source"
# To expose postgres or redis to the host uncomment the following
# postgres:
# TODO: Re-enable
# docs:
# entrypoint: "mkdocs serve -v -a 0.0.0.0:8080"
# ports:
# - "5432:5432"
# - "8001:8080"
# volumes:
# - "../:/source"
# image: "nautobot-version-control/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
# healthcheck:
# disable: true
# tty: true
# worker:
# entrypoint:
# - "sh"
# - "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env
# - "watchmedo auto-restart --directory './' --pattern '*.py' --recursive -- nautobot-server celery worker -l $$NAUTOBOT_LOG_LEVEL --events" ## $$ because of docker-compose
# volumes:
# - "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
# - "../:/source"
# To expose redis to the host uncomment the following
# redis:
# ports:
# - "6379:6379"
2 changes: 0 additions & 2 deletions development/docker-compose.dolt.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
version: "3.8"

services:
nautobot:
environment:
Expand Down
1 change: 0 additions & 1 deletion development/docker-compose.redis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
version: "3.8"
services:
redis:
image: "redis:6-alpine"
Expand Down
5 changes: 0 additions & 5 deletions docs/dev/code_reference/diffs.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/dev/code_reference/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Code Reference

Auto-generated code reference documentation from docstrings.

!!! warning "Developer Note - Remove Me!"
Uses [mkdocstrings](https://mkdocstrings.github.io/) syntax to auto-generate code documentation from docstrings. Two example pages are provided ([api](api.md) and [package](package.md)), add new stubs for each module or package that you think has relevant documentation.
2 changes: 1 addition & 1 deletion docs/user/app_getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To install the App, please follow the instructions detailed in the [Installation
## What are the common operations?

This section describes common Git-like operations that the Version Control app enables on the Nautobot database.
It is recommended to read these prior to reading the [common workflows](workflows/common_workflows.md) section.
It is recommended to read these prior to reading the [use cases](app_use_cases.md) section.

### Branches

Expand Down
16 changes: 8 additions & 8 deletions docs/user/app_use_cases.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using the App

This section covers some common workflows. It is recommended to review the [getting started](../app_getting_started.md) section prior to this section.
This section covers some common workflows. It is recommended to review the [getting started](app_getting_started.md) section prior to this section.

## Proposing Data Changes

Expand Down Expand Up @@ -71,9 +71,9 @@ The example below shows that the `bkk-leaf-08` status changed from `Active` to `

### Viewing Branch Commits

To view commits in a given branch, [activate the branch](../version-control-operations.md#switching-branches) with the commits you are interested in.
To view commits in a given branch, [activate the branch](app_getting_started.md#switching-branches) with the commits you are interested in.

See the [Commits documentation](../version-control-operations.md#commits) to learn how to view commits in the selected branch.
See the [Commits documentation](app_getting_started.md#commits) to learn how to view commits in the selected branch.

## The Pull Request (PR) Process

Expand All @@ -91,7 +91,7 @@ Once on the *Add a new pull request* screen, fill out the requested details and

### The Pull Request (PR) Detail View

Creating the PR will take you to the PR detail page, which has 4 tabs, [explained here](../version-control-operations.md#pull-request-view).
Creating the PR will take you to the PR detail page, which has 4 tabs, [explained here](app_getting_started.md#pull-request-view).

### Reviewing a PR

Expand All @@ -102,7 +102,7 @@ To review a PR, go to *Version Control --> Pull Requests*.
This will take you to the pull requests list page; once there:

* Determine which PR you want to review and its source branch
* [Switch the active branch](../version-control-operations.md#switching-branches) to that of the PR source branch (this is necessary if you wish to revert any changes in the PR)
* [Switch the active branch](app_getting_started.md#switching-branches) to that of the PR source branch (this is necessary if you wish to revert any changes in the PR)
* Navigate back to the PR list page and click on the desired PR

![](../images/pr-list-page.png)
Expand All @@ -114,7 +114,7 @@ Here, you can start a conversation around the PR, including any questions or com

Each review can be a *Comment*, *Approval*, or *Blocked* operation.
Once the PR is moved to *Approved* status, a *Merge* button appears, allowing the reviewer to merge the changes into the destination branch.
For more information on merges, see version control operations [section on merges](../version-control-operations.md#merges).
For more information on merges, see version control operations [section on merges](app_getting_started.md#merges).

![](../images/pr-review-conversation.png)

Expand All @@ -135,10 +135,10 @@ Should a conflict come up, you can do the following:

![](../images/view-conflict.png)

At this point you can either [revert the specific commit](../version-control-operations.md#reverting-a-commit) in your PR or modify the other branch with the conflict (the `main` branch in this example).
At this point you can either [revert the specific commit](app_getting_started.md#reverting-a-commit) in your PR or modify the other branch with the conflict (the `main` branch in this example).


## Reverting Commits

At any point during the process of making changes in a branch, reviewing a PR for the changes in a branch, or trying to revert changes already in the main (production) branch, you may want to revert specific commits or revert commits en masse.
View how to revert commits [here](../version-control-operations.md#reverting-a-commit).
View how to revert commits [here](app_getting_started.md#reverting-a-commit).
4 changes: 3 additions & 1 deletion nautobot_version_control/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""Plugin declaration for nautobot_version_control."""

# Metadata is inherited from Nautobot. If not including Nautobot in the environment, this should be added
from importlib import metadata

from django.db.models.signals import pre_migrate, post_migrate
import django_tables2
from nautobot.extras.plugins import PluginConfig
from nautobot_version_control.migrations import auto_dolt_commit_migration

from importlib import metadata

__version__ = metadata.version(__name__)

Expand Down
1 change: 1 addition & 0 deletions nautobot_version_control/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Serializers for version_control app."""

from rest_framework import serializers
from nautobot_version_control.models import Branch, Commit, PullRequest, PullRequestReview

Expand Down
8 changes: 4 additions & 4 deletions nautobot_version_control/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Meta:
)
exclude = ("id",)

def search(self, queryset, name, value): # pylint: disable=unused-argument,no-self-use
def search(self, queryset, name, value): # pylint: disable=unused-argument
"""
Search performs an ORM filter on the Branch model.
Expand Down Expand Up @@ -72,7 +72,7 @@ class Meta:
)
exclude = ("id",)

def search(self, queryset, name, value): # pylint: disable=unused-argument,no-self-use
def search(self, queryset, name, value): # pylint: disable=unused-argument
"""
Search performs an ORM filter on the Commit model.
Expand Down Expand Up @@ -115,7 +115,7 @@ class Meta:
)
exclude = ("id",)

def search(self, queryset, name, value): # pylint: disable=unused-argument,no-self-use
def search(self, queryset, name, value): # pylint: disable=unused-argument
"""
Search performs an ORM filter on the PullRequestFilterSet model.
Expand Down Expand Up @@ -165,7 +165,7 @@ class Meta:
)
exclude = ("id",)

def search(self, queryset, name, value): # pylint: disable=unused-argument,no-self-use
def search(self, queryset, name, value): # pylint: disable=unused-argument
"""
Search performs an ORM filter on the PullRequestReviewFilterSet model.
Expand Down
2 changes: 1 addition & 1 deletion nautobot_version_control/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __call__(self, request):
"""Override __call__."""
return self.get_response(request)

def process_view(self, request, view_func, view_args, view_kwargs): # pylint: disable=R0201
def process_view(self, request, view_func, view_args, view_kwargs):
"""This maintains the dolt branch session cookie and verifies authentication. It then returns the view that needs to be rendered."""
# Check whether the desired branch was passed in as a querystring
query_string_branch = request.GET.get(DOLT_BRANCH_KEYWORD, None)
Expand Down
15 changes: 7 additions & 8 deletions nautobot_version_control/migrations/0008_charfield_max_length.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@


class Migration(migrations.Migration):

dependencies = [
('nautobot_version_control', '0007_auto_20210818_1708'),
("nautobot_version_control", "0007_auto_20210818_1708"),
]

operations = [
migrations.AlterField(
model_name='branchmeta',
name='source_branch',
model_name="branchmeta",
name="source_branch",
field=models.CharField(max_length=1024),
),
migrations.AlterField(
model_name='pullrequest',
name='destination_branch',
model_name="pullrequest",
name="destination_branch",
field=models.CharField(max_length=1024),
),
migrations.AlterField(
model_name='pullrequest',
name='source_branch',
model_name="pullrequest",
name="source_branch",
field=models.CharField(max_length=1024),
),
]
Loading

0 comments on commit 50df6b2

Please sign in to comment.