File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -405,6 +405,17 @@ func Command() *cli.Command {
405
405
Before : authenticated .Ensure ,
406
406
ArgsUsage : cmd .EmptyArgsUsage ,
407
407
},
408
+ {
409
+ Category : "Stack management" ,
410
+ Name : "sync-commit" ,
411
+ Usage : "Syncs the tracked stack commit" ,
412
+ Flags : []cli.Flag {
413
+ flagStackID ,
414
+ },
415
+ Action : syncCommit ,
416
+ Before : authenticated .Ensure ,
417
+ ArgsUsage : cmd .EmptyArgsUsage ,
418
+ },
408
419
{
409
420
Name : "resources" ,
410
421
Usage : "Manage and view resources for stacks" ,
Original file line number Diff line number Diff line change
1
+ package stack
2
+
3
+ import (
4
+ "fmt"
5
+
6
+ "github.com/shurcooL/graphql"
7
+ "github.com/spacelift-io/spacectl/internal/cmd/authenticated"
8
+ "github.com/urfave/cli/v2"
9
+ )
10
+
11
+ func syncCommit (cliCtx * cli.Context ) error {
12
+ stackID , err := getStackID (cliCtx )
13
+ if err != nil {
14
+ return err
15
+ }
16
+
17
+ if nArgs := cliCtx .NArg (); nArgs != 0 {
18
+ return fmt .Errorf ("expected zero arguments but got %d" , nArgs )
19
+ }
20
+
21
+ var mutation struct {
22
+ Stack struct {
23
+ ID string `graphql:"id"`
24
+ } `graphql:"stackSyncCommit(id: $stack)"`
25
+ }
26
+ variables := map [string ]interface {}{
27
+ "stack" : graphql .ID (stackID ),
28
+ }
29
+
30
+ return authenticated .Client .Mutate (cliCtx .Context , & mutation , variables )
31
+ }
You can’t perform that action at this time.
0 commit comments