Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

bug: do not reset runner profile default if flag not specified #3702

Merged
merged 3 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/3702.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:bug
cli: Do not set runner profile defaultness to false if default flag not specified.
```

14 changes: 8 additions & 6 deletions internal/cli/runner_profile_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hclsyntax"
hcljson "github.com/hashicorp/hcl/v2/json"

"github.com/hashicorp/waypoint-plugin-sdk/terminal"
"github.com/hashicorp/waypoint/internal/clierrors"
"github.com/hashicorp/waypoint/internal/pkg/flag"
Expand All @@ -27,7 +28,7 @@ type RunnerProfileSetCommand struct {
flagEnvVars []string
flagPluginType string
flagPluginConfig string
flagDefault bool
flagDefault *bool
flagTargetRunnerId string
flagTargetRunnerLabels map[string]string
}
Expand Down Expand Up @@ -188,7 +189,9 @@ func (c *RunnerProfileSetCommand) Run(args []string) int {

od.OciUrl = c.flagOCIUrl
od.EnvironmentVariables = map[string]string{}
od.Default = c.flagDefault
if c.flagDefault != nil {
od.Default = *c.flagDefault
}

if c.flagEnvVars != nil {
//TODO(XX): Deprecate -env-vars and this logic
Expand Down Expand Up @@ -287,10 +290,9 @@ func (c *RunnerProfileSetCommand) Flags() *flag.Sets {
"the environment the plugin will launch the on-demand runner in.",
})

f.BoolVar(&flag.BoolVar{
Name: "default",
Target: &c.flagDefault,
Default: false,
f.BoolPtrVar(&flag.BoolPtrVar{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay BoolPtrVar comes in handy again 😄

Name: "default",
Target: &c.flagDefault,
Usage: "Indicates that this remote runner profile should be the default for any project that doesn't " +
"otherwise specify its own remote runner.",
})
Expand Down
2 changes: 1 addition & 1 deletion website/content/commands/runner-profile-set.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ lifecycle operation.
- `-env-vars=<string>` - DEPRECATED. Please see `-env-var`.
- `-plugin-type=<string>` - The type of the plugin to launch for the on-demand runner, such as aws-ecs, kubernetes, etc.
- `-plugin-config=<string>` - Path to an hcl file that contains the configuration for the plugin. This is only necessary when the plugin's defaults need to be adjusted for the environment the plugin will launch the on-demand runner in.
- `-default` - Indicates that this remote runner profile should be the default for any project that doesn't otherwise specify its own remote runner. The default is false.
- `-default` - Indicates that this remote runner profile should be the default for any project that doesn't otherwise specify its own remote runner.
- `-target-runner-id=<string>` - ID of the runner to target for this remote runner profile.
- `-target-runner-label=<key=value>` - Labels on the runner to target for this remote runner profile. e.g. `-target-runner-label=k=v`. Can be specified multiple times.

Expand Down