Add fetch timeout arg to create source commands

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan 2021-11-01 15:32:22 +02:00
parent 404ffa5a91
commit 61be0775af
No known key found for this signature in database
GPG key ID: 3299AEB0E4085BAF
4 changed files with 23 additions and 0 deletions

View file

@ -17,6 +17,8 @@ limitations under the License.
package main
import (
"time"
"github.com/spf13/cobra"
)
@ -26,6 +28,14 @@ var createSourceCmd = &cobra.Command{
Long: "The create source sub-commands generate sources.",
}
type createSourceFlags struct {
fetchTimeout time.Duration
}
var createSourceArgs createSourceFlags
func init() {
createSourceCmd.PersistentFlags().DurationVar(&createSourceArgs.fetchTimeout, "fetch-timeout", createSourceArgs.fetchTimeout,
"set a timeout for fetch operations performed by source-controller (e.g. 'git clone' or 'helm repo update')")
createCmd.AddCommand(createSourceCmd)
}