refactor!: Pass CreateJITConfigRequest by value and rename Generate*JITConfig to Create*JITConfig#4337
Conversation
…ethods Continues the google#3644 value-parameter migration. GenerateJITConfigRequest is a request-only struct that already matches the API request schema (required name/runner_group_id/labels, optional work_folder) and already uses the `...Request` suffix, so this is a pure pointer->value conversion with no struct changes. - GenerateOrgJITConfig and GenerateRepoJITConfig (actions_runners.go) and GenerateEnterpriseJITConfig (enterprise_actions_runners.go) now take GenerateJITConfigRequest by value instead of *GenerateJITConfigRequest. All three share the same request type, so all are converted together. - Drop GenerateJITConfigRequest from the paramcheck body-allowed-pointer-types allowlist in .golangci.yml. BREAKING CHANGE: GenerateOrgJITConfig, GenerateRepoJITConfig and GenerateEnterpriseJITConfig now take GenerateJITConfigRequest by value. Updates google#3644
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4337 +/- ##
=======================================
Coverage 97.48% 97.48%
=======================================
Files 193 193
Lines 19417 19417
=======================================
Hits 18929 18929
Misses 270 270
Partials 218 218 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
GenerateJITConfigRequest by value in the JIT config methods
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @JamBalaya56562!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
Not-Dhananjay-Mishra
left a comment
There was a problem hiding this comment.
let's also update JITRunnerConfig to match the schema. There are some missing fields (runner_group_id, ephemeral, version)
{
"type": "object",
"required": [
"runner",
"encoded_jit_config"
],
"properties": {
"runner": {
"title": "Self hosted runners",
"description": "A self hosted runner",
"type": "object",
"properties": {
"id": {
"description": "The ID of the runner.",
"type": "integer"
},
"runner_group_id": {
"description": "The ID of the runner group.",
"type": "integer"
},
"name": {
"description": "The name of the runner.",
"type": "string"
},
"os": {
"description": "The Operating System of the runner.",
"type": "string"
},
"status": {
"description": "The status of the runner.",
"type": "string"
},
"busy": {
"type": "boolean"
},
"labels": {
"type": "array",
"items": {
"title": "Self hosted runner label",
"description": "A label for a self hosted runner",
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Unique identifier of the label."
},
"name": {
"type": "string",
"description": "Name of the label."
},
"type": {
"type": "string",
"description": "The type of label. Read-only labels are applied automatically when the runner is configured.",
"enum": [
"read-only",
"custom"
]
}
},
"required": [
"name"
]
}
},
"ephemeral": {
"type": "boolean"
},
"version": {
"description": "The version of the GitHub Actions Runner software. This is only set if the runner has connected to the service at least once.",
"type": [
"string",
"null"
]
}
},
"required": [
"id",
"name",
"os",
"status",
"busy",
"labels"
]
},
"encoded_jit_config": {
"type": "string",
"description": "The base64 encoded runner configuration."
}
}
}…version The self-hosted runner schema (returned by GenerateJITConfig via JITRunnerConfig, and by the runner list/get endpoints) includes runner_group_id, ephemeral, and version, which were missing from the Runner struct. Add them to match the schema. All three are optional, so this is a non-breaking, additive change. Accessors are regenerated accordingly.
|
Thanks @Not-Dhananjay-Mishra — done. Added |
Rename to match the API docs operation name ("Create configuration for a
just-in-time runner"), as suggested in review:
- `GenerateOrgJITConfig` -> `CreateOrgJITConfig`
- `GenerateRepoJITConfig` -> `CreateRepoJITConfig`
- `GenerateEnterpriseJITConfig` -> `CreateEnterpriseJITConfig`
- `GenerateJITConfigRequest` -> `CreateJITConfigRequest`
The `generate-jitconfig` URL path is unchanged. Accessors are regenerated.
GenerateJITConfigRequest by value in the JIT config methodsCreateJITConfigRequest by value and rename Generate*JITConfig to Create*JITConfig
BREAKING CHANGE: the JIT config methods are renamed from
Generate*JITConfigtoCreate*JITConfig, and they now takeCreateJITConfigRequest(renamed fromGenerateJITConfigRequest) by value instead of by pointer.Towards #3644.
Continues the value-parameter conversion from the merged #3654, #3794, #4320, #4329 and #4336.
Changes
CreateOrgJITConfig/CreateRepoJITConfig(actions_runners.go) andCreateEnterpriseJITConfig(enterprise_actions_runners.go) now takeCreateJITConfigRequestby value. All three methods share the same request type, so they are converted together (otherwise theparamcheckallow-list entry could not be removed). The type is removed from theparamcheckbody-allowed-pointer-typesallow-list in.golangci.yml.Generate*JITConfig->Create*JITConfig(methods) andGenerateJITConfigRequest->CreateJITConfigRequest, to match the API docs operation name ("Create configuration for a just-in-time runner"). Thegenerate-jitconfigURL path is unchanged.Runnerfields:runner_group_id,ephemeral, andversionto theRunnerresponse struct to match the self-hosted runner schema (these are returned byJITRunnerConfigand by the runner list/get endpoints). All optional, so non-breaking; accessors regenerated.Breaking changes
GenerateOrgJITConfig/GenerateRepoJITConfig/GenerateEnterpriseJITConfigrenamed toCreateOrgJITConfig/CreateRepoJITConfig/CreateEnterpriseJITConfig.CreateJITConfigRequest(renamed fromGenerateJITConfigRequest) by value instead of*GenerateJITConfigRequest.