Skip to content

Commit

Permalink
Merge pull request #1072 from CircleCI-Public/develop
Browse files Browse the repository at this point in the history
Cut new CLI release for self-hosted runners user token fix
  • Loading branch information
ryanwohara authored Aug 23, 2024
2 parents 43103be + 0d8fde1 commit 77b1f51
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cmd/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@ type runnerOpts struct {
r running
}

func NewCommand(rootConfig *settings.Config, preRunE validator.Validator) *cobra.Command {
// The runner API versioning is decoupled from the other Circle APIs. Here we make a copy of the root configuration,
// and update the rest endpoint accordingly
config := *rootConfig
config.RestEndpoint = "/api/v3"

func NewCommand(config *settings.Config, preRunE validator.Validator) *cobra.Command {
var opts runnerOpts
cmd := &cobra.Command{
Use: "runner",
Short: "Operate on runners",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// The runner API versioning is decoupled from the other Circle APIs. Here we update the rest endpoint accordingly
config.RestEndpoint = "/api/v3"

var host string
if strings.Contains(config.Host, "https://circleci.com") {
host = "https://runner.circleci.com"
} else {
host = config.Host
}
opts.r = runner.New(rest.NewFromConfig(host, &config))
opts.r = runner.New(rest.NewFromConfig(host, config))
},
}

Expand Down

0 comments on commit 77b1f51

Please sign in to comment.