Skip to content

Commit

Permalink
3.6 support (#180)
Browse files Browse the repository at this point in the history
3.6 support
  • Loading branch information
ryanmerolle authored Mar 27, 2024
1 parent 175f8c3 commit 05be45c
Show file tree
Hide file tree
Showing 31 changed files with 494 additions and 464 deletions.
11 changes: 5 additions & 6 deletions .devcontainer/Dockerfile-plugin_dev
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
ARG NETBOX_VARIANT=v3.5
ARG NETBOX_VARIANT=v3.6

FROM netboxcommunity/netbox:${NETBOX_VARIANT}

ARG NETBOX_INITIALIZERS_VARIANT=3.5.*
ARG NETBOX_INITIALIZERS_VARIANT=3.6.*

ARG DEBIAN_FRONTEND=noninteractive

# Install APT packages
# hadolint ignore=DL3008
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends curl git make openssh-client python3.10-dev sudo wget zsh \
&& apt-get -y install --no-install-recommends curl git make openssh-client python3.11-dev sudo wget zsh \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*

# Install development & ide dependencies
COPY requirements-dev.txt /tmp/pip-tmp/
RUN /opt/netbox/venv/bin/python3 -m pip install --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements-dev.txt \
&& rm -rf /tmp/*

ARG USERNAME=vscode
ARG USERNAME=ubuntu
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN useradd -l -md /home/vscode -s /usr/bin/zsh -u $USER_UID $USERNAME \
&& usermod -aG sudo $USERNAME \
RUN usermod -aG sudo $USERNAME \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& mkdir /opt/netbox/netbox/netbox-acls \
&& chown $USERNAME:$USERNAME /opt/netbox /etc/netbox /opt/unit -R
Expand Down
363 changes: 194 additions & 169 deletions .devcontainer/configuration/configuration.py

Large diffs are not rendered by default.

206 changes: 96 additions & 110 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,121 +2,107 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/python-3-postgres
// Update the VARIANT arg in docker-compose.yml to pick a Python version
{
"name": "NetBox Plugin Development",
"dockerComposeFile": [
"docker-compose.yml",
"docker-compose.override.yml"
],
"service": "netbox",
//"workspaceMount": "source=${localWorkspaceFolder},target=/opt/netbox/netbox/netbox-acls,type=bind,consistency=cached",
"workspaceFolder": "/opt/netbox/netbox/netbox-acls",
"name": "NetBox Plugin Development",
"dockerComposeFile": ["docker-compose.yml", "docker-compose.override.yml"],
"service": "netbox",
//"workspaceMount": "source=${localWorkspaceFolder},target=/opt/netbox/netbox/netbox-acls,type=bind,consistency=cached",
"workspaceFolder": "/opt/netbox/netbox/netbox-acls",

"overrideCommand":false,
"overrideCommand": false,

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"editor.experimental.stickyScroll.enabled": true,
//"[python]": {
// "editor.codeActionsOnSave": {
// "source.organizeImports": true
// }
//},
"isort.args": [
"--profile=black"
],
"isort.path": "/opt/netbox/venv/bin/isort",
"python.analysis.typeCheckingMode": "strict",
python.Jedi
"python.analysis.extraPaths": [
"/opt/netbox/netbox"
],
"python.autoComplete.extraPaths": [
"/opt/netbox/netbox"
],
"python.defaultInterpreterPath": "/opt/netbox/venv/bin/python3",
"python.formatting.autopep8Path": "/opt/netbox/venv/bin/autopep8",
"python.formatting.blackPath": "/opt/netbox/venv/bin/black",
"python.formatting.provider": "black",
"python.formatting.yapfPath": "/opt/netbox/venv/bin/yapf",
"python.linting.banditPath": "/opt/netbox/venv/bin/bandit",
"python.linting.enabled": true,
"python.linting.flake8Path": "/opt/netbox/venv/bin/flake8",
"python.linting.flake8Args": [
"--max-line-length=160",
"--ignore=E203"
],
"python.linting.mypyPath": "//opt/netbox/venv/bin/mypy",
"python.linting.pycodestylePath": "/opt/netbox/venv/bin/pycodestyle",
"python.linting.pydocstylePath": "/opt/netbox/venv/bin/pydocstyle",
"python.linting.pylintArgs": [
"--load-plugins",
"pylint_django",
"--errors-only",
"--load-plugins=pylint_django",
"--django-settings-module=/opt/netbox/netbox/netbox/netbox.settings",
"--enable=W0602,W0611,W0612,W0613,W0614"
],
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/opt/netbox/venv/bin/pylint",
"python.linting.lintOnSave": true,
"python.pythonPath": "/opt/netbox/venv/bin/python3",
"python.terminal.activateEnvironment": true,
"python.venvPath": "/opt/netbox/",
"files.exclude": {
"**/node_modules": true,
"build": true,
"dist": true,
"*egg*": true
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"editor.experimental.stickyScroll.enabled": true,
//"[python]": {
// "editor.codeActionsOnSave": {
// "source.organizeImports": true
// }
//},
"isort.args": ["--profile=black"],
"isort.path": ["/opt/netbox/venv/bin/isort"],
"python.analysis.typeCheckingMode": "strict",
"python.analysis.extraPaths": ["/opt/netbox/netbox"],
"python.autoComplete.extraPaths": ["/opt/netbox/netbox"],
"python.defaultInterpreterPath": "/opt/netbox/venv/bin/python3",
"python.formatting.autopep8Path": "/opt/netbox/venv/bin/autopep8",
"python.formatting.blackPath": "/opt/netbox/venv/bin/black",
"python.formatting.provider": "black",
"python.formatting.yapfPath": "/opt/netbox/venv/bin/yapf",
"python.linting.banditPath": "/opt/netbox/venv/bin/bandit",
"python.linting.enabled": true,
"python.linting.flake8Path": "/opt/netbox/venv/bin/flake8",
"python.linting.flake8Args": ["--max-line-length=160", "--ignore=E203"],
"python.linting.mypyPath": "//opt/netbox/venv/bin/mypy",
"python.linting.pycodestylePath": "/opt/netbox/venv/bin/pycodestyle",
"python.linting.pydocstylePath": "/opt/netbox/venv/bin/pydocstyle",
"python.linting.pylintArgs": [
"--load-plugins",
"pylint_django",
"--errors-only",
"--load-plugins=pylint_django",
"--django-settings-module=/opt/netbox/netbox/netbox/netbox.settings",
"--enable=W0602,W0611,W0612,W0613,W0614"
],
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/opt/netbox/venv/bin/pylint",
"python.linting.lintOnSave": true,
"python.pythonPath": "/opt/netbox/venv/bin/python3",
"python.terminal.activateEnvironment": true,
"python.venvPath": "/opt/netbox/",
"files.exclude": {
"**/node_modules": true,
"build": true,
"dist": true,
"*egg*": true
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"DavidAnson.vscode-markdownlint",
"GitHub.codespaces",
"GitHub.copilot-labs",
"GitHub.vscode-pull-request-github",
"Gruntfuggly.todo-tree",
"Tyriar.sort-lines",
"aaron-bond.better-comments",
"batisteo.vscode-django",
"charliermarsh.ruff",
"codezombiech.gitignore",
"esbenp.prettier-vscode",
"exiasr.hadolint",
"formulahendry.auto-rename-tag",
"mintlify.document",
"ms-python.isort",
"ms-python.pylint",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.makefile-tools",
"mutantdino.resourcemonitor",
"oderwat.indent-rainbow",
"paulomenezes.duplicated-code",
"redhat.vscode-yaml",
"searKing.preview-vscode",
"sourcery.sourcery",
"wholroyd.jinja",
"yzhang.markdown-all-in-one"
]
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"DavidAnson.vscode-markdownlint",
"GitHub.codespaces",
"GitHub.copilot-labs",
"GitHub.vscode-pull-request-github",
"Gruntfuggly.todo-tree",
"Tyriar.sort-lines",
"aaron-bond.better-comments",
"batisteo.vscode-django",
"charliermarsh.ruff",
"codezombiech.gitignore",
"esbenp.prettier-vscode",
"exiasr.hadolint",
"formulahendry.auto-rename-tag",
"mintlify.document",
"ms-python.isort",
"ms-python.pylint",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.makefile-tools",
"mutantdino.resourcemonitor",
"oderwat.indent-rainbow",
"paulomenezes.duplicated-code",
"redhat.vscode-yaml",
"searKing.preview-vscode",
"sourcery.sourcery",
"wholroyd.jinja",
"yzhang.markdown-all-in-one"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
// "forwardPorts": [5000, 5432],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
// "forwardPorts": [5000, 5432],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip install --user -r requirements-dev.txt",
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip install --user -r requirements-dev.txt",

//"postAttachCommand": "source /opt/netbox/venv/bin/activate",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
//"postAttachCommand": "source /opt/netbox/venv/bin/activate",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "ubuntu"
}
8 changes: 4 additions & 4 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ services:
interval: 15s
test: "curl -f http://localhost:8080/api/ || exit 1"
volumes:
- ./configuration:/etc/netbox/config:z,ro
#- ./reports:/etc/netbox/reports:z,ro
#- ./scripts:/etc/netbox/scripts:z,ro
#- netbox-media-files:/opt/netbox/netbox/media:z
- ./configuration:/etc/netbox/config:ro
#- netbox-media-files:/opt/netbox/netbox/media:rw
#- netbox-reports-files:/opt/netbox/netbox/reports:rw
#- netbox-scripts-files:/opt/netbox/netbox/scripts:rw
#netbox-worker:
# <<: *netbox
# depends_on:
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/env/netbox.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ REDIS_DATABASE=0
REDIS_HOST=redis
REDIS_INSECURE_SKIP_TLS_VERIFY=false
REDIS_PASSWORD=H733Kdjndks81
SECRET_KEY=r8OwDznj!!dciP9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNjaa
SECRET_KEY='r(m)9nLGnz$(_q3N4z1k(EFsMCjjjzx08x9VhNVcfd%6RF#r!6DE@+V5Zk2X'
SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567
SUPERUSER_EMAIL=[email protected]
SUPERUSER_NAME=admin
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ autoflake
autopep8
bandit
black
coverage
flake8
isort
mypy
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ body:
attributes:
label: NetBox access-list plugin version
description: What version of the NetBox access-list plugin are you currently running?
placeholder: v1.3.0
placeholder: v1.4.0
validations:
required: true
- type: input
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v3.5.4
placeholder: v3.6.3
validations:
required: true
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ body:
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v3.5.4
placeholder: v3.6.3
validations:
required: true
- type: dropdown
Expand Down
15 changes: 11 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
---
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: pip
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
interval: "weekly"
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter/slim@v4
uses: github/super-linter/slim@v5
env:
DEFAULT_BRANCH: dev
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -40,8 +40,8 @@ jobs:
steps:
- id: git-checkout
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- id: docker-test
name: Test the image
run: ./test.sh snapshot
run: ./test.sh
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -57,7 +57,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -70,4 +70,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
uses: actions/dependency-review-action@v4
Loading

0 comments on commit 05be45c

Please sign in to comment.