Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Fix develop (#153)
Browse files Browse the repository at this point in the history
* build: Update project dependencies in lockfile

* chore: 🔧 Enable commit_version_number in semantic-release

* test: 🚨 Fixes for black linter

* Fix Main (#152)

* chore: 🚚 Update test file name to match filepath of file being tested

* style: 🚨 Fix formatting for black

* build: Update to latest syntax for compose

* build: Use Postgres 13 for Apple ARM support

* fix: 🐛 Add check for existence of Relationship in source list before returning.

Also refactored slightly to have it return a sorted list of VLANs based on VLAN ID

* test: ✅ Add tests validating Nautobot utility methods

* build: Update lockfile for latest dependencies

* build: Set upper bound on nautobot-ssot to prevent conflict.

* build: Update Dockerfile to latest pattern pinning poetry.

* ci: Update CI to latest pattern and lock Nautobot version.

* build: Remove extras all

* ci: Remove py3.7 from unit tests

* ci: Remove mySQL tests, simplify unittest matrix

* build: Update lockfile

* fix: Redo lockfile as messed up in merge

* test: Address yamllint complaints

---------

Co-authored-by: Justin Drew <[email protected]>
  • Loading branch information
jdrew82 and jdrew82 authored Oct 20, 2023
1 parent 2e29751 commit 525f28b
Show file tree
Hide file tree
Showing 6 changed files with 736 additions and 748 deletions.
127 changes: 73 additions & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: "CI"
concurrency: # Cancel any existing runs of this workflow for this same PR
concurrency: # Cancel any existing runs of this workflow for this same PR
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
on: # yamllint disable-line rule:truthy rule:comments
on: # yamllint disable-line rule:truthy rule:comments
push:
branches:
- "main"
Expand All @@ -25,8 +25,6 @@ jobs:
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.10"
- name: "Linting: black"
run: "poetry run invoke black"
bandit:
Expand All @@ -38,8 +36,6 @@ jobs:
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.10"
- name: "Linting: bandit"
run: "poetry run invoke bandit"
pydocstyle:
Expand All @@ -51,8 +47,6 @@ jobs:
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.10"
- name: "Linting: pydocstyle"
run: "poetry run invoke pydocstyle"
flake8:
Expand All @@ -64,8 +58,6 @@ jobs:
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.10"
- name: "Linting: flake8"
run: "poetry run invoke flake8"
yamllint:
Expand All @@ -77,8 +69,6 @@ jobs:
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.10"
- name: "Linting: yamllint"
run: "poetry run invoke yamllint"
pylint:
Expand All @@ -93,7 +83,7 @@ jobs:
fail-fast: true
matrix:
python-version: ["3.8"]
nautobot-version: ["1.4.0"]
nautobot-version: ["1.6.0"]
env:
INVOKE_NAUTOBOT_SSOT_INFOBLOX_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_SSOT_INFOBLOX_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
Expand All @@ -102,8 +92,23 @@ jobs:
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Set up Docker Buildx"
id: "buildx"
uses: "docker/setup-buildx-action@v1"
- name: "Build"
uses: "docker/build-push-action@v2"
with:
python-version: "3.10"
builder: "${{ steps.buildx.outputs.name }}"
context: "./"
push: false
load: true
tags: "${{ env.PLUGIN_NAME }}/nautobot:${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
file: "./development/Dockerfile"
cache-from: "type=gha,scope=${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
cache-to: "type=gha,scope=${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
build-args: |
NAUTOBOT_VER=${{ matrix.nautobot-version }}
PYTHON_VER=${{ matrix.python-version }}
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Linting: pylint"
Expand All @@ -114,8 +119,9 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
nautobot-version: ["1.4.2", "latest"]
python-version: ["3.8", "3.9", "3.10"]
db-backend: ["postgresql"]
nautobot-version: ["1.5.0"]
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_SSOT_INFOBLOX_PYTHON_VER: "${{ matrix.python-version }}"
Expand All @@ -125,12 +131,25 @@ jobs:
uses: "actions/checkout@v3"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
- name: "Set up Docker Buildx"
id: "buildx"
uses: "docker/setup-buildx-action@v1"
- name: "Build"
uses: "docker/build-push-action@v2"
with:
python-version: "${{ matrix.python-version }}"
builder: "${{ steps.buildx.outputs.name }}"
context: "./"
push: false
load: true
tags: "${{ env.PLUGIN_NAME }}/nautobot:${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
file: "./development/Dockerfile"
cache-from: "type=gha,scope=${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
cache-to: "type=gha,scope=${{ matrix.nautobot-version }}-py${{ matrix.python-version }}"
build-args: |
NAUTOBOT_VER=${{ matrix.nautobot-version }}
PYTHON_VER=${{ matrix.python-version }}
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Build Container"
run: "poetry run invoke build"
- name: "Run Tests"
run: "poetry run invoke unittest"
publish_gh:
Expand Down Expand Up @@ -188,38 +207,38 @@ jobs:
with:
user: "__token__"
password: "${{ secrets.PYPI_API_TOKEN }}"
slack-notify:
needs:
- "publish_gh"
- "publish_pypi"
runs-on: "ubuntu-20.04"
env:
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
SLACK_MESSAGE: >-
*NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
Release: <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>\n
Published by: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>
steps:
- name: "Send a notification to Slack"
# ENVs cannot be used directly in job.if. This is a workaround to check
# if SLACK_WEBHOOK_URL is present.
if: "env.SLACK_WEBHOOK_URL != ''"
uses: "slackapi/[email protected]"
with:
payload: |
{
"text": "${{ env.SLACK_MESSAGE }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ env.SLACK_MESSAGE }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
SLACK_WEBHOOK_TYPE: "INCOMING_WEBHOOK"
# slack-notify:
# needs:
# - "publish_gh"
# - "publish_pypi"
# runs-on: "ubuntu-20.04"
# env:
# SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
# SLACK_MESSAGE: >-
# *NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
# Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
# Release: <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>\n
# Published by: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>
# steps:
# - name: "Send a notification to Slack"
# # ENVs cannot be used directly in job.if. This is a workaround to check
# # if SLACK_WEBHOOK_URL is present.
# if: "env.SLACK_WEBHOOK_URL != ''"
# uses: "slackapi/[email protected]"
# with:
# payload: |
# {
# "text": "${{ env.SLACK_MESSAGE }}",
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "${{ env.SLACK_MESSAGE }}"
# }
# }
# ]
# }
# env:
# SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}"
# SLACK_WEBHOOK_TYPE: "INCOMING_WEBHOOK"
6 changes: 3 additions & 3 deletions .github/workflows/upstream_testing.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
name: "Nautobot Upstream Testing"

on: # yamllint disable-line rule:truthy rule:comments
on: # yamllint disable-line rule:truthy rule:comments
schedule:
- cron: "0 4 */2 * *" # every other day at midnight
- cron: "0 4 */2 * *" # every other day at midnight

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
with: # Below could potentially be collapsed into a single argument if a concrete relationship between both is enforced
invoke_context_name: "NAUTOBOT_SSOT_INFOBLOX"
plugin_name: "nautobot-ssot-infoblox"
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

<!--next-version-placeholder-->

## v0.8.0 (2023-05-08)
### Feature
* ✨ Add ability to select objects to import and specify Prefixes to import. ([`926edc7`](https://github.com/nautobot/nautobot-plugin-ssot-infoblox/commit/926edc7e397ed591a51bfa86798e0cd158b2f13c))

### Fix
* Correct CustomField creation to not slugify name, specify slug. ([`da56cd0`](https://github.com/nautobot/nautobot-plugin-ssot-infoblox/commit/da56cd00707003b6f3390630fc1e448d329c57ab))

### Documentation
* 📝 Updated README with missing settings. ([`37dbadd`](https://github.com/nautobot/nautobot-plugin-ssot-infoblox/commit/37dbadd8b437eefe06eaccc6fe2f350b7b3337de))

## v0.7.5 (2022-12-01)
### Fix
* IP Address Bulk Import ([#118](https://github.com/nautobot/nautobot-plugin-ssot-infoblox/issues/118)) ([`67a9f89`](https://github.com/nautobot/nautobot-plugin-ssot-infoblox/commit/67a9f897dedf8b0068616fd6995f62860f040449))
Expand Down
25 changes: 11 additions & 14 deletions development/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# -------------------------------------------------------------------------------------
# Nautobot App Developement Dockerfile Template
# Version: 1.0.0
# Version: 1.1.0
#
# 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.0
# Accepts a desired Nautobot version as build argument, default to 1.4
ARG NAUTOBOT_VER="1.4"

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

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

# Runtime argument and environment setup
Expand All @@ -26,10 +26,9 @@ ENV NAUTOBOT_ROOT ${NAUTOBOT_ROOT}
# 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 curl -sSL https://install.python-poetry.org -o /tmp/install-poetry.py && \
python /tmp/install-poetry.py && \
rm -f /tmp/install-poetry.py && \
poetry config virtualenvs.create false
ENV POETRY_VERSION=1.5.1
RUN curl -sSL https://install.python-poetry.org | python3 - && \
poetry config virtualenvs.create false

# !!! USE CAUTION WHEN MODIFYING LINES ABOVE
# -------------------------------------------------------------------------------------
Expand All @@ -39,10 +38,6 @@ RUN curl -sSL https://install.python-poetry.org -o /tmp/install-poetry.py && \
# -------------------------------------------------------------------------------------
# --> Start safe to modify section

# Uncomment the line below if you are apt-installing any package.
# RUN apt update
# RUN apt install libldap2-dev

# --> Stop safe to modify section
# -------------------------------------------------------------------------------------
# Install Nautobot App
Expand All @@ -64,16 +59,18 @@ 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 --without-hashes --with dev --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 app
RUN pip install -c constraints.txt -e .
RUN --mount=type=cache,target=/root/.cache/pip \
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 --mount=type=cache,target=/root/.cache/pip \
pip install -c constraints.txt -r poetry_freeze_dev.txt

COPY development/nautobot_config.py ${NAUTOBOT_ROOT}/nautobot_config.py
# !!! USE CAUTION WHEN MODIFYING LINES ABOVE
Loading

0 comments on commit 525f28b

Please sign in to comment.