Skip to content

Commit

Permalink
[RT-603] Migrate CLI to use runner.circleci.com (#742)
Browse files Browse the repository at this point in the history
* [RT-603] Migrate CLI to use runner.circleci.com

Jira: [RT-603](https://circleci.atlassian.net/browse/RT-603)

As part of the incident remediation for [Runner UI & CLI making requests to the wrong domain](https://circleci.atlassian.net/l/c/ou0ABPYK), migrate the CLI to use `runner.circleci.com` for runner related operations. This is needed as the infra team starts to depreacate `www-proxy`.
  • Loading branch information
afranco07 authored Jul 4, 2022
1 parent 25ac45c commit ee1f054
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/runner/runner.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package runner

import (
"strings"

"github.com/spf13/cobra"

"github.com/CircleCI-Public/circleci-cli/api/rest"
Expand All @@ -18,12 +20,20 @@ func NewCommand(config *settings.Config, preRunE validator) *cobra.Command {
Use: "runner",
Short: "Operate on runners",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
opts.r = runner.New(rest.New(config.Host, config.RestEndpoint, config.Token))
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.New(host, config.RestEndpoint, config.Token))
},
}

cmd.AddCommand(newResourceClassCommand(&opts, preRunE))
cmd.AddCommand(newTokenCommand(&opts, preRunE))
cmd.AddCommand(newRunnerInstanceCommand(&opts, preRunE))

return cmd
}

Expand Down

0 comments on commit ee1f054

Please sign in to comment.