Skip to content

refactor!: Pass CreateJITConfigRequest by value and rename Generate*JITConfig to Create*JITConfig#4337

Merged
gmlewis merged 4 commits into
google:masterfrom
JamBalaya56562:refactor/3644-jitconfig-value-params
Jun 29, 2026
Merged

refactor!: Pass CreateJITConfigRequest by value and rename Generate*JITConfig to Create*JITConfig#4337
gmlewis merged 4 commits into
google:masterfrom
JamBalaya56562:refactor/3644-jitconfig-value-params

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

BREAKING CHANGE: the JIT config methods are renamed from Generate*JITConfig to Create*JITConfig, and they now take CreateJITConfigRequest (renamed from GenerateJITConfigRequest) by value instead of by pointer.

Towards #3644.

Continues the value-parameter conversion from the merged #3654, #3794, #4320, #4329 and #4336.

Changes

  • Pass the request by value: CreateOrgJITConfig / CreateRepoJITConfig (actions_runners.go) and (*EnterpriseService).CreateJITConfig (enterprise_actions_runners.go) now take CreateJITConfigRequest by value. All three methods share the same request type, so they are converted together (otherwise the paramcheck allow-list entry could not be removed). The type is removed from the paramcheck body-allowed-pointer-types allow-list in .golangci.yml.
  • Rename Generate*JITConfig -> Create*JITConfig (methods) and GenerateJITConfigRequest -> CreateJITConfigRequest, to match the API docs operation name ("Create configuration for a just-in-time runner"). On EnterpriseService the method is just CreateJITConfig (the redundant Enterprise is dropped, consistent with the other EnterpriseService runner methods). The generate-jitconfig URL path is unchanged.
  • Add missing Runner fields: runner_group_id, ephemeral, and version to the Runner response struct to match the self-hosted runner schema (these are returned by JITRunnerConfig and by the runner list/get endpoints). All optional, so non-breaking; accessors regenerated.

Breaking changes

  • GenerateOrgJITConfig / GenerateRepoJITConfig renamed to CreateOrgJITConfig / CreateRepoJITConfig; GenerateEnterpriseJITConfig renamed to CreateJITConfig (on EnterpriseService).
  • They now take CreateJITConfigRequest (renamed from GenerateJITConfigRequest) by value instead of *GenerateJITConfigRequest.

…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
@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 Jun 27, 2026
@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.50%. Comparing base (4498e09) to head (41caceb).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4337   +/-   ##
=======================================
  Coverage   97.50%   97.50%           
=======================================
  Files         193      193           
  Lines       19451    19451           
=======================================
  Hits        18965    18965           
  Misses        269      269           
  Partials      217      217           

☔ 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.

@gmlewis gmlewis changed the title refactor!: Pass GenerateJITConfigRequest by value in the JIT config methods refactor!: Pass GenerateJITConfigRequest by value in the JIT config methods Jun 27, 2026

@gmlewis gmlewis left a comment

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.

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

cc: @stevehipwell - @alexandear - @Not-Dhananjay-Mishra

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.
@JamBalaya56562

Copy link
Copy Markdown
Contributor Author

Thanks @Not-Dhananjay-Mishra — done. Added runner_group_id, ephemeral and version to the Runner struct (all optional, to match the schema) in a separate commit (03fcee1), with accessors regenerated. JITRunnerConfig itself already had runner + encoded_jit_config.

Comment thread github/actions_runners.go Outdated
@JamBalaya56562 JamBalaya56562 changed the title refactor!: Pass GenerateJITConfigRequest by value in the JIT config methods refactor!: Pass CreateJITConfigRequest by value and rename Generate*JITConfig to Create*JITConfig Jun 28, 2026

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment thread github/enterprise_actions_runners.go Outdated
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` -> `CreateJITConfig` (drop the redundant
  `Enterprise`, since the method is already on `EnterpriseService`)
- `GenerateJITConfigRequest` -> `CreateJITConfigRequest`

The `generate-jitconfig` URL path is unchanged. Accessors are regenerated.
@JamBalaya56562 JamBalaya56562 force-pushed the refactor/3644-jitconfig-value-params branch from 674b448 to 4e3e8ee Compare June 29, 2026 10:55
@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Jun 29, 2026
@gmlewis gmlewis merged commit 9b51fac into google:master Jun 29, 2026
14 of 15 checks passed
@JamBalaya56562 JamBalaya56562 deleted the refactor/3644-jitconfig-value-params branch June 29, 2026 12:53
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.

4 participants