-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added a new retry command. This can be used to retry both proposed and tracked runs. - Fixed a typo in some of the graphql field tags. It must have worked because the name wasn't being overridden. Issues: #53
- Loading branch information
1 parent
6b65d83
commit a05faa4
Showing
7 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package stack | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/shurcooL/graphql" | ||
"github.com/urfave/cli/v2" | ||
|
||
"github.com/spacelift-io/spacectl/internal/cmd/authenticated" | ||
) | ||
|
||
func runRetry(cliCtx *cli.Context) error { | ||
stackID := cliCtx.String(flagStackID.Name) | ||
runID := cliCtx.String(flagRun.Name) | ||
|
||
var mutation struct { | ||
RunRetry struct { | ||
ID string `graphql:"id"` | ||
} `graphql:"runRetry(stack: $stack, run: $run)"` | ||
} | ||
|
||
variables := map[string]interface{}{ | ||
"stack": graphql.ID(stackID), | ||
"run": graphql.ID(runID), | ||
} | ||
|
||
if err := authenticated.Client.Mutate(cliCtx.Context, &mutation, variables); err != nil { | ||
return err | ||
} | ||
|
||
fmt.Printf("Run ID %q has been successfully retried\n", runID) | ||
fmt.Println("The live run can be visited at", authenticated.Client.URL( | ||
"/stack/%s/run/%s", | ||
stackID, | ||
mutation.RunRetry.ID, | ||
)) | ||
|
||
if !cliCtx.Bool(flagTail.Name) { | ||
return nil | ||
} | ||
|
||
terminal, err := runLogs(cliCtx.Context, stackID, mutation.RunRetry.ID) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return terminal.Error() | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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