Skip to content

Commit

Permalink
all tests passing 🤞 CI is agreeable
Browse files Browse the repository at this point in the history
  • Loading branch information
whitej6 committed Sep 13, 2023
1 parent bc31e23 commit df1f82c
Show file tree
Hide file tree
Showing 20 changed files with 417 additions and 988 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7"]
nautobot-version: ["1.4.1"]
python-version: ["3.11"]
nautobot-version: ["2.0.0-rc.2"]
env:
INVOKE_NAUTOBOT_FIREWALL_MODELS_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_FIREWALL_MODELS_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand Down Expand Up @@ -113,16 +113,16 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8"]
db-backend: ["postgresql"]
nautobot-version: ["latest"]
nautobot-version: ["2.0.0-rc.2"]
# The include is a method to limit the amount of jobs ran. This essentially
# means that in addition to standard postgres and stable, also the lowest
# supported version and with mysql
include:
- python-version: "3.10"
- python-version: "3.11"
db-backend: "postgresql"
nautobot-version: "1.4.1"
nautobot-version: "2.0.0-rc.2"
# TODO: Include the following, once mysql is working on CI
# - python-version: "3.7"
# db-backend: "mysql"
Expand Down
43 changes: 23 additions & 20 deletions development/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
# -------------------------------------------------------------------------------------
# Nautobot Plugin Development Dockerfile Template
# Version: 1.0.0
# Nautobot App Developement Dockerfile Template
# Version: 1.1.0
#
# Plugins that need to add additional steps or packages can do in the section below.
# Apps that need to add additional steps or packages can do in the section below.
# -------------------------------------------------------------------------------------
# !!! USE CAUTION WHEN MODIFYING LINES BELOW

# Accepts a desired Nautobot version as build argument, default to 1.4.1
ARG NAUTOBOT_VER="2.0.0rc2"
# Accepts a desired Nautobot version as build argument, default to `2.0.0-rc.2`
ARG NAUTOBOT_VER="2.0.0-rc.2"

# Accepts a desired Python version as build argument, default to 3.8
# Accepts a desired Python version as build argument, default to 3.11
ARG PYTHON_VER="3.11"

# Retrieve published development image of Nautobot base which should include most CI dependencies
FROM ghcr.io/nautobot/nautobot-dev:2.0.0-rc.2-py3.11
FROM ghcr.io/nautobot/nautobot-dev:${NAUTOBOT_VER}-py${PYTHON_VER}

# Runtime argument and environment setup
ARG NAUTOBOT_ROOT=/opt/nautobot

ENV prometheus_multiproc_dir=/prom_cache
ENV NAUTOBOT_ROOT ${NAUTOBOT_ROOT}

# Don't need virtual environments in container, parallelized installer has inconsistent behavior
RUN poetry config virtualenvs.create false \
&& poetry config installer.parallel false
# Install Poetry manually via its installer script;
# We might be using an older version of Nautobot that includes an older version of Poetry
# and CI and local development may have a newer version of Poetry
# Since this is only used for development and we don't ship this container, pinning Poetry back is not expressly necessary
# We also don't need virtual environments in container
RUN which poetry || curl -sSL https://install.python-poetry.org | python3 - && \
poetry config virtualenvs.create false

# !!! USE CAUTION WHEN MODIFYING LINES ABOVE
# -------------------------------------------------------------------------------------
# Plugin-specific system build/test dependencies.
# App-specifc system build/test dependencies.
#
# Example: LDAP requires `libldap2-dev` to be apt-installed before the Python package.
# -------------------------------------------------------------------------------------
# --> Start safe to modify section

# Uncomment the line below if you are apt-installing any package.
# RUN apt update
# RUN apt install libldap2-dev
# Uncomment the lines below if you are apt-installing any package.
# RUN apt-get -y update && apt-get -y install \
# libldap2-dev \
# && rm -rf /var/lib/apt/lists/*

# --> Stop safe to modify section
# -------------------------------------------------------------------------------------
# Install Nautobot Plugin
# Install Nautobot App
# -------------------------------------------------------------------------------------
# !!! USE CAUTION WHEN MODIFYING LINES BELOW

Expand All @@ -58,18 +63,16 @@ RUN pip show nautobot | grep "^Version: " | sed -e 's/Version: /nautobot==/' > c
# We can't use the entire freeze as it takes forever to resolve with rigidly fixed non-direct dependencies,
# especially those that are only direct to Nautobot but the container included versions slightly mismatch
RUN poetry export -f requirements.txt --without-hashes --output poetry_freeze_base.txt
RUN poetry export -f requirements.txt --dev --without-hashes --output poetry_freeze_all.txt
RUN poetry export -f requirements.txt --with dev --without-hashes --output poetry_freeze_all.txt
RUN sort poetry_freeze_base.txt poetry_freeze_all.txt | uniq -u > poetry_freeze_dev.txt

# Install all local project as editable, constrained on Nautobot version, to get any additional
# direct dependencies of the plugin
RUN pip install -c constraints.txt -e .
# direct dependencies of the app
RUN pip install -c constraints.txt -e .[all]

# Install any dev dependencies frozen from Poetry
# Can be improved in Poetry 1.2 which allows `poetry install --only dev`
RUN pip install -c constraints.txt -r poetry_freeze_dev.txt

RUN pip install nautobot==2.0.0rc2

COPY development/nautobot_config.py ${NAUTOBOT_ROOT}/nautobot_config.py
# !!! USE CAUTION WHEN MODIFYING LINES ABOVE
4 changes: 4 additions & 0 deletions docs/admin/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Here you will find any steps necessary to upgrade the App in your Nautobot environment.

## Upgrade Nautobot 1.X to Nautobot 2.X

As part of the upgrade for Nautobot 2.0 it is recommended to perform a stepped upgrade by first upgrading Nautobot the lastest stable release within these constraints `>=1.6.2,<2.0.0`. After performing the initial upgrade of Nautobot you will need to run `nautobot-server populate_platform_network_driver --no-use-napalm-driver-field`. This will populate the `network_driver` attribute on Platform objects from the `slug` field.

## Upgrade Guide

When a new release comes out it may be necessary to run a migration of the database to account for any changes in the data models used by this plugin. Execute the command `nautobot-server post-upgrade` within the runtime environment of your Nautobot installation after updating the `nautobot-firewall-models` package via `pip`.
1 change: 0 additions & 1 deletion docs/upgrade.md

This file was deleted.

4 changes: 2 additions & 2 deletions nautobot_firewall_models/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class PolicyRuleSerializer(NautobotModelSerializer):

index = serializers.IntegerField(required=False, default=None)

## source
# source
source_users = NautobotHyperlinkedRelatedField(
queryset=models.UserObject.objects.all(),
many=True,
Expand Down Expand Up @@ -183,7 +183,7 @@ class PolicyRuleSerializer(NautobotModelSerializer):
required=False,
)

## destination
# destination
applications = NautobotHyperlinkedRelatedField(
queryset=models.ApplicationObject.objects.all(),
many=True,
Expand Down
Loading

0 comments on commit df1f82c

Please sign in to comment.