-
-
Notifications
You must be signed in to change notification settings - Fork 135
feat: Atmos List Instances, Pro Upload #1254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bba4888
a9deaa6
30dac22
d28dd5d
702d236
20785f9
150c1ce
ebea868
1f1a22f
eeba626
b3d8a81
e30b7eb
48de779
0d66402
e5553a3
6002909
f6b335b
c90dde6
3a284b4
d2408a9
204f56b
17d9d28
7d51fdd
02157f5
e5a9d33
ab22c6a
1339290
ef81dbf
0071ac6
9e2436d
35fb2ae
71e3b08
5f01771
ec24435
8dd4865
bbf9c5e
e49969f
074a495
2817a53
04fd74d
dc3ca64
bea9e90
6271662
f34ee99
a1cfa5d
e6ba64f
fc330a3
be60360
45edf64
b36b1ff
80cc607
9a8cecb
02b76eb
501aea8
12afe45
05c5e3c
ffcd2c3
dfa38c5
2fa20f3
a40ab9f
febcfae
4f54434
542addb
ae82ff4
c6d0251
21868e0
93a9730
6254a4d
c0bf064
ba438a4
a6984ad
444a29a
81058ae
fe78f86
244bf7d
845d50f
aa5590f
99b55d1
200c28c
9e22f31
6fde5ee
0f44522
ba5c133
4327651
32fb0e2
f6903f0
e19688a
0baacfe
d9f23fd
a6ab979
0275792
a15dcfa
e3dadc9
66e714a
b8b34ce
ef18399
f23d04a
6768203
25cc00a
00612aa
6676670
59c8a1a
dd9ac22
7ee4504
100b415
c238765
62880ea
8cfd3cf
61326e0
e7127bb
1bf0718
58b7710
38913b8
1969b57
6466043
0fedbf2
84e3eb8
a918577
0dea003
f60c502
5e3538e
f5bd948
6ec3e86
8f4e248
3653411
1553b44
0c2ed44
3c90739
3e91f89
7968783
f453353
dde8cae
badfd5a
c12d554
a12d9a8
25385c3
e8564c2
d0311fc
aca35dd
cc39c43
2c26884
fbe6cdb
4e70553
84c42ca
53ca3b1
5dfa18c
91f6169
be3df55
66165c0
2e76813
f01bd0c
2b4583a
8116420
c7f7591
ce71c37
9aeef8f
1590e95
42c90cd
eca4937
bc77ffb
a8ed2d8
f784a50
3d669c3
7ce648f
064fb81
04d447b
ebc0e32
aa20599
fc1746c
abb7eeb
54a1dd4
e4907f1
fbe33bb
7ebe03c
c26bfce
3bcbad6
5c7fead
3af0643
9d1f599
7619dd0
95bb343
8b7cdb2
8575297
bdf7060
9efaaa9
f051f81
a0344d0
44ff17b
a590eb6
b2d1e1f
0129ed9
0f8d233
748acee
e40cacc
5d950ce
9cddc48
08d316f
03c7b59
80aa0b3
2dd1c3b
ec714e8
38da6e2
aba0e90
0f40cd6
3577375
72f3779
3d8012a
385b77b
f5e6474
1a268c1
957f180
8158dcf
da27903
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "github.com/spf13/cobra" | ||
|
|
||
| e "github.com/cloudposse/atmos/internal/exec" | ||
| "github.com/cloudposse/atmos/pkg/list" | ||
| fl "github.com/cloudposse/atmos/pkg/list/flags" | ||
| ) | ||
|
|
||
| // listInstancesCmd lists atmos instances. | ||
| var listInstancesCmd = &cobra.Command{ | ||
| Use: "instances", | ||
| Short: "List all Atmos instances", | ||
| Long: "This command lists all Atmos instances or is used to upload instances to the pro API.", | ||
| FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false}, | ||
| Args: cobra.NoArgs, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| // Check Atmos configuration | ||
| checkAtmosConfig() | ||
| err := ExecuteListInstancesCmd(cmd, args) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| }, | ||
| } | ||
|
|
||
| func init() { | ||
| // Add common list flags | ||
| fl.AddCommonListFlags(listInstancesCmd) | ||
|
|
||
| // Add instance-specific flags | ||
| listInstancesCmd.Flags().Bool("upload", false, "Upload instances to pro API") | ||
|
|
||
| // Add the command to the list command | ||
| listCmd.AddCommand(listInstancesCmd) | ||
| } | ||
|
|
||
| func ExecuteListInstancesCmd(cmd *cobra.Command, args []string) error { | ||
| // Process and validate command line arguments. | ||
| configAndStacksInfo, err := e.ProcessCommandLineArgs("list", cmd, args, nil) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| configAndStacksInfo.Command = "list" | ||
| configAndStacksInfo.SubCommand = "instances" | ||
|
|
||
| return list.ExecuteListInstancesCmd(&configAndStacksInfo, cmd, args) | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,6 @@ import ( | |||||||||||||||||||||||||
| errUtils "github.com/cloudposse/atmos/errors" | ||||||||||||||||||||||||||
| "github.com/cloudposse/atmos/internal/tui/templates/term" | ||||||||||||||||||||||||||
| cfg "github.com/cloudposse/atmos/pkg/config" | ||||||||||||||||||||||||||
| l "github.com/cloudposse/atmos/pkg/logger" | ||||||||||||||||||||||||||
| "github.com/cloudposse/atmos/pkg/pager" | ||||||||||||||||||||||||||
| "github.com/cloudposse/atmos/pkg/pro" | ||||||||||||||||||||||||||
| "github.com/cloudposse/atmos/pkg/pro/dtos" | ||||||||||||||||||||||||||
|
|
@@ -311,7 +310,9 @@ func (d *describeAffectedExec) uploadableQuery(args *DescribeAffectedCmdArgs, re | |||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| logger, err := l.NewLoggerFromCliConfig(*d.atmosConfig) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| log.Debug("Creating API client") | ||||||||||||||||||||||||||
| apiClient, err := pro.NewAtmosProAPIClientFromEnv(d.atmosConfig) | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
@@ -325,13 +326,8 @@ func (d *describeAffectedExec) uploadableQuery(args *DescribeAffectedCmdArgs, re | |||||||||||||||||||||||||
| RepoHost: gitURL.GetHostName(), | ||||||||||||||||||||||||||
| Stacks: affected, | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| log.Debug("Preparing upload affected stacks request", "req", req) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| log.Debug("Creating API client") | ||||||||||||||||||||||||||
| apiClient, err := pro.NewAtmosProAPIClientFromEnv(logger, d.atmosConfig) | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| log.Debug("Preparing upload affected stacks request", "req", req) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| return apiClient.UploadAffectedStacks(&req) | ||||||||||||||||||||||||||
|
Comment on lines
+330
to
332
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not log full request payload; log safe metadata only. This emits full - log.Debug("Preparing upload affected stacks request", "req", req)
+ log.Debug("Preparing upload affected stacks request",
+ "repo", fmt.Sprintf("%s/%s", req.RepoOwner, req.RepoName),
+ "host", req.RepoHost,
+ "head_sha", req.HeadSHA,
+ "base_sha", req.BaseSHA,
+ "stacks_count", len(req.Stacks),
+ )📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.