@@ -44,8 +44,7 @@ func (wrapper *PluginWrapper) Deploy(ctx context.Context, filePaths []string, op
44
44
return err
45
45
}
46
46
47
- log .Info ().
48
- Str ("message" , "Stack deployment successful" )
47
+ log .Info ().Msg ("Stack deployment successful" )
49
48
50
49
log .Debug ().
51
50
Str ("output" , string (output )).
@@ -63,8 +62,7 @@ func (wrapper *PluginWrapper) Remove(ctx context.Context, filePaths []string, op
63
62
return err
64
63
}
65
64
66
- log .Info ().
67
- Str ("message" , "Stack removal successful" )
65
+ log .Info ().Msg ("Stack removal successful" )
68
66
69
67
log .Debug ().
70
68
Str ("output" , string (output )).
@@ -83,8 +81,7 @@ func (wrapper *PluginWrapper) Pull(ctx context.Context, filePaths []string, opti
83
81
return err
84
82
}
85
83
86
- log .Info ().
87
- Str ("message" , "Stack pull successful" )
84
+ log .Info ().Msg ("Stack pull successful" )
88
85
89
86
log .Debug ().
90
87
Str ("output" , string (output )).
@@ -94,6 +91,24 @@ func (wrapper *PluginWrapper) Pull(ctx context.Context, filePaths []string, opti
94
91
return err
95
92
}
96
93
94
+ // Validate stack file
95
+ func (wrapper * PluginWrapper ) Validate (ctx context.Context , filePaths []string , options libstack.Options ) error {
96
+ output , err := wrapper .command (newValidateCommand (filePaths ), options )
97
+ if len (output ) != 0 {
98
+ if err != nil {
99
+ return err
100
+ }
101
+
102
+ log .Info ().Msg ("Valid stack format" )
103
+
104
+ log .Debug ().
105
+ Str ("output" , string (output )).
106
+ Msg ("docker compose" )
107
+ }
108
+
109
+ return nil
110
+ }
111
+
97
112
// Command execute a docker-compose command
98
113
func (wrapper * PluginWrapper ) command (command composeCommand , options libstack.Options ) ([]byte , error ) {
99
114
program := utils .ProgramPath (wrapper .binaryPath , "docker-compose" )
@@ -196,6 +211,10 @@ func newPullCommand(filePaths []string) composeCommand {
196
211
return newCommand ([]string {"pull" }, filePaths )
197
212
}
198
213
214
+ func newValidateCommand (filePaths []string ) composeCommand {
215
+ return newCommand ([]string {"config" , "--quiet" }, filePaths )
216
+ }
217
+
199
218
func (command * composeCommand ) WithHost (host string ) {
200
219
// prepend compatibility flags such as this one as they must appear before the
201
220
// regular global args otherwise docker-compose will throw an error
0 commit comments