[client] Simplify entrypoint by running netbird up unconditionally#5652
[client] Simplify entrypoint by running netbird up unconditionally#5652
Conversation
📝 WalkthroughWalkthroughRemoved Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Entrypoint as "Container ENTRYPOINT\n(/netbird-entrypoint.sh)" rect rgba(150,200,255,0.5)
participant Daemon as "Netbird daemon" rect rgba(200,255,200,0.5)
participant CLI as "netbird CLI" rect rgba(255,230,150,0.5)
participant StatusSvc as "Status RPC / Probes" rect rgba(255,200,200,0.5)
Entrypoint->>Daemon: wait_for_daemon_startup()
Daemon-->>Entrypoint: ready
Entrypoint->>CLI: connect() -> run `netbird up`
CLI->>Daemon: control plane connection / start
CLI-->>Entrypoint: exit status
Note over StatusSvc,Daemon: Health/status checks now call getStatus(..., ShouldRunProbes=false)
StatusSvc->>Daemon: getStatus(request with ShouldRunProbes=false)
Daemon-->>StatusSvc: status (no probe execution)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
client/netbird-entrypoint.sh (1)
53-56: LGTM!The simplified
connect()function cleanly replaces the previous polling logic. Sinceset -eEuo pipefailis enabled, the script will exit on failure fromnetbird up.Regarding the SonarCloud hint about adding an explicit
return: this is optional givenset -e, but addingreturn $?orreturn 0could make the success path more explicit if preferred.,
🔧 Optional: Add explicit return for clarity
connect() { info "running 'netbird up'..." "${NETBIRD_BIN}" up + return $? }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@client/netbird-entrypoint.sh` around lines 53 - 56, The connect() function currently runs "${NETBIRD_BIN}" up and relies on set -e for failure handling; add an explicit return to make the success/failure outcome clear by returning the command's exit status (e.g., use the existing NETBIRD_BIN invocation and then return "$?" or return 0 on success) — update the connect() function to capture/forward the exit code from "${NETBIRD_BIN}" up so callers see the explicit result.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@client/netbird-entrypoint.sh`:
- Around line 53-56: The connect() function currently runs "${NETBIRD_BIN}" up
and relies on set -e for failure handling; add an explicit return to make the
success/failure outcome clear by returning the command's exit status (e.g., use
the existing NETBIRD_BIN invocation and then return "$?" or return 0 on success)
— update the connect() function to capture/forward the exit code from
"${NETBIRD_BIN}" up so callers see the explicit result.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2bb61e99-cc8e-496f-b287-0a9f298d1fe1
📒 Files selected for processing (3)
client/Dockerfileclient/Dockerfile-rootlessclient/netbird-entrypoint.sh
7bdf930 to
e354e26
Compare
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@client/cmd/status.go`:
- Line 221: The startup path is passing a hardcoded ShouldRunProbes=false into
getStatus, causing startup checks to use async ProbeAll (stale cached state)
instead of blocking ProbeAllWaitResult; update the call in status.go (the
getStatus invocation used by checkStartup) to pass a true/locking probe flag for
startup (e.g., use isStartup for the third arg or explicitly true when isStartup
is true) so startup calls run blocking probes while keeping live/ready checks
using async probes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 46f15a1c-3e36-4680-a7ea-7f4da176e881
📒 Files selected for processing (4)
client/Dockerfileclient/Dockerfile-rootlessclient/cmd/status.goclient/netbird-entrypoint.sh
🚧 Files skipped from review as they are similar to previous changes (3)
- client/Dockerfile
- client/Dockerfile-rootless
- client/netbird-entrypoint.sh



Describe your changes
Replace
login_if_neededpolling loop with unconditionalnetbird upcall, which is a no-op when already connectedRemove
NB_ENTRYPOINT_LOGIN_TIMEOUTenv var from entrypoint and both Dockerfiles since it is no longer neededStop running STUN/TURN probes for
--check startup: the relay status recorder already tracks availability in real time, andcheckStartuponly checks relay connectivity (not STUN/TURN)Issue ticket number and link
Follow-up to #5650
Stack
Checklist
Documentation
Select exactly one:
Entrypoint behavior change only. No user-facing CLI or API changes.
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
Summary by CodeRabbit