Skip to content

[change] Migrated OpenWISP modules to the 1.3 pre-release line#625

Open
CodingWithSaksham wants to merge 1 commit into
openwisp:masterfrom
CodingWithSaksham:issues/1.3-migration
Open

[change] Migrated OpenWISP modules to the 1.3 pre-release line#625
CodingWithSaksham wants to merge 1 commit into
openwisp:masterfrom
CodingWithSaksham:issues/1.3-migration

Conversation

@CodingWithSaksham
Copy link
Copy Markdown
Contributor

Repointed all OpenWISP app sources in images/openwisp_base/Dockerfile to the shared 1.3 branch (monitoring, firmware, topology, radius, controller, notifications, users) so the interdependent core moves as one unit (utils/ipam resolve transitively). Temporary until the 1.3 line is released.

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Related to #587

Description of Changes

  • urls.py: register the firmware-upgrader "upgrader" URL namespace; the 1.3 device-admin inline reverses upgrader:..., else the device change page 500s.
  • load_init_data.py: dedup the "SSH Keys" template by name. controller 1.3 made config a JSONB field, so config__contains no longer substring-matches and the old guard caused a duplicate-insert crash loop.

Repointed all OpenWISP app sources in images/openwisp_base/Dockerfile to the shared 1.3 branch (monitoring, firmware, topology, radius, controller, notifications, users) so the interdependent core moves as one unit (utils/ipam resolve transitively). Temporary until the 1.3 line is released.

Includes the two dashboard fixes required to run on 1.3:
- urls.py: register the firmware-upgrader "upgrader" URL namespace; the 1.3 device-admin inline reverses upgrader:..., else the device change page 500s.
- load_init_data.py: dedup the "SSH Keys" template by name. controller 1.3 made config a JSONB field, so config__contains no longer substring-matches and the old guard caused a duplicate-insert crash loop.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates the OpenWISP Docker image build process and dashboard configuration. The Dockerfile now splits system package installation into separate layers and migrates core OpenWISP module sources from PyPI version constraints to GitHub tarball URLs (v1.3), with custom modules (controller, notifications, users) now defaulting to GitHub sources instead of requiring manual ARG overrides. The dashboard load_init_data.py changes SSH key template detection to use name and default flag matching instead of config content inspection. Finally, the dashboard URLs are updated to include firmware upgrader routes alongside private-storage-backed firmware routes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • pandafy
  • nemesifier

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Bug Fixes ❌ Error Two bugs fixed without regression tests: device change page 500 error and SSH Keys template duplicate crash. No tests verify these fixes or check failure if patches removed. Add regression tests: (1) verify firmware_upgrader URL namespace prevents device change page 500 error; (2) verify SSH Keys template deduplication prevents duplicates; include Selenium test for device change page.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required format with [change] prefix and clearly summarizes the main change: migrating OpenWISP modules to the 1.3 pre-release line, which aligns with the primary modification across the Dockerfile and related configuration files.
Description check ✅ Passed The description includes most required sections from the template: a checked checklist, a reference to issue #587, and detailed explanation of changes. The checklist shows the contributor read guidelines and tested manually, though test cases and documentation updates are not completed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +9 to +12
apt-get install --yes --no-install-recommends \
libcairo2 apt-utils libpangocairo-1.0-0 \
gdal-bin gettext fping openssh-client && \
rm -rf /var/lib/apt/lists/* /root/.cache/pip/* /tmp/*
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes done by hadolint, Will have to keep. Same with R15-17, 20, 22, , 52-54, 57-59, 62-64, 72-73, 102-178

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@images/openwisp_base/Dockerfile`:
- Around line 33-44: The Dockerfile currently installs OpenWISP packages using
moving branch tarball URLs via ARGs (OPENWISP_MONITORING_SOURCE,
OPENWISP_FIRMWARE_SOURCE, OPENWISP_TOPOLOGY_SOURCE, OPENWISP_RADIUS_SOURCE);
update each ARG value to point to a fixed release tag or commit SHA tarball URL
(or a stable release archive URL) instead of refs/heads/1.3 to make builds
reproducible, and update any corresponding build docs or CI variables that
override these ARGs so they supply the pinned tag/SHA.

In `@images/openwisp_dashboard/load_init_data.py`:
- Around line 170-172: The current check only returns an existing Template when
name="SSH Keys" AND default=True, which allows duplicates; change the logic in
load_init_data.py where you search Templates so you first look up
Template.objects.filter(name="SSH Keys").first(), and if found set its
default=True (save it) and return it instead of creating a new one; only proceed
to create a new Template if no Template with name="SSH Keys" exists. Update
references to the Template model access in that function accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3ab72fcf-f390-451c-8fa0-e958559a010b

📥 Commits

Reviewing files that changed from the base of the PR and between 8bf91c8 and e22c1b8.

📒 Files selected for processing (3)
  • images/openwisp_base/Dockerfile
  • images/openwisp_dashboard/load_init_data.py
  • images/openwisp_dashboard/urls.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CI Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{py,html}

📄 CodeRabbit inference engine (Custom checks)

For Django pull requests, ensure all user-facing strings are marked as translatable using the Django i18n framework

Files:

  • images/openwisp_dashboard/load_init_data.py
  • images/openwisp_dashboard/urls.py
🪛 Checkov (3.2.529)
images/openwisp_base/Dockerfile

[low] 1-178: Ensure that HEALTHCHECK instructions have been added to container images

(CKV_DOCKER_2)

🪛 Trivy (0.69.3)
images/openwisp_base/Dockerfile

[error] 101-178: Secrets passed via build-args or envs or copied secret files

Possible exposure of secret env "DJANGO_SECRET_KEY" in ENV

Rule: DS-0031

Learn more

(IaC/Dockerfile)


[error] 101-178: Secrets passed via build-args or envs or copied secret files

Possible exposure of secret env "EMAIL_HOST_PASSWORD" in ENV

Rule: DS-0031

Learn more

(IaC/Dockerfile)


[error] 101-178: Secrets passed via build-args or envs or copied secret files

Possible exposure of secret env "SSH_PRIVATE_KEY_PATH" in ENV

Rule: DS-0031

Learn more

(IaC/Dockerfile)

🔇 Additional comments (4)
images/openwisp_base/Dockerfile (3)

19-24: LGTM!


54-68: LGTM!


101-178: LGTM!

images/openwisp_dashboard/urls.py (1)

40-44: Check potential URL resolution conflicts for firmware includes

  • images/openwisp_dashboard/urls.py mounts both openwisp_firmware_upgrader.urls and openwisp_firmware_upgrader.private_storage.urls at path("", ...); if they define overlapping root-level patterns (e.g., serve_private_file), the first include will win and the private-storage routes could be shadowed.
  • This repository does not include the openwisp_firmware_upgrader URL modules (imports fail here), so the actual pattern overlap can’t be assessed locally; inspect the upstream openwisp_firmware_upgrader.urls vs openwisp_firmware_upgrader.private_storage.urls to ensure they don’t collide (or that ordering is intentionally safe).

Comment on lines +33 to 44
ARG OPENWISP_MONITORING_SOURCE="https://github.com/openwisp/openwisp-monitoring/archive/refs/heads/1.3.tar.gz"
# hadolint ignore=DL3013
RUN pip install --no-cache-dir --user --upgrade ${OPENWISP_MONITORING_SOURCE}
ARG OPENWISP_FIRMWARE_SOURCE="openwisp-firmware-upgrader~=1.2.0"
ARG OPENWISP_FIRMWARE_SOURCE="https://github.com/openwisp/openwisp-firmware-upgrader/archive/refs/heads/1.3.tar.gz"
# hadolint ignore=DL3013
RUN pip install --no-cache-dir --user --upgrade ${OPENWISP_FIRMWARE_SOURCE}
ARG OPENWISP_TOPOLOGY_SOURCE="openwisp-network-topology~=1.2.0"
ARG OPENWISP_TOPOLOGY_SOURCE="https://github.com/openwisp/openwisp-network-topology/archive/refs/heads/1.3.tar.gz"
# hadolint ignore=DL3013
RUN pip install --no-cache-dir --user --upgrade ${OPENWISP_TOPOLOGY_SOURCE}
ARG OPENWISP_RADIUS_SOURCE="openwisp-radius~=1.2.0"
ARG OPENWISP_RADIUS_SOURCE="https://github.com/openwisp/openwisp-radius/archive/refs/heads/1.3.tar.gz"
# hadolint ignore=DL3013
RUN pip install --no-cache-dir --user --upgrade ${OPENWISP_RADIUS_SOURCE}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify GitHub tarball URLs for OpenWISP 1.3 branches are accessible

urls=(
  "https://github.com/openwisp/openwisp-monitoring/archive/refs/heads/1.3.tar.gz"
  "https://github.com/openwisp/openwisp-firmware-upgrader/archive/refs/heads/1.3.tar.gz"
  "https://github.com/openwisp/openwisp-network-topology/archive/refs/heads/1.3.tar.gz"
  "https://github.com/openwisp/openwisp-radius/archive/refs/heads/1.3.tar.gz"
  "https://github.com/openwisp/openwisp-controller/archive/refs/heads/1.3.tar.gz"
  "https://github.com/openwisp/openwisp-notifications/archive/refs/heads/1.3.tar.gz"
  "https://github.com/openwisp/openwisp-users/archive/refs/heads/1.3.tar.gz"
)

for url in "${urls[@]}"; do
  echo "Checking: $url"
  if curl --head --silent --fail "$url" > /dev/null 2>&1; then
    echo "✓ Accessible"
  else
    echo "✗ Failed"
  fi
done

Repository: openwisp/docker-openwisp

Length of output: 782


images/openwisp_base/Dockerfile: GitHub refs/heads/1.3 tarball URLs are reachable; consider pinning for reproducible builds
The refs/heads/1.3.tar.gz tarball URLs for the listed OpenWISP modules (including monitoring, firmware-upgrader, network-topology, radius, controller, notifications, users) are accessible, so the migration doesn’t appear to break due to missing branches. Still, using a moving heads/1.3 reference makes builds non-reproducible—pin to a specific tag or commit SHA for stability.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@images/openwisp_base/Dockerfile` around lines 33 - 44, The Dockerfile
currently installs OpenWISP packages using moving branch tarball URLs via ARGs
(OPENWISP_MONITORING_SOURCE, OPENWISP_FIRMWARE_SOURCE, OPENWISP_TOPOLOGY_SOURCE,
OPENWISP_RADIUS_SOURCE); update each ARG value to point to a fixed release tag
or commit SHA tarball URL (or a stable release archive URL) instead of
refs/heads/1.3 to make builds reproducible, and update any corresponding build
docs or CI variables that override these ARGs so they supply the pinned tag/SHA.

Comment on lines +170 to +172
existing = Template.objects.filter(name="SSH Keys", default=True).first()
if existing:
return existing
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for migration documentation or tests covering template lookup changes

# Check for migration guides or upgrade documentation
fd -e md -e rst -e txt | xargs rg -l "SSH.{0,10}Keys.{0,20}template" 2>/dev/null

# Check for related test coverage
fd -g '*test*.py' | xargs rg -A 5 'create_ssh_key_template' 2>/dev/null

# Look for duplicate template handling in the codebase
rg -n "Template\.objects\.filter.*name.*SSH" --type py

Repository: openwisp/docker-openwisp

Length of output: 194


Prevent duplicate “SSH Keys” templates when upgrading existing deployments.

  • The template reuse only matches Template.objects.filter(name="SSH Keys", default=True).first(), so an existing template with name="SSH Keys" but default=False (or with a renamed template) can cause the code to take the creation path and end up with multiple “SSH Keys” templates.
  • No tests/docs addressing this edge case were found in the current repo scope.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@images/openwisp_dashboard/load_init_data.py` around lines 170 - 172, The
current check only returns an existing Template when name="SSH Keys" AND
default=True, which allows duplicates; change the logic in load_init_data.py
where you search Templates so you first look up
Template.objects.filter(name="SSH Keys").first(), and if found set its
default=True (save it) and return it instead of creating a new one; only proceed
to create a new Template if no Template with name="SSH Keys" exists. Update
references to the Template model access in that function accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant