Skip to content

Commit

Permalink
Merge branch 'main' into hotfix-prune-messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 committed Feb 21, 2024
2 parents de4b2db + 5e1c6df commit 1bd496e
Show file tree
Hide file tree
Showing 33 changed files with 66 additions and 66 deletions.
4 changes: 2 additions & 2 deletions src/cmd/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (
Aliases: []string{"c"},
Short: lang.CmdConnectShort,
Long: lang.CmdConnectLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
var target string
if len(args) > 0 {
target = args[0]
Expand Down Expand Up @@ -89,7 +89,7 @@ var (
Use: "list",
Aliases: []string{"l"},
Short: lang.CmdConnectListShort,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
cluster.NewClusterOrDie().PrintConnectTable()
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var destroyCmd = &cobra.Command{
Aliases: []string{"d"},
Short: lang.CmdDestroyShort,
Long: lang.CmdDestroyLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
c, err := cluster.NewClusterWithWait(cluster.DefaultTimeout)
if err != nil {
message.Fatalf(err, lang.ErrNoClusterConnection)
Expand Down
12 changes: 6 additions & 6 deletions src/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var devDeployCmd = &cobra.Command{
Args: cobra.MaximumNArgs(1),
Short: lang.CmdDevDeployShort,
Long: lang.CmdDevDeployLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
common.SetBaseDirectory(args, &pkgConfig)

v := common.GetViper()
Expand All @@ -65,7 +65,7 @@ var devTransformGitLinksCmd = &cobra.Command{
Aliases: []string{"p"},
Short: lang.CmdDevPatchGitShort,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
host, fileName := args[0], args[1]

// Read the contents of the given file
Expand Down Expand Up @@ -108,7 +108,7 @@ var devSha256SumCmd = &cobra.Command{
Aliases: []string{"s"},
Short: lang.CmdDevSha256sumShort,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
fileName := args[0]

var tmp string
Expand Down Expand Up @@ -184,7 +184,7 @@ var devFindImagesCmd = &cobra.Command{
Args: cobra.MaximumNArgs(1),
Short: lang.CmdDevFindImagesShort,
Long: lang.CmdDevFindImagesLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
// If a directory was provided, use that as the base directory
common.SetBaseDirectory(args, &pkgConfig)

Expand All @@ -210,7 +210,7 @@ var devGenConfigFileCmd = &cobra.Command{
Args: cobra.MaximumNArgs(1),
Short: lang.CmdDevGenerateConfigShort,
Long: lang.CmdDevGenerateConfigLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
fileName := "zarf-config.toml"

// If a filename was provided, use that
Expand All @@ -231,7 +231,7 @@ var devLintCmd = &cobra.Command{
Aliases: []string{"l"},
Short: lang.CmdDevLintShort,
Long: lang.CmdDevLintLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
common.SetBaseDirectory(args, &pkgConfig)
v := common.GetViper()
pkgConfig.CreateOpts.SetVariables = helpers.TransformAndMergeMap(
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var initCmd = &cobra.Command{
Short: lang.CmdInitShort,
Long: lang.CmdInitLong,
Example: lang.CmdInitExample,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
zarfLogo := message.GetLogo()
_, _ = fmt.Fprintln(os.Stderr, zarfLogo)

Expand Down
20 changes: 10 additions & 10 deletions src/cmd/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var agentCmd = &cobra.Command{
Use: "agent",
Short: lang.CmdInternalAgentShort,
Long: lang.CmdInternalAgentLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
agent.StartWebhook()
},
}
Expand All @@ -46,15 +46,15 @@ var httpProxyCmd = &cobra.Command{
Use: "http-proxy",
Short: lang.CmdInternalProxyShort,
Long: lang.CmdInternalProxyLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
agent.StartHTTPProxy()
},
}

var genCLIDocs = &cobra.Command{
Use: "gen-cli-docs",
Short: lang.CmdInternalGenerateCliDocsShort,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Don't include the datestamp in the output
rootCmd.DisableAutoGenTag = true

Expand Down Expand Up @@ -126,7 +126,7 @@ var genConfigSchemaCmd = &cobra.Command{
Use: "gen-config-schema",
Aliases: []string{"gc"},
Short: lang.CmdInternalConfigSchemaShort,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
schema := jsonschema.Reflect(&types.ZarfPackage{})
output, err := json.MarshalIndent(schema, "", " ")
if err != nil {
Expand All @@ -146,7 +146,7 @@ var genTypesSchemaCmd = &cobra.Command{
Use: "gen-types-schema",
Aliases: []string{"gt"},
Short: lang.CmdInternalTypesSchemaShort,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
schema := jsonschema.Reflect(&zarfTypes{})
output, err := json.MarshalIndent(schema, "", " ")
if err != nil {
Expand All @@ -160,7 +160,7 @@ var createReadOnlyGiteaUser = &cobra.Command{
Use: "create-read-only-gitea-user",
Short: lang.CmdInternalCreateReadOnlyGiteaUserShort,
Long: lang.CmdInternalCreateReadOnlyGiteaUserLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Load the state so we can get the credentials for the admin git user
state, err := cluster.NewClusterOrDie().LoadZarfState()
if err != nil {
Expand All @@ -178,7 +178,7 @@ var createPackageRegistryToken = &cobra.Command{
Use: "create-artifact-registry-token",
Short: lang.CmdInternalArtifactRegistryGiteaTokenShort,
Long: lang.CmdInternalArtifactRegistryGiteaTokenLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Load the state so we can get the credentials for the admin git user
c := cluster.NewClusterOrDie()
state, err := c.LoadZarfState()
Expand All @@ -204,7 +204,7 @@ var updateGiteaPVC = &cobra.Command{
Use: "update-gitea-pvc",
Short: lang.CmdInternalUpdateGiteaPVCShort,
Long: lang.CmdInternalUpdateGiteaPVCLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {

// There is a possibility that the pvc does not yet exist and Gitea helm chart should create it
helmShouldCreate, err := git.UpdateGiteaPVC(rollback)
Expand All @@ -219,7 +219,7 @@ var updateGiteaPVC = &cobra.Command{
var isValidHostname = &cobra.Command{
Use: "is-valid-hostname",
Short: lang.CmdInternalIsValidHostnameShort,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
if valid := helpers.IsValidHostName(); !valid {
hostname, _ := os.Hostname()
message.Fatalf(nil, lang.CmdInternalIsValidHostnameErr, hostname)
Expand All @@ -232,7 +232,7 @@ var computeCrc32 = &cobra.Command{
Aliases: []string{"c"},
Short: lang.CmdInternalCrc32Short,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
text := args[0]
hash := helpers.GetCRCHash(text)
fmt.Printf("%d\n", hash)
Expand Down
16 changes: 8 additions & 8 deletions src/cmd/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var packageCreateCmd = &cobra.Command{
Args: cobra.MaximumNArgs(1),
Short: lang.CmdPackageCreateShort,
Long: lang.CmdPackageCreateLong,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
common.SetBaseDirectory(args, &pkgConfig)

var isCleanPathRegex = regexp.MustCompile(`^[a-zA-Z0-9\_\-\/\.\~\\:]+$`)
Expand Down Expand Up @@ -70,7 +70,7 @@ var packageDeployCmd = &cobra.Command{
Short: lang.CmdPackageDeployShort,
Long: lang.CmdPackageDeployLong,
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
pkgConfig.PkgOpts.PackageSource = choosePackage(args)

// Ensure uppercase keys from viper and CLI --set
Expand Down Expand Up @@ -98,7 +98,7 @@ var packageMirrorCmd = &cobra.Command{
Long: lang.CmdPackageMirrorLong,
Example: lang.CmdPackageMirrorExample,
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
pkgConfig.PkgOpts.PackageSource = choosePackage(args)

// Configure the packager
Expand All @@ -118,7 +118,7 @@ var packageInspectCmd = &cobra.Command{
Short: lang.CmdPackageInspectShort,
Long: lang.CmdPackageInspectLong,
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
pkgConfig.PkgOpts.PackageSource = choosePackage(args)

src := identifyAndFallbackToClusterSource()
Expand All @@ -139,7 +139,7 @@ var packageListCmd = &cobra.Command{
Use: "list",
Aliases: []string{"l", "ls"},
Short: lang.CmdPackageListShort,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Get all the deployed packages
deployedZarfPackages, errs := cluster.NewClusterOrDie().GetDeployedZarfPackages()
if len(errs) > 0 && len(deployedZarfPackages) == 0 {
Expand Down Expand Up @@ -177,7 +177,7 @@ var packageRemoveCmd = &cobra.Command{
Aliases: []string{"u", "rm"},
Args: cobra.MaximumNArgs(1),
Short: lang.CmdPackageRemoveShort,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
pkgConfig.PkgOpts.PackageSource = choosePackage(args)

src := identifyAndFallbackToClusterSource()
Expand All @@ -197,7 +197,7 @@ var packagePublishCmd = &cobra.Command{
Short: lang.CmdPackagePublishShort,
Example: lang.CmdPackagePublishExample,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
pkgConfig.PkgOpts.PackageSource = args[0]

if !helpers.IsOCIURL(args[1]) {
Expand Down Expand Up @@ -236,7 +236,7 @@ var packagePullCmd = &cobra.Command{
Short: lang.CmdPackagePullShort,
Example: lang.CmdPackagePullExample,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
pkgConfig.PkgOpts.PackageSource = args[0]

// Configure the packager
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (

var rootCmd = &cobra.Command{
Use: "zarf COMMAND",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
// Skip for vendor-only commands
if common.CheckVendorOnlyFromPath(cmd) {
return
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/tools/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var archiverCompressCmd = &cobra.Command{
Aliases: []string{"c"},
Short: lang.CmdToolsArchiverCompressShort,
Args: cobra.MinimumNArgs(2),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
sourceFiles, destinationArchive := args[:len(args)-1], args[len(args)-1]
err := archiver.Archive(sourceFiles, destinationArchive)
if err != nil {
Expand All @@ -44,7 +44,7 @@ var archiverDecompressCmd = &cobra.Command{
Aliases: []string{"d"},
Short: lang.CmdToolsArchiverDecompressShort,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
sourceArchive, destinationPath := args[0], args[1]
err := archiver.Unarchive(sourceArchive, destinationPath)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var toolsCmd = &cobra.Command{
Use: "tools",
Aliases: []string{"t"},
PersistentPreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
config.SkipLogFile = true

// Skip for vendor-only commands
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/crane.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func init() {
Use: "registry",
Aliases: []string{"r", "crane"},
Short: lang.CmdToolsRegistryShort,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(cmd *cobra.Command, _ []string) {

exec.ExitOnInterrupt()

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/helm/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func newDependencyListCmd(out io.Writer) *cobra.Command {
Short: "list the dependencies for the given chart",
Long: dependencyListDesc,
Args: require.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
chartpath := "."
if len(args) > 0 {
chartpath = filepath.Clean(args[0])
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/helm/dependency_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func newDependencyBuildCmd(cfg *action.Configuration, out io.Writer) *cobra.Comm
Short: "rebuild the charts/ directory based on the Chart.lock file",
Long: dependencyBuildDesc,
Args: require.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
chartpath := "."
if len(args) > 0 {
chartpath = filepath.Clean(args[0])
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/helm/dependency_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func newDependencyUpdateCmd(cfg *action.Configuration, out io.Writer) *cobra.Com
Short: "update charts/ based on the contents of Chart.yaml",
Long: dependencyUpDesc,
Args: require.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
chartpath := "."
if len(args) > 0 {
chartpath = filepath.Clean(args[0])
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/helm/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func bindOutputFlag(cmd *cobra.Command, varRef *output.Format) {
cmd.Flags().VarP(newOutputValue(output.Table, varRef), outputFlag, "o",
fmt.Sprintf("prints the output in the specified format. Allowed values: %s", strings.Join(output.Formats(), ", ")))

err := cmd.RegisterFlagCompletionFunc(outputFlag, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
err := cmd.RegisterFlagCompletionFunc(outputFlag, func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
var formatNames []string
for format, desc := range output.FormatsWithDesc() {
formatNames = append(formatNames, fmt.Sprintf("%s\t%s", format, desc))
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/helm/load_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func addPluginCommands(plugin *plugin.Plugin, baseCmd *cobra.Command, cmds *plug
// to the dynamic completion script of the plugin.
DisableFlagParsing: true,
// A Run is required for it to be a valid command without subcommands
Run: func(cmd *cobra.Command, args []string) {},
Run: func(_ *cobra.Command, _ []string) {},
}
baseCmd.AddCommand(subCmd)
addPluginCommands(plugin, subCmd, &cmd)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/helm/repo_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func newRepoAddCmd(out io.Writer) *cobra.Command {
Use: "add [NAME] [URL]",
Short: "add a chart repository",
Args: require.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
o.name = args[0]
o.url = args[1]
o.repoFile = settings.RepositoryConfig
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/tools/helm/repo_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ func newRepoIndexCmd(out io.Writer) *cobra.Command {
Short: "generate an index file given a directory containing packaged charts",
Long: repoIndexDesc,
Args: require.ExactArgs(1),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
ValidArgsFunction: func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
if len(args) == 0 {
// Allow file completion when completing the argument for the directory
return nil, cobra.ShellCompDirectiveDefault
}
// No more completions, so disable file completion
return nil, cobra.ShellCompDirectiveNoFileComp
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
o.dir = args[0]
return o.run(out)
},
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/tools/helm/repo_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func newRepoListCmd(out io.Writer) *cobra.Command {
Aliases: []string{"ls"},
Short: "list chart repositories",
Args: require.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
f, _ := repo.LoadFile(settings.RepositoryConfig)
if len(f.Repositories) == 0 && !(outfmt == output.JSON || outfmt == output.YAML) {
return errors.New("no repositories to show")
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/tools/helm/repo_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ func newRepoRemoveCmd(out io.Writer) *cobra.Command {
Aliases: []string{"rm"},
Short: "remove one or more chart repositories",
Args: require.MinimumNArgs(1),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
ValidArgsFunction: func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return compListRepos(toComplete, args), cobra.ShellCompDirectiveNoFileComp
},
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, args []string) error {
o.repoFile = settings.RepositoryConfig
o.repoCache = settings.RepositoryCache
o.names = args
Expand Down
Loading

0 comments on commit 1bd496e

Please sign in to comment.