From 6e655bc844e4e26b36f74ad7097327ae28f0a8f2 Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Thu, 7 Sep 2023 10:55:43 +0200 Subject: [PATCH] cleanup(cmd): renamed `s3` to `drivers`. Signed-off-by: Federico Di Pierro --- README.md | 11 ++++++++++- cmd/build/{build.go => build_configs.go} | 6 +++--- cmd/cleanup/{cleanup.go => cleanup_configs.go} | 8 ++++---- cmd/cleanup/{cleanup_s3.go => cleanup_drivers.go} | 6 +++--- cmd/configs.go | 10 +++++----- cmd/{s3.go => drivers.go} | 10 +++++----- cmd/generate/{generate.go => generate_configs.go} | 6 +++--- cmd/publish/{publish.go => publish_drivers.go} | 6 +++--- cmd/stats/{stats.go => stats_configs.go} | 8 ++++---- cmd/stats/{stats_s3.go => stats_drivers.go} | 6 +++--- cmd/validate/{validate.go => validate_configs.go} | 6 +++--- 11 files changed, 46 insertions(+), 37 deletions(-) rename cmd/build/{build.go => build_configs.go} (88%) rename cmd/cleanup/{cleanup.go => cleanup_configs.go} (64%) rename cmd/cleanup/{cleanup_s3.go => cleanup_drivers.go} (81%) rename cmd/{s3.go => drivers.go} (53%) rename cmd/generate/{generate.go => generate_configs.go} (90%) rename cmd/publish/{publish.go => publish_drivers.go} (81%) rename cmd/stats/{stats.go => stats_configs.go} (62%) rename cmd/stats/{stats_s3.go => stats_drivers.go} (75%) rename cmd/validate/{validate.go => validate_configs.go} (71%) diff --git a/README.md b/README.md index e967204..71ea66b 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,12 @@ Usage: Available Commands: completion Generate the autocompletion script for the specified shell configs Work with local dbg configs + drivers Work with remote drivers bucket help Help about any command - s3 Work with remote s3 bucket Flags: -a, --architecture string architecture to run against. Supported: [amd64,arm64] (default "amd64") + --driver-name string driver name to be used (default "falco") --driver-version strings driver versions to run against. --dry-run enable dry-run mode. -h, --help help for dbg-go @@ -114,5 +115,13 @@ Using `goreleaser`, multiple artifacts are attached to each github release; amon ``` +
+ Publish locally built drivers for aarch64 for all supported driver versions by test-infra + +```bash +./dbg-go drivers publish --repo-root test-infra --architecture arm64 +``` +
+ > **NOTE:** all commands that require s3 write access, need a proper `--aws-profile` to be passed. diff --git a/cmd/build/build.go b/cmd/build/build_configs.go similarity index 88% rename from cmd/build/build.go rename to cmd/build/build_configs.go index b29456a..5c50dac 100644 --- a/cmd/build/build.go +++ b/cmd/build/build_configs.go @@ -7,11 +7,11 @@ import ( "github.com/spf13/viper" ) -func NewBuildCmd() *cobra.Command { +func NewBuildConfigsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "build", Short: "build dbg configs", - RunE: execute, + RunE: executeConfigs, } flags := cmd.Flags() flags.Bool("skip-existing", true, "whether to skip the build of drivers existing on S3") @@ -23,7 +23,7 @@ func NewBuildCmd() *cobra.Command { return cmd } -func execute(_ *cobra.Command, _ []string) error { +func executeConfigs(_ *cobra.Command, _ []string) error { options := build.Options{ Options: root.LoadRootOptions(), SkipExisting: viper.GetBool("skip-existing"), diff --git a/cmd/cleanup/cleanup.go b/cmd/cleanup/cleanup_configs.go similarity index 64% rename from cmd/cleanup/cleanup.go rename to cmd/cleanup/cleanup_configs.go index 7a75c7e..4a6ce8d 100644 --- a/cmd/cleanup/cleanup.go +++ b/cmd/cleanup/cleanup_configs.go @@ -6,15 +6,15 @@ import ( "github.com/spf13/cobra" ) -func NewCleanupCmd() *cobra.Command { +func NewCleanupConfigsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "cleanup", - Short: "Cleanup outdated dbg configs", - RunE: execute, + Short: "Cleanup dbg configs", + RunE: executeConfigs, } return cmd } -func execute(c *cobra.Command, args []string) error { +func executeConfigs(c *cobra.Command, args []string) error { return cleanup.Run(cleanup.Options{Options: root.LoadRootOptions()}, cleanup.NewFileCleaner()) } diff --git a/cmd/cleanup/cleanup_s3.go b/cmd/cleanup/cleanup_drivers.go similarity index 81% rename from cmd/cleanup/cleanup_s3.go rename to cmd/cleanup/cleanup_drivers.go index c2d0cd2..b06370f 100644 --- a/cmd/cleanup/cleanup_s3.go +++ b/cmd/cleanup/cleanup_drivers.go @@ -7,11 +7,11 @@ import ( "github.com/spf13/viper" ) -func NewCleanupS3Cmd() *cobra.Command { +func NewCleanupDriversCmd() *cobra.Command { cmd := &cobra.Command{ Use: "cleanup", Short: "Cleanup desired remote drivers", - RunE: executeS3, + RunE: executeDrivers, } flags := cmd.Flags() @@ -21,7 +21,7 @@ func NewCleanupS3Cmd() *cobra.Command { return cmd } -func executeS3(_ *cobra.Command, _ []string) error { +func executeDrivers(_ *cobra.Command, _ []string) error { cleaner, err := cleanup.NewS3Cleaner(viper.GetString("aws-profile")) if err != nil { return err diff --git a/cmd/configs.go b/cmd/configs.go index ae8e6f4..4349155 100644 --- a/cmd/configs.go +++ b/cmd/configs.go @@ -18,9 +18,9 @@ var ( func init() { // Subcommands - configsCmd.AddCommand(generate.NewGenerateCmd()) - configsCmd.AddCommand(cleanup.NewCleanupCmd()) - configsCmd.AddCommand(validate.NewValidateCmd()) - configsCmd.AddCommand(stats.NewStatsCmd()) - configsCmd.AddCommand(build.NewBuildCmd()) + configsCmd.AddCommand(generate.NewGenerateConfigsCmd()) + configsCmd.AddCommand(cleanup.NewCleanupConfigsCmd()) + configsCmd.AddCommand(validate.NewValidateConfigsCmd()) + configsCmd.AddCommand(stats.NewStatsConfigsCmd()) + configsCmd.AddCommand(build.NewBuildConfigsCmd()) } diff --git a/cmd/s3.go b/cmd/drivers.go similarity index 53% rename from cmd/s3.go rename to cmd/drivers.go index b3077b9..c47c830 100644 --- a/cmd/s3.go +++ b/cmd/drivers.go @@ -9,14 +9,14 @@ import ( var ( s3Cmd = &cobra.Command{ - Use: "s3", - Short: "Work with remote s3 bucket", + Use: "drivers", + Short: "Work with remote drivers bucket", } ) func init() { // Subcommands - s3Cmd.AddCommand(cleanup.NewCleanupS3Cmd()) - s3Cmd.AddCommand(stats.NewStatsS3Cmd()) - s3Cmd.AddCommand(publish.NewPublishCmd()) + s3Cmd.AddCommand(cleanup.NewCleanupDriversCmd()) + s3Cmd.AddCommand(stats.NewStatsDriversCmd()) + s3Cmd.AddCommand(publish.NewPublishDriversCmd()) } diff --git a/cmd/generate/generate.go b/cmd/generate/generate_configs.go similarity index 90% rename from cmd/generate/generate.go rename to cmd/generate/generate_configs.go index eb90690..e6d7666 100644 --- a/cmd/generate/generate.go +++ b/cmd/generate/generate_configs.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/viper" ) -func NewGenerateCmd() *cobra.Command { +func NewGenerateConfigsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "generate", Short: "Generate new dbg configs", @@ -19,14 +19,14 @@ Instead, when auto mode is disabled, the tool is able to generate a single confi In this scenario, target-{distro,kernelrelease,kernelversion} CANNOT be regexes but must be exact values. Also, in non-automatic mode, kernelurls driverkit config key will be constructed using driverkit libraries. `, - RunE: execute, + RunE: executeConfigs, } flags := cmd.Flags() flags.Bool("auto", false, "automatically generate configs from kernel-crawler output") return cmd } -func execute(c *cobra.Command, args []string) error { +func executeConfigs(c *cobra.Command, args []string) error { options := generate.Options{ Options: root.LoadRootOptions(), Auto: viper.GetBool("auto"), diff --git a/cmd/publish/publish.go b/cmd/publish/publish_drivers.go similarity index 81% rename from cmd/publish/publish.go rename to cmd/publish/publish_drivers.go index b1ce4c3..1ea797a 100644 --- a/cmd/publish/publish.go +++ b/cmd/publish/publish_drivers.go @@ -7,11 +7,11 @@ import ( "github.com/spf13/viper" ) -func NewPublishCmd() *cobra.Command { +func NewPublishDriversCmd() *cobra.Command { cmd := &cobra.Command{ Use: "publish", Short: "publish local drivers to remote bucket", - RunE: execute, + RunE: executeDrivers, } flags := cmd.Flags() flags.String("aws-profile", "", "aws-profile to be used. Mandatory.") @@ -20,7 +20,7 @@ func NewPublishCmd() *cobra.Command { return cmd } -func execute(_ *cobra.Command, _ []string) error { +func executeDrivers(_ *cobra.Command, _ []string) error { options := publish.Options{ Options: root.LoadRootOptions(), AwsProfile: viper.GetString("aws-profile"), diff --git a/cmd/stats/stats.go b/cmd/stats/stats_configs.go similarity index 62% rename from cmd/stats/stats.go rename to cmd/stats/stats_configs.go index e238ff4..f2001eb 100644 --- a/cmd/stats/stats.go +++ b/cmd/stats/stats_configs.go @@ -6,15 +6,15 @@ import ( "github.com/spf13/cobra" ) -func NewStatsCmd() *cobra.Command { +func NewStatsConfigsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "stats", - Short: "Fetch stats about configs", - RunE: execute, + Short: "Fetch stats about dbg configs", + RunE: executeConfigs, } return cmd } -func execute(_ *cobra.Command, _ []string) error { +func executeConfigs(_ *cobra.Command, _ []string) error { return stats.Run(stats.Options{Options: root.LoadRootOptions()}, stats.NewFileStatter()) } diff --git a/cmd/stats/stats_s3.go b/cmd/stats/stats_drivers.go similarity index 75% rename from cmd/stats/stats_s3.go rename to cmd/stats/stats_drivers.go index 76a25a7..9576ccc 100644 --- a/cmd/stats/stats_s3.go +++ b/cmd/stats/stats_drivers.go @@ -6,16 +6,16 @@ import ( "github.com/spf13/cobra" ) -func NewStatsS3Cmd() *cobra.Command { +func NewStatsDriversCmd() *cobra.Command { cmd := &cobra.Command{ Use: "stats", Short: "Fetch stats about remote drivers", - RunE: executeS3, + RunE: executeDrivers, } return cmd } -func executeS3(_ *cobra.Command, _ []string) error { +func executeDrivers(_ *cobra.Command, _ []string) error { statter, err := stats.NewS3Statter() if err != nil { return err diff --git a/cmd/validate/validate.go b/cmd/validate/validate_configs.go similarity index 71% rename from cmd/validate/validate.go rename to cmd/validate/validate_configs.go index 6cc6a4a..671a678 100644 --- a/cmd/validate/validate.go +++ b/cmd/validate/validate_configs.go @@ -6,16 +6,16 @@ import ( "github.com/spf13/cobra" ) -func NewValidateCmd() *cobra.Command { +func NewValidateConfigsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "validate", Short: "Validate dbg configs", - RunE: execute, + RunE: executeConfigs, } return cmd } -func execute(c *cobra.Command, args []string) error { +func executeConfigs(c *cobra.Command, args []string) error { options := validate.Options{ Options: root.LoadRootOptions(), }