Repository navigation
Enforce stack info for cloud commands - #5833
Merged
Merged
Conversation
codebien
force-pushed
the
5651-make-stack-required
branch
from
April 10, 2026 19:16
26feb10 to
bb5cb4a
Compare
codebien
temporarily deployed
to
azure-trusted-signing
April 10, 2026 19:22 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 10, 2026 19:24 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 14, 2026 16:07 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 14, 2026 16:14 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 14, 2026 16:16 — with
GitHub Actions
Inactive
codebien
force-pushed
the
5651-make-stack-required
branch
from
April 14, 2026 16:21
9554623 to
ae67d6d
Compare
codebien
temporarily deployed
to
azure-trusted-signing
April 14, 2026 16:27 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 14, 2026 16:29 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 14, 2026 19:45 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 14, 2026 19:47 — with
GitHub Actions
Inactive
codebien
force-pushed
the
5651-make-stack-required
branch
from
April 15, 2026 10:03
4878029 to
367ec92
Compare
codebien
temporarily deployed
to
azure-trusted-signing
April 15, 2026 10:08 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 15, 2026 10:10 — with
GitHub Actions
Inactive
codebien
marked this pull request as ready for review
April 15, 2026 11:31
codebien
requested review from
inancgumus and
mstoykov
and removed request for
a team
April 15, 2026 11:31
mstoykov
previously approved these changes
Apr 15, 2026
mstoykov
left a comment
Contributor
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.
codebien
force-pushed
the
5651-make-stack-required
branch
from
April 15, 2026 16:20
367ec92 to
11919b8
Compare
codebien
force-pushed
the
5651-make-stack-required
branch
from
April 15, 2026 16:21
11919b8 to
78d3cfe
Compare
codebien
temporarily deployed
to
azure-trusted-signing
April 15, 2026 16:27 — with
GitHub Actions
Inactive
mstoykov
previously approved these changes
Apr 15, 2026
codebien
temporarily deployed
to
azure-trusted-signing
April 15, 2026 16:42 — with
GitHub Actions
Inactive
mstoykov
previously approved these changes
Apr 15, 2026
codebien
temporarily deployed
to
azure-trusted-signing
April 15, 2026 16:44 — with
GitHub Actions
Inactive
4 of 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.
Co-authored-by: Inanc Gumus <inanc.gumus@grafana.com>
codebien
temporarily deployed
to
azure-trusted-signing
April 21, 2026 07:51 — with
GitHub Actions
Inactive
codebien
temporarily deployed
to
azure-trusted-signing
April 21, 2026 07:53 — with
GitHub Actions
Inactive
mstoykov
approved these changes
Apr 22, 2026
Contributor
Author
|
Hey @inancgumus, I've addressed your request changes in a specific pull request so we avoid to block the merge of this pull request. Please, take a look there #5869. Can you review the current pull request again, please? |
inancgumus
approved these changes
Apr 22, 2026
This branch was previously deployed
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.