Skip to content

Normalize cloud login stack URLs#5904

Open
cyphercodes wants to merge 1 commit into
grafana:masterfrom
cyphercodes:fix-cloud-login-stack-trailing-slash-5894
Open

Normalize cloud login stack URLs#5904
cyphercodes wants to merge 1 commit into
grafana:masterfrom
cyphercodes:fix-cloud-login-stack-trailing-slash-5894

Conversation

@cyphercodes

Copy link
Copy Markdown

What?

Normalize k6 cloud login --stack stack inputs by removing trailing / characters before validating them with Grafana Cloud. This keeps copied stack URLs like https://my-team.grafana.net/ equivalent to https://my-team.grafana.net.

Added focused unit coverage for stack URL normalization and command coverage for login with a trailing-slash stack URL.

Why?

A trailing slash was sent to the Cloud auth API as part of X-Stack-Url, which could make an otherwise valid stack fail authentication as not found.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass. (Ran go test ./internal/cmd/... -count=1.)

Checklist: Documentation (only for k6 maintainers and if relevant)

Not applicable; this is a CLI bug fix.

Related PR(s)/Issue(s)

Fixes #5894

@cyphercodes cyphercodes requested a review from a team as a code owner April 29, 2026 03:53
@cyphercodes cyphercodes requested review from codebien and joanlopez and removed request for a team April 29, 2026 03:53
@cla-assistant

cla-assistant Bot commented Apr 29, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant

cla-assistant Bot commented Apr 29, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cyphercodes cyphercodes temporarily deployed to azure-trusted-signing April 29, 2026 07:15 — with GitHub Actions Inactive
@joanlopez

Copy link
Copy Markdown
Contributor

Hi, @cyphercodes!

Thanks for the contribution. Could you please sign the CLA? Without that, we cannot move forward and get your changes merged 🙇🏻

Comment on lines +134 to +136
name: "full https URL with multiple trailing slashes",
input: "https://my-team.grafana.net///",
expected: "https://my-team.grafana.net",

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.

nit; I guess here it could also make sense to throw an error, considering it invalid. In other words, perhaps we should trim only up to one slash. But I have no strong opinion, and as I cannot see any downside of this approach, lgtm!

Any thoughts? @codebien

@mstoykov

mstoykov commented May 7, 2026

Copy link
Copy Markdown
Contributor

Hi @cyphercodes without you signing the CLA we do not have any way to merge this. Which also makes reviewing it not really useful.

Sorry for the inconvience. If it isn't working for some reason you might have to retry as the cla assistant isn't very stable some days. Please do write if you are having problems so we do at least know there is a chance this will be signed.

@mstoykov mstoykov added this to the v2.1.0 milestone May 11, 2026
@szkiba szkiba added the awaiting user waiting for user to respond label Jun 11, 2026
@oleiade oleiade modified the milestones: v2.1.0, v2.2.0 Jun 16, 2026
@oleiade

oleiade commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

In absence of response and action from you @cyphercodes I took the liberty to create a superseeding PR, as I would really like to see this merged: #6087.

I made sure to mention you and this PR in the description and commit to give credit where it is due 🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting user waiting for user to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

k6 cloud login stack trailing /

6 participants