Skip to content

fix!: CreateHostedRunnerRequest, UpdateHostedRunnerRequest instead of HostedRunnerRequest#3973

Merged
gmlewis merged 4 commits intogoogle:masterfrom
alexandear-org:fix/update-hosted-runner
Feb 6, 2026
Merged

fix!: CreateHostedRunnerRequest, UpdateHostedRunnerRequest instead of HostedRunnerRequest#3973
gmlewis merged 4 commits intogoogle:masterfrom
alexandear-org:fix/update-hosted-runner

Conversation

@alexandear
Copy link
Contributor

@alexandear alexandear commented Feb 5, 2026

BREAKING CHANGE: ActionsService.CreateHostedRunner and EnterpriseService.CreateHostedRunner now accept CreateHostedRunnerRequest; ActionsService.UpdateHostedRunner and EnterpriseService.UpdateHostedRunner now accept UpdateHostedRunnerRequest.


While working on #3972, I found that ActionsService.UpdateHostedRunner accepts HostedRunnerRequest as a body. But it's wrong according to the docs for actions and enterprise.

Current:

type HostedRunnerRequest struct {
	Name           string            `json:"name,omitempty"`
	Image          HostedRunnerImage `json:"image,omitempty"`
	RunnerGroupID  int64             `json:"runner_group_id,omitempty"`
	Size           string            `json:"size,omitempty"`
	MaximumRunners int64             `json:"maximum_runners,omitempty"`
	EnableStaticIP bool              `json:"enable_static_ip,omitempty"`
	ImageVersion   string            `json:"image_version,omitempty"`
}

Should be image_id (optional) instead of the Image. So, I created a separate struct UpdateHostedRunnerRequest with an optional image_id and the rest of the fields (all optional).

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.53%. Comparing base (3260322) to head (ae9b930).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3973   +/-   ##
=======================================
  Coverage   93.52%   93.53%           
=======================================
  Files         207      207           
  Lines       17600    17586   -14     
=======================================
- Hits        16461    16449   -12     
+ Misses        938      937    -1     
+ Partials      201      200    -1     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

So HostedRunnerRequest has both image_version and image.version? That seems odd.

In other parts of this repo, we reuse structs and add comments for fields that are used by one endpoint and not another... so are you thinking that splitting this struct into two separate use cases is going to reduce end-user confusion, and therefore is a desirable change?

@alexandear
Copy link
Contributor Author

We can't reuse structs in this case. They are different. And yes, splitting this struct into two separate use cases:

  1. fixes Update methods.
  2. reduces end-user confusion (optional-required fields).

Here are comparison with Copilot:

Field Create Update Required in Create Required in Update
name Required Optional
image (object with id and source) - Required -
size Required Optional
runner_group_id Required Optional
maximum_runners Optional Optional
enable_static_ip Optional Optional
image_gen - Optional (default: false) -
image_id - - Optional
image_version - - Optional (can be null)
Raw doc screenshots

Create body:

image image

Update body:

image

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Feb 5, 2026
@alexandear alexandear changed the title fix!: Pass UpdateHostedRunnerRequest to UpdateHostedRunner fix!: CreateHostedRunnerRequest, UpdateHostedRunnerRequest instead of HostedRunnerRequest Feb 6, 2026
@alexandear alexandear requested a review from gmlewis February 6, 2026 12:11
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @alexandear!
One nit, otherwise LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

Copy link
Contributor

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra left a comment

Choose a reason for hiding this comment

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

LGTM

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Feb 6, 2026
@gmlewis
Copy link
Collaborator

gmlewis commented Feb 6, 2026

Thank you, @Not-Dhananjay-Mishra!
Merging.

@gmlewis gmlewis merged commit 521b62a into google:master Feb 6, 2026
8 checks passed
@alexandear alexandear deleted the fix/update-hosted-runner branch February 6, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants