Skip to content

Conversation

@atif09
Copy link

@atif09 atif09 commented Jan 24, 2026

this change introduces a DOCKER_TAG environment variable that allows users to pin specific image versions in .env file, both 'docker compose pull' and 'make pull' now work according to this variable, ensuring consistent version behavior across all deployment methods

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

Closes #554.

Description of Changes

  • Add DOCKER_TAG=latest to .env file
  • Update all OpenWISP image tags in docker-compose.yml to use ${DOCKER_TAG:-latest}
  • Update Makefile to include .env and use DOCKER_TAG when retagging images

Screenshot

version pinning test:

with DOCKER_TAG=25.10.0 in .env
image

…#554

this change introduces a DOCKER_TAG environment variable that allows
users to pin specific image versions in .env file. Both 'docker compose pull'
and 'make pull' now respect this variable, ensuring consistent version
behavior across all deployment methods.

Changes:
- Add DOCKER_TAG=latest to .env file
- Update all OpenWISP image tags in docker-compose.yml to use ${DOCKER_TAG:-latest}
- Update Makefile to include .env and use DOCKER_TAG when retagging images

Fixes openwisp#554
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Walkthrough

Added DOCKER_TAG to .env. Updated Makefile to source and export .env and to use DOCKER_TAG (falling back to latest) when constructing image tags. Updated docker-compose.yml to parameterize service image tags as ${DOCKER_TAG:-latest} for all services. No other service configuration, dependencies, volumes, networking, or exported/public interfaces were changed.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Env as .env
    participant Make as Makefile
    participant Compose as docker-compose
    participant Registry as Docker Registry

    Dev->>Env: add DOCKER_TAG (e.g., 25.10.0)
    Dev->>Make: run make pull / other make targets
    Make->>Env: source and export DOCKER_TAG
    Make->>Registry: pull openwisp/<image>:$${DOCKER_TAG:-latest}
    Dev->>Compose: docker compose pull
    Compose->>Env: read DOCKER_TAG (may be unset)
    Compose->>Registry: pull openwisp/<image>:$${DOCKER_TAG:-latest}
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: introducing a DOCKER_TAG variable for version pinning to prevent accidental upgrades.
Description check ✅ Passed The description covers the key changes, references the linked issue #554, includes manual testing evidence via screenshot, and completes the main checklist items.
Linked Issues check ✅ Passed All code changes align with issue #554 objectives: DOCKER_TAG variable enables version pinning, docker-compose.yml uses parameterized tags, and Makefile respects the variable.
Out of Scope Changes check ✅ Passed All changes directly address the linked issue #554 requirements; no unrelated modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa3db97 and 064b758.

📒 Files selected for processing (1)
  • .env
⏰ 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 comments (1)
.env (1)

7-8: Looks good — DOCKER_TAG default is clear and consistent.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

Copy link

@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

🤖 Fix all issues with AI agents
In @.env:
- Line 66: Move the DOCKER_TAG entry so it appears before EMAIL_DJANGO_DEFAULT
in the .env file to satisfy the dotenv-linter key ordering, and ensure the file
ends with a single trailing newline (add a blank line at EOF) so the linter no
longer reports a missing newline; update the DOCKER_TAG line (the literal key
"DOCKER_TAG") and verify EMAIL_DJANGO_DEFAULT remains unchanged.

In `@Makefile`:
- Line 26: The docker tag command can fail when DOCKER_TAG is empty; update the
recipe to use a fallback default for DOCKER_TAG (compose uses "latest") so the
tag is valid even if .env is missing. Locate the docker tag line in the Makefile
that references $${DOCKER_TAG} and replace it with a parameter expansion
fallback (e.g., use $${DOCKER_TAG:-latest}) so the command uses "latest" when
DOCKER_TAG is unset while keeping existing variables USER, image and TAG
unchanged.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 671eba3 and 89e27f0.

📒 Files selected for processing (3)
  • .env
  • Makefile
  • docker-compose.yml
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-01-06T11:56:48.600Z
Learnt from: pandafy
Repo: openwisp/docker-openwisp PR: 549
File: docker-compose.yml:85-85
Timestamp: 2026-01-06T11:56:48.600Z
Learning: In docker-openwisp projects, ensure CELERY_SERVICE_NETWORK_MODE is set to an empty string "" (which Docker Compose treats as unset/null). This allows containers to connect via the Compose default network with correct service name DNS resolution. Using "bridge" as the value disables service name resolution and breaks communication between celery, dashboard, postgres, and redis. Apply this guideline to docker-compose.yml files in the repository and any similar Compose files where CELERY services rely on service name DNS.

Applied to files:

  • docker-compose.yml
📚 Learning: 2026-01-06T11:55:13.672Z
Learnt from: pandafy
Repo: openwisp/docker-openwisp PR: 549
File: docker-compose.yml:85-85
Timestamp: 2026-01-06T11:55:13.672Z
Learning: In docker-compose.yml files, avoid leaving CELERY_SERVICE_NETWORK_MODE as an empty string; an empty value is ignored and Docker Compose falls back to default networking. Do not rely on setting CELERY_SERVICE_NETWORK_MODE to 'bridge' for celery services, as this will not affect their networking. If specific networking is required for celery services, define and attach explicit networks in the compose file and reference them on the celery services.

Applied to files:

  • docker-compose.yml
📚 Learning: 2026-01-06T11:28:41.789Z
Learnt from: pandafy
Repo: openwisp/docker-openwisp PR: 549
File: docker-compose.yml:171-171
Timestamp: 2026-01-06T11:28:41.789Z
Learning: In docker-openwisp, the OpenVPN container (images/common/init_command.sh) exits silently with exit code 0 when VPN_DOMAIN environment variable is not set. Combined with restart policy "on-failure" in docker-compose.yml, this prevents the container from restarting when VPN is disabled.

Applied to files:

  • docker-compose.yml
🪛 dotenv-linter (4.0.0)
.env

[warning] 66-66: [EndingBlankLine] No blank line at the end of the file

(EndingBlankLine)


[warning] 66-66: [UnorderedKey] The DOCKER_TAG key should go before the EMAIL_DJANGO_DEFAULT key

(UnorderedKey)

⏰ 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 comments (2)
Makefile (1)

4-6: LGTM — .env inclusion/export enables tag propagation.

docker-compose.yml (1)

15-15: LGTM — parameterized tags meet pinning objective and keep defaults.

Also applies to: 38-38, 58-58, 73-73, 88-88, 102-102, 116-116, 143-143, 159-159, 170-170

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Move DOCKER_TAG variable placement in .env file to satisfy
alphabetical ordering requirements and add missing EOF newline.
Update Makefile to use fallback value for DOCKER_TAG variable.

Related to openwisp#554
@atif09 atif09 force-pushed the issues/554-fix-docker-tag branch from f60f251 to a4f27a0 Compare January 24, 2026 09:44
@nemesifier nemesifier changed the title [docker-compose] add DOCKER_TAG variable for version pinning to match intended release version [fix] add DOCKER_TAG variable for version pinning to match intended release version Jan 31, 2026
@nemesifier nemesifier added the bug Something isn't working label Jan 31, 2026
@nemesifier nemesifier requested a review from pandafy January 31, 2026 16:19
@github-project-automation github-project-automation bot moved this from In progress to Reviewer approved in OpenWISP Priorities for next releases Jan 31, 2026
@github-project-automation github-project-automation bot moved this from To do (general) to In progress in OpenWISP Contributor's Board Jan 31, 2026
.env Outdated
SSH_PRIVATE_KEY_PATH=/home/openwisp/.ssh/id_ed25519
SSH_PUBLIC_KEY_PATH=/home/openwisp/.ssh/id_ed25519.pub
VPN_DOMAIN=openvpn.openwisp.org
DOCKER_TAG=25.10.0
Copy link
Member

Choose a reason for hiding this comment

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

Do we have to change this every time we release a bugfix version?

Ideally we shouldn't, right @pandafy?
How do we deal with edge images?

Copy link
Author

@atif09 atif09 Jan 31, 2026

Choose a reason for hiding this comment

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

i had committed the changes without changing this variable back to latest while testing for version pinning for 25.10.0, sorry for this

this being set to latest avoids changing this variable everytime there is a bugfix

atif09 and others added 2 commits January 31, 2026 22:01
Keeping DOCKER_TAG=latest avoids manual updating with each release, users will have to change this to the specific version by explicitly setting it to the desired version

Related to openwisp#554
Copy link

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.env (1)

5-12: ⚠️ Potential issue | 🟡 Minor

Fix dotenv-linter key ordering for DOCKER_TAG.

dotenv-linter expects DOCKER_TAG to appear before SSH_PRIVATE_KEY_PATH. Please reorder to satisfy lint rules.

♻️ Proposed fix
 DASHBOARD_DOMAIN=dashboard.openwisp.org
 API_DOMAIN=api.openwisp.org
+# Image tag pinning
+DOCKER_TAG=latest
 # SSH Credentials Configurations
 SSH_PRIVATE_KEY_PATH=/home/openwisp/.ssh/id_ed25519
 SSH_PUBLIC_KEY_PATH=/home/openwisp/.ssh/id_ed25519.pub
 VPN_DOMAIN=openvpn.openwisp.org
-DOCKER_TAG=latest
 EMAIL_DJANGO_DEFAULT=example@example.org
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e2f706 and aa3db97.

📒 Files selected for processing (1)
  • .env
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-06T11:28:41.789Z
Learnt from: pandafy
Repo: openwisp/docker-openwisp PR: 549
File: docker-compose.yml:171-171
Timestamp: 2026-01-06T11:28:41.789Z
Learning: In docker-openwisp, the OpenVPN container (images/common/init_command.sh) exits silently with exit code 0 when VPN_DOMAIN environment variable is not set. Combined with restart policy "on-failure" in docker-compose.yml, this prevents the container from restarting when VPN is disabled.

Applied to files:

  • .env
🪛 dotenv-linter (4.0.0)
.env

[warning] 11-11: [UnorderedKey] The DOCKER_TAG key should go before the SSH_PRIVATE_KEY_PATH key

(UnorderedKey)

⏰ 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

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

dotenv-linter expects DOCKER_TAG to appear before SSH_PRIVATE_KEY_PATH

Related to openwisp#554
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

BTW we have an OPENWISP_VERSION var in the makefile.

However, I ask @pandafy to review this.

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

Labels

bug Something isn't working

Projects

Status: In progress
Status: Reviewer approved

Development

Successfully merging this pull request may close these issues.

[bug] docker-compose uses 'latest' tags; should use version numbers

2 participants