From 5727630846acd34e301b3a62443b0347139c6db4 Mon Sep 17 00:00:00 2001 From: gadotroee <55343099+gadotroee@users.noreply.github.com> Date: Mon, 3 May 2021 11:25:15 +0300 Subject: [PATCH] CLI make --pod required flag and faster api image build (#25) * makefile fixes - docker build * readme update, CLI usage fix * added chmod * typo * run example incorreect in makefile * no message * no message * no message Co-authored-by: Alex Haiut --- Dockerfile | 3 +++ cli/cmd/root.go | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8dfbf8f5e..4e9bcc8d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,9 @@ WORKDIR /api-build COPY api/go.mod api/go.sum ./ RUN go mod download +# cheap trick to make the build faster (As long as go.mod wasn't changes +RUN go list -f '{{.Path}}@{{.Version}}' -m all | sed 1d | xargs go get + # Copy and build api code COPY api . RUN go build -ldflags="-s -w" -o mizuagent . diff --git a/cli/cmd/root.go b/cli/cmd/root.go index cf2e42dc9..c807fe1ca 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -17,7 +17,7 @@ func init() { if len(args) != 0 { return rootCmd.Help() } - + mizu.Run() return nil } @@ -32,7 +32,10 @@ func init() { rootCmd.Flags().StringVarP(&config.Configuration.MizuImage, "mizu-image", "", "gcr.io/up9-docker-hub/mizu/develop:latest", "Custom image for mizu collector") rootCmd.Flags().Uint16VarP(&config.Configuration.MizuPodPort, "mizu-port", "", 8899, "Port which mizu cli will attempt to forward from the mizu collector pod") rootCmd.Flags().StringVarP(&config.Configuration.TappedPodName, "pod", "", "", "View traffic of this pod") - rootCmd.MarkFlagRequired("pod") + err := rootCmd.MarkFlagRequired("pod") + if err != nil { + panic(err) + } } // Execute adds all child commands to the root command and sets flags appropriately.