feat: add enterprise network configuration support#3274
feat: add enterprise network configuration support#3274austenstone wants to merge 24 commits intointegrations:mainfrom
Conversation
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
|
Your validation commands would not actually run the tests. You should use make testacc and make test |
This comment was marked as resolved.
This comment was marked as resolved.
tag-assistant
left a comment
There was a problem hiding this comment.
Re-review ✅
All previous feedback addressed, plus some nice extras:
Addressed:
- ✅ Shared
runnerGroupNetworkingstruct + helpers inresource_github_actions_runner_group_networking.go— clean dedup - ✅
getRunnerGroupNetworkingnow takes a path string, works for both org and enterprise scopes - ✅ Trailing newline fixed on enterprise docs
- ✅
StatusNotModifiedhandling added togetRunnerGroupNetworking— consistent with the rest of the codebase
Bonus improvements (not requested):
- 🧪 173-line unit test file for all three shared helpers (
get,update,setState) — including 304 handling and null payload for removal. Solid. - 🔧
normalizeEtag()in util.go to handle weak vs strong ETag drift between create and read paths — nice catch, prevents state churn. - 🧪 Unit tests for
normalizeEtagcovering empty, strong, weak, and whitespace cases.
LGTM. Ship it 🚢
| "network_configuration_id": networkConfigurationID, | ||
| } | ||
|
|
||
| req, err := client.NewRequest("PATCH", path, payload) |
There was a problem hiding this comment.
issue: use only go-github provided functions
There was a problem hiding this comment.
I checked go-github v83 locally before changing this — there isn’t a first-class runner-group networking method for this endpoint yet, so this still has to stay as a thin NewRequest/Do shim for now.
There was a problem hiding this comment.
With google/go-github#4099, UpdateOrganizationRunnerGroup now accepts NetworkConfigurationID in the request struct, and GetOrganizationRunnerGroup returns it on the response. So yes — once that merges, this raw call can be replaced with the native go-github UpdateOrganizationRunnerGroup/UpdateEnterpriseRunnerGroup functions and the separate getRunnerGroupNetworking GET becomes unnecessary too.
There was a problem hiding this comment.
Org side is now fully native — no more raw calls for org runner groups. The helpers file is still needed for enterprise since go-github hasn't released a version with NetworkConfigurationID on EnterpriseRunnerGroup / UpdateEnterpriseRunnerGroupRequest yet (google/go-github#4099 merged but isn't in a release). Once that ships, a follow-up PR will switch enterprise to native functions and remove the helpers entirely.
| networkConfigurationIDValue := networkConfigurationID.(string) | ||
| // The create endpoint does not accept network_configuration_id, so private networking | ||
| // must be attached with a follow-up PATCH after the runner group has been created. | ||
| if _, err = updateRunnerGroupNetworking(client, ctx, fmt.Sprintf("orgs/%s/actions/runner-groups/%d", orgName, runnerGroup.GetID()), &networkConfigurationIDValue); err != nil { |
There was a problem hiding this comment.
Isn't this UpdateOrganizationRunnerGroup what you're looking for?
There was a problem hiding this comment.
Yes — once google/go-github#4099 merges, UpdateOrganizationRunnerGroup will carry NetworkConfigurationID natively and this raw call goes away.
There was a problem hiding this comment.
That doesn't make sense. The function already exists
There was a problem hiding this comment.
You're right — my earlier reply was wrong. I confused the org and enterprise types. UpdateOrganizationRunnerGroup already had NetworkConfigurationID in go-github; the missing field was only on the enterprise side.
Fixed — org Create and Update now pass NetworkConfigurationID natively via CreateRunnerGroupRequest / UpdateRunnerGroupRequest. The separate PATCH is gone. Read also pulls NetworkConfigurationID directly from the RunnerGroup response instead of the separate networking GET.
Enterprise still uses raw calls since go-github doesn't have NetworkConfigurationID on the enterprise types yet (added in google/go-github#4099, merged but not released). Will switch enterprise to native functions once that ships in a go-github release.
| } | ||
|
|
||
| func getRunnerGroupNetworking(client *github.Client, ctx context.Context, path string) (*runnerGroupNetworking, *github.Response, error) { | ||
| req, err := client.NewRequest("GET", path, nil) |
There was a problem hiding this comment.
If the functions don't exist in go-github, then you should open a PR in there to add them. We don't accept direct API endpoint interactions
…unner group types Add NetworkConfigurationID and HostedRunnersURL fields to EnterpriseRunnerGroup, and NetworkConfigurationID to CreateEnterpriseRunnerGroupRequest and UpdateEnterpriseRunnerGroupRequest to match the GitHub API response schema. These fields already exist on the organization-scoped RunnerGroup type but were missing from the enterprise equivalents. The GitHub API returns both fields on enterprise runner group endpoints (List, Get, Create, Update). Fixes: integrations/terraform-provider-github#3274
|
All review feedback addressed except the raw |
508630f to
022c485
Compare
…etwork configurations
…tation for network settings
…date related documentation
…d unit tests for normalization
…proved readability
… improve error handling
The response is always non-nil on the success path — if the API call errors we return early, and even the 304 Not Modified path returns a valid response object. The fallback to the stored ETag was unreachable.
- Use native NetworkConfigurationID on CreateRunnerGroupRequest and UpdateRunnerGroupRequest for org runner groups (already in go-github v83) - Read NetworkConfigurationID from RunnerGroup response instead of separate getRunnerGroupNetworking call for org runner groups - Exit early on 304 Not Modified in both org and enterprise Read - Add unit tests for 304 handling and NetworkConfigurationID deserialization - Enterprise runner groups still use raw API calls (go-github v83 lacks enterprise NetworkConfigurationID — will be addressed in v84 upgrade PR)
022c485 to
b46b622
Compare
deiga
left a comment
There was a problem hiding this comment.
Please mark this as Draft until the go-github version is released and an upgrade PR is merged. We will not accept PRs with direct API interactions
Overview
This PR adds enterprise-scoped hosted compute network configuration support for GitHub-hosted private networking.
It introduces a new
github_enterprise_network_configurationresource and addsnetwork_configuration_idsupport togithub_enterprise_actions_runner_groupso enterprise runner groups can be associated with hosted compute network configurations.This work is closely related to the organization-scoped implementation in #2895, and follows the same review-driven cleanup patterns to stay aligned with current project conventions.
What this PR adds
github_enterprise_network_configurationnetwork_configuration_idsupport ingithub_enterprise_actions_runner_groupNotes
network_configuration_id.network_configuration_id, so the provider applies the networking association with a follow-upPATCHafter creation.Create, safer GitHub error response checks, andConfigStateChecksfor the newer acceptance assertions.getOrganizationRunnerGroupnow only swallows304 Not Modifiedinstead of treating arbitraryErrorResponsevalues as cache hits.Createnow sets Terraform state directly from the create response and only falls back to a follow-upReadwhen the private networking association requires the extraPATCH.Validation
make testaccmake test