Open
Conversation
26feb10 to
bb5cb4a
Compare
9554623 to
ae67d6d
Compare
4878029 to
367ec92
Compare
mstoykov
previously approved these changes
Apr 15, 2026
Contributor
mstoykov
left a comment
There was a problem hiding this comment.
LGTM!
On second pass through that it seems that the print only happens on show, so I guess it was already verified , so you can ignore it.
367ec92 to
11919b8
Compare
11919b8 to
78d3cfe
Compare
mstoykov
previously approved these changes
Apr 15, 2026
mstoykov
approved these changes
Apr 15, 2026
8 tasks
inancgumus
reviewed
Apr 17, 2026
Comment on lines
+34
to
+49
| var errUserUnauthenticated = errors.New("You must first authenticate to run tests in Grafana Cloud." + | ||
| " Run the `k6 cloud login` command providing the stack and token, or check the docs" + | ||
| " https://grafana.com/docs/grafana-cloud/testing/k6/author-run/tokens-and-cli-authentication" + | ||
| " for additional authentication methods.") | ||
| " for additional methods.") | ||
|
|
||
| // checkCloudLogin verifies that both a token and a stack are configured. | ||
| // Together they represent a complete Grafana Cloud login. | ||
| func checkCloudLogin(conf cloudapi.Config) error { | ||
| if !conf.Token.Valid || conf.Token.String == "" { | ||
| return errUserUnauthenticated | ||
| } | ||
| if !conf.StackID.Valid || conf.StackID.Int64 == 0 { | ||
| return errUserUnauthenticated | ||
| } | ||
| return nil | ||
| } |
Contributor
There was a problem hiding this comment.
checkCloudLogin() collapses “missing token” and “missing stack” into the same errUserUnauthenticated, so users with only a token get only a generic authentication message. Would be nicer to return distinct errors, or at least include the specific missing piece in the message.
| } | ||
|
|
||
| // validateInputs validates a token and a stack if provided | ||
| // tokenAuthentication validates a token and a stack |
Contributor
There was a problem hiding this comment.
Tiny nit.
Suggested change
| // tokenAuthentication validates a token and a stack | |
| // authenticateUserToken validates a token and a stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5651
What?
This PR makes Stack mandatory value for all cloud commands (
k6 cloud run,k6 cloud upload,k6 cloud run --local-execution), completing the deprecation warning introduced in #5420.Note about differences from the original proposal
The original issue (#5650) proposed making stack input consistent across all input methods — accepting slug, full URL, or numeric ID interchangeably in all contexts. This PR does not fully unify the input formats:
K6_CLOUD_STACK_IDand thestackIDscript option still accept a numeric ID only, whilek6 cloud login --stackaccepts a slug or full URL. Full input-format unification is left for a following dedicated work (probably after v2 release).Note about implementation details
k6 cloud loginnow requires both token and stack — passing-twithout--stack(or vice versa) fails with an explicit error. The previous behavior of accepting a token-only login and falling back to v1 token validation has been removed.--showoutput: the stored token is now partially masked to avoid accidental credential exposure.Noneas a valid nor default stack option — both fields are required./v1/validate-token). All authentication now goes through the v6 API (/cloud/v6/auth), which validates both token and stack together.