Skip to content

Commit 68d26b7

Browse files
committed
fix: print error messages in mergeYaml
1 parent 4d98511 commit 68d26b7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cmd/docker-sync/cmd/mergeYaml.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var mergeYamlCmd = &cobra.Command{
4646
if outFile == "" {
4747
fmt.Println(string(config))
4848
} else {
49-
if err := os.WriteFile(outFile, config, 0644); err != nil {
49+
if err := os.WriteFile(outFile, config, 0o644); err != nil {
5050
cmd.Annotations["error"] = err.Error()
5151
return
5252
}
@@ -56,6 +56,7 @@ var mergeYamlCmd = &cobra.Command{
5656
// Wait for a second to allow for any pending log messages to be flushed
5757
time.Sleep(1 * time.Second)
5858
if cmd.Annotations["error"] != "" {
59+
fmt.Printf("Error: %s\n", cmd.Annotations["error"])
5960
os.Exit(1)
6061
}
6162
},

entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# check if /config.yaml exists
44
if [ ! -f /config.yaml ]; then
55
/docker-sync mergeYaml -o /config.yaml -f /config_map.yaml -f /secret.yaml
6+
if [ $? -ne 0 ]; then
7+
echo "Error merging YAML files. Exiting."
8+
exit 1
9+
fi
610
fi
711

812
/docker-sync "$@"

0 commit comments

Comments
 (0)