Skip to content

[client] Add env and status flags for netbird service command #3975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

lixmal
Copy link
Collaborator

@lixmal lixmal commented Jun 13, 2025

Describe your changes

  • Adds a netbird service install --service-env flag to add permanent env vars
  • Adds a netbird service reconfigure [flags] command to reconfigure an already installed service
  • Adds a netbird service status command
  • Refactors common logic
  • Add tests

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

@lixmal lixmal marked this pull request as ready for review June 13, 2025 19:14
@Copilot Copilot AI review requested due to automatic review settings June 13, 2025 19:14
@lixmal lixmal changed the title [client] Add flag for netbird service extra env vars [client] Add env and status flags for netbird service command Jun 13, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Netbird CLI service commands by allowing permanent environment variables, adding new subcommands for reconfiguration and status reporting, and cleaning up shared setup logic. It also introduces tests covering service startup/shutdown and environment parsing.

  • Added --service-env flag with parsing for extra service environment variables
  • Implemented service reconfigure and service status subcommands
  • Refactored common installer/controller setup into reusable functions
  • Extended tests for service lifecycle and env var parsing

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
client/cmd/service.go Defined top-level service command, flags, and environment parsing
client/cmd/service_installer.go Refactored install/reconfigure workflows, built service config helper
client/cmd/service_controller.go Centralized control-command setup, streamlined start/stop/restart
client/cmd/service_test.go Added lifecycle tests and parseServiceEnvVars unit tests
client/cmd/root.go Removed legacy service flags and moved service command registration
.github/workflows/golang-test-linux.yml Inject CONTAINER env to skip service tests in container runs
Comments suppressed due to low confidence (1)

client/cmd/service_installer.go:156

  • Introduce unit tests for the new service reconfigure and service status commands to verify their behavior and improve overall coverage.
var reconfigureCmd = &cobra.Command{

cmd.SetOut(cmd.OutOrStdout())

err := handleRebrand(cmd)
ctx, cancel := context.WithCancel(cmd.Context())
Copy link
Preview

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding defer cancel() immediately after creating the context to ensure any associated resources are released when the command completes.

Suggested change
ctx, cancel := context.WithCancel(cmd.Context())
ctx, cancel := context.WithCancel(cmd.Context())
defer cancel()

Copilot uses AI. Check for mistakes.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

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