Skip to content

fix: Allow removing runner group networks - #4541

Open
austenstone wants to merge 1 commit into
google:masterfrom
austenstone:austenstone-runner-network-detachment
Open

fix: Allow removing runner group networks#4541
austenstone wants to merge 1 commit into
google:masterfrom
austenstone:austenstone-runner-network-detachment

Conversation

@austenstone

Copy link
Copy Markdown
Contributor

Add RemoveNetworkConfiguration to organization and enterprise runner-group update requests, following UpdateTeamRequest.RemoveParentTeam. Setting it sends "network_configuration_id": null and takes precedence over a supplied ID. Existing omission and string behavior is unchanged. Creates and responses are untouched.

Both PATCH schemas allow null: organization and enterprise.

Needed by integrations/terraform-provider-github#3274.

Regression tests cover omission, strings, explicit null, flag precedence, preservation of other fields, value/pointer marshaling without mutation, and both native PATCH methods. Targeted runner-group tests with -race, formatting, lint, and generator checks pass on Go 1.26.0. No live detachment was tested.

Copilot assisted with implementation, tests, and this description.

@google-cla

google-cla Bot commented Sep 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Add explicit removal flags for organization and enterprise runner group updates, preserving existing omission and string behavior.
@austenstone
austenstone force-pushed the austenstone-runner-network-detachment branch from 9788c28 to c4d4c88 Compare September 10, 2026 22:05
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Sep 10, 2026
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.54%. Comparing base (c5074ea) to head (c4d4c88).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4541   +/-   ##
=======================================
  Coverage   98.54%   98.54%           
=======================================
  Files         196      196           
  Lines       17938    17956   +18     
=======================================
+ Hits        17677    17695   +18     
  Misses        261      261           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


// If true, the network configuration is removed by sending null.
// This takes precedence over NetworkConfigurationID.
RemoveNetworkConfiguration bool `json:"-"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If I'm not mistaken, we can solve this in a different way without resorting to adding a new "hidden" field to the struct...

We simply change line 62 above to this:

NetworkConfigurationID   *string  `json:"network_configuration_id,omitzero"`

and then when the user doesn't initialize the field (it is nil), the field will be ignored.
However, if the user wants to REMOVE the network configuration, they would send new("").

I think we should put this in CONTRIBUTING.md on line 418 right after this comment:

For optional boolean fields where you need to distinguish between `false`
and "not set", use `*bool` with `omitzero`.

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

Labels

NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants