Skip to content

Commit

Permalink
fix(cmd): for build cmd, aws-profile is only required when publish
Browse files Browse the repository at this point in the history
…is enabled.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Sep 7, 2023
1 parent d4acc25 commit f84cf29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Using `goreleaser`, multiple artifacts are attached to each github release; amon
<summary>Fetch stats about remote drivers for 5.0.1+driver driver version, for host architecture</summary>

```bash
./dbg-go s3 stats --driver-version 5.0.1+driver
./dbg-go drivers stats --driver-version 5.0.1+driver
```
</details>

Expand Down
9 changes: 7 additions & 2 deletions cmd/build/build_configs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package build

import (
"fmt"
"github.com/fededp/dbg-go/pkg/build"
"github.com/fededp/dbg-go/pkg/root"
"github.com/spf13/cobra"
Expand All @@ -17,9 +18,8 @@ func NewBuildConfigsCmd() *cobra.Command {
flags.Bool("skip-existing", true, "whether to skip the build of drivers existing on S3")
flags.Bool("publish", false, "whether artifacts must be published on S3")
flags.Bool("ignore-errors", false, "whether to ignore build errors and go on looping on config files")
flags.String("aws-profile", "", "aws-profile to be used. Mandatory.")
flags.String("aws-profile", "", "aws-profile to be used. Mandatory if publish is enabled.")

_ = cmd.MarkFlagRequired("aws-profile")
return cmd
}

Expand All @@ -31,5 +31,10 @@ func executeConfigs(_ *cobra.Command, _ []string) error {
IgnoreErrors: viper.GetBool("ignore-errors"),
AwsProfile: viper.GetString("aws-profile"),
}

if options.Publish && options.AwsProfile == "" {
return fmt.Errorf("if publish is enabled, aws-profile is mandatory")
}

return build.Run(options)
}

0 comments on commit f84cf29

Please sign in to comment.