Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/cmd/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ func (c *cmdCloud) run(cmd *cobra.Command, args []string) error {
logger, cloudConfig.Token.String, cloudConfig.Host.String, build.Version, cloudConfig.Timeout.TimeDuration())

if cloudConfig.ProjectID.Int64 == 0 {
if cloudConfig.StackID.Int64 == 0 {
logger.Error("please specify a projectID in your test or use `k6 cloud login` to set up a default stack")
return fmt.Errorf("no projectID specified and no default stack set")
}

projectID, _, err := client.GetDefaultProject(cloudConfig.StackID.Int64)
if err != nil {
return fmt.Errorf("can't get default projectID for stack %d (%s): %w", cloudConfig.StackID.Int64, cloudConfig.StackSlug.String, err)
Expand Down
5 changes: 5 additions & 0 deletions internal/cmd/outputs_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ func createCloudTest(gs *state.GlobalState, test *loadedAndConfiguredTest) error
logger, conf.Token.String, conf.Host.String, build.Version, conf.Timeout.TimeDuration())

if testRun.ProjectID == 0 {
if conf.StackID.Int64 == 0 {
gs.Logger.Error("please specify a projectID in your test or use `k6 cloud login` to set up a default stack")
return fmt.Errorf("no projectID specified and no default stack set")
}

projectID, _, err := apiClient.GetDefaultProject(conf.StackID.Int64)
if err != nil {
return fmt.Errorf("can't get default projectID for stack %d (%s): %w", conf.StackID.Int64, conf.StackSlug.String, err)
Expand Down
Loading