Skip to content
Ona Docs

ValidateRunnerConfiguration

client.Runners.Configurations.Validate(ctx, body) (*RunnerConfigurationValidateResponse, error)
POST/gitpod.v1.RunnerConfigurationService/ValidateRunnerConfiguration

Validates a runner configuration.

Use this method to:

  • Check configuration validity
  • Verify integration settings
  • Validate environment classes

Examples

  • Validate SCM integration:

    Checks if an SCM integration is valid.

    runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
    scmIntegration:
      id: "integration-id"
      scmId: "github"
      host: "github.com"
      oauthClientId: "client_id"
      oauthPlaintextClientSecret: "client_secret"
ParametersExpand Collapse
body RunnerConfigurationValidateParams
EnvironmentClass param.Field[EnvironmentClass]Optional
RunnerID param.Field[string]Optional
formatuuid
ScmIntegration param.Field[RunnerConfigurationValidateParamsScmIntegration]Optional
ID stringOptional

id is the unique identifier of the SCM integration

Host stringOptional
IssuerURL stringOptional

issuer_url can be set to override the authentication provider URL, if it doesn’t match the SCM host.

OAuthClientID stringOptional

oauth_client_id is the OAuth app’s client ID, if OAuth is configured. If configured, oauth_client_secret must also be set.

OAuthEncryptedClientSecret stringOptional

oauth_encrypted_client_secret is the OAuth app’s client secret encrypted with the runner’s public key, if OAuth is configured. This can be used to e.g. validate an already encrypted client secret of an existing SCM integration.

formatbyte
OAuthPlaintextClientSecret stringOptional

oauth_plaintext_client_secret is the OAuth app’s client secret in clear text, if OAuth is configured. This can be set to validate any new client secret before it is encrypted and stored. This value will not be stored and get encrypted with the runner’s public key before passing it to the runner.

Pat boolOptional
ScmID stringOptional

scm_id references the scm_id in the runner’s configuration schema that this integration is for

VirtualDirectory stringOptional

virtual_directory is the virtual directory path for Azure DevOps Server (e.g., “/tfs”). This field is only used for Azure DevOps Server SCM integrations and should be empty for other SCM types. Azure DevOps Server APIs work without collection when PAT scope is ‘All accessible organizations’.

ReturnsExpand Collapse
type RunnerConfigurationValidateResponse struct{…}
EnvironmentClass EnvironmentClassValidationResultOptional
ConfigurationErrors []FieldValidationErrorOptional
Error stringOptional
Key stringOptional
DescriptionError stringOptional
DisplayNameError stringOptional
Valid boolOptional
ScmIntegration ScmIntegrationValidationResultOptional
HostError stringOptional
OAuthError stringOptional
PatError stringOptional
ScmIDError stringOptional
Valid boolOptional

ValidateRunnerConfiguration

package main

import (
  "context"
  "fmt"

  "github.com/gitpod-io/gitpod-sdk-go"
  "github.com/gitpod-io/gitpod-sdk-go/option"
)

func main() {
  client := gitpod.NewClient(
    option.WithBearerToken("My Bearer Token"),
  )
  response, err := client.Runners.Configurations.Validate(context.TODO(), gitpod.RunnerConfigurationValidateParams{
    RunnerID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
    ScmIntegration: gitpod.F(gitpod.RunnerConfigurationValidateParamsScmIntegration{
      Host: gitpod.F("github.com"),
      ID: gitpod.F("integration-id"),
      OAuthClientID: gitpod.F("client_id"),
      OAuthPlaintextClientSecret: gitpod.F("client_secret"),
      ScmID: gitpod.F("github"),
    }),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.EnvironmentClass)
}
{
  "environmentClass": {
    "configurationErrors": [
      {
        "error": "error",
        "key": "key"
      }
    ],
    "descriptionError": "descriptionError",
    "displayNameError": "displayNameError",
    "valid": true
  },
  "scmIntegration": {
    "hostError": "hostError",
    "oauthError": "oauthError",
    "patError": "patError",
    "scmIdError": "scmIdError",
    "valid": true
  }
}
Returns Examples
{
  "environmentClass": {
    "configurationErrors": [
      {
        "error": "error",
        "key": "key"
      }
    ],
    "descriptionError": "descriptionError",
    "displayNameError": "displayNameError",
    "valid": true
  },
  "scmIntegration": {
    "hostError": "hostError",
    "oauthError": "oauthError",
    "patError": "patError",
    "scmIdError": "scmIdError",
    "valid": true
  }
}