Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): automatically use cloud endpoint if token is passed #3671

Merged
merged 1 commit into from Feb 21, 2024

Conversation

schoren
Copy link
Collaborator

@schoren schoren commented Feb 21, 2024

This PR makes the CLI not ask interactively from the user the desired server URL, and instead automatically select one.

When passing --token or --api-key we can no longer asume an interactive environment. Those tokens are usually used in a CI or otherwise automated environment, where user interaction is not available.

In this case, server url is chose as:

  1. if --server-url flag is passed, used that.
  2. if we have a pre existing config, use that value.
  3. otherwise use cloud endpoint.

This behaviour was already implemented for the --token flag, but not for the --api-key flag.

Copy link

vercel bot commented Feb 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
tracetest ✅ Ready (Inspect) Visit Preview Feb 21, 2024 2:13pm

@@ -11,7 +11,6 @@ ifneq "$(CURRENT_GORELEASER_VERSION)" "$(GORELEASER_VERSION)"
@printf "\033[0;31m Bad goreleaser version $(CURRENT_GORELEASER_VERSION), please install $(GORELEASER_VERSION)\033[0m\n\n"
@printf "\033[0;31m Tracetest requires goreleaser pro installed (licence not necessary for local builds)\033[0m\n\n"
@printf "\033[0;33m See https://goreleaser.com/install/ \033[0m\n\n"
@exit 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i want to know if we're outdated, but let's keep the builds rolling.

@@ -187,8 +190,8 @@ func (c Configurator) populateConfigWithDevConfig(ctx context.Context, cfg *Conf
}

func (c Configurator) populateConfigWithVersionInfo(ctx context.Context, cfg Config) (_ Config, _ error, isOSS bool) {
cliVersion := Version
if cliVersion == "dev" {
useDevVersion := os.Getenv("TRACETEST_AGENT_DEV_CONFIG") == "true"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it took me a good 20 mins of debuggin to figure out this was happening. So I changed the behavior to be opt in by passing an env var. Otherwise it might hide issues with our config logic during development

@schoren schoren merged commit 53c7a25 into main Feb 21, 2024
39 checks passed
@schoren schoren deleted the cli-default-server-noninteractive branch February 21, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants