Skip to content

Commit

Permalink
Add sync dependencies flag (#34)
Browse files Browse the repository at this point in the history
* Add sync dependencies flag
  • Loading branch information
tompizmor authored Aug 7, 2020
1 parent 6bfaddc commit b37218a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/sync_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var (
name string
version string
syncAllVersions bool
syncDeps bool
)

func newSyncChart() *cobra.Command {
Expand Down Expand Up @@ -50,6 +51,7 @@ func newSyncChart() *cobra.Command {
f.StringVarP(&name, "name", "", "", "Name of the chart to be synced")
f.StringVarP(&version, "version", "", "", "Version of the chart to be synced")
f.BoolVarP(&syncAllVersions, "all-versions", "", false, "Sync all versions of the provided chart")
f.BoolVarP(&syncDeps, "sync-deps", "", false, "Also sync dependencies of the chart if they are not found in the target repository")
cmd.MarkFlagRequired("name")

return cmd
Expand Down Expand Up @@ -82,7 +84,7 @@ func syncChart() error {
}

if syncAllVersions {
if err := chart.SyncAllVersions(name, source.Repo, target, false, sourceIndex, dryRun); err != nil {
if err := chart.SyncAllVersions(name, source.Repo, target, syncDeps, sourceIndex, dryRun); err != nil {
return errors.Trace(err)
}
} else {
Expand All @@ -105,7 +107,7 @@ func syncChart() error {
klog.Infof("dry-run: Chart %s-%s pending to be synced", name, version)
return nil
}
if err := chart.Sync(name, version, source.Repo, target, sourceIndex, false); err != nil {
if err := chart.Sync(name, version, source.Repo, target, sourceIndex, syncDeps); err != nil {
return errors.Trace(err)
}
}
Expand Down

0 comments on commit b37218a

Please sign in to comment.