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

Commit

Permalink
Merge pull request #4770 from hashicorp/i-config-workspace-scope-flag
Browse files Browse the repository at this point in the history
Remove `-workspace-scope` flag on `config set` and `config delete`
  • Loading branch information
paladin-devops committed Jun 6, 2023
2 parents 5cca8c2 + d899238 commit 8debf26
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 48 deletions.
4 changes: 4 additions & 0 deletions .changelog/4770.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:improvement
cli: Use -w flag for workspace scoping on `config set` and `config delete`,
instead of `workspace-scope`.
```
8 changes: 4 additions & 4 deletions embedJson/gen/platform-aws-ecs.json
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
"Field": "health_check",
"Type": "ecs.AppHealthCheck",
"Synopsis": "Health check settings for the app.",
"Summary": "",
"Summary": "These settings configure a health check for the application target group.",
"Optional": true,
"Default": "",
"EnvVar": "",
Expand Down Expand Up @@ -497,7 +497,7 @@
"Synopsis": "The amount of time, in seconds, between health checks.",
"Summary": "",
"Optional": true,
"Default": "",
"Default": "30",
"EnvVar": "",
"Category": false,
"Example": "",
Expand Down Expand Up @@ -542,10 +542,10 @@
{
"Field": "timeout",
"Type": "int64",
"Synopsis": "The amount of time, in seconds, for which no target response means a failure.",
"Synopsis": "The amount of time, in seconds, for which no target response means a failure. Must be lower than the interval.",
"Summary": "",
"Optional": true,
"Default": "",
"Default": "5",
"EnvVar": "",
"Category": false,
"Example": "",
Expand Down
19 changes: 4 additions & 15 deletions internal/cli/config_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ import (
type ConfigDeleteCommand struct {
*baseCommand

flagGlobal bool
flagScope string
flagWorkspaceScope string
flagLabelScope string
flagGlobal bool
flagScope string
flagLabelScope string
}

func (c *ConfigDeleteCommand) Run(args []string) int {
Expand Down Expand Up @@ -128,7 +127,7 @@ func (c *ConfigDeleteCommand) Run(args []string) int {
}

// If we have a workspace flag set, set that.
if v := c.flagWorkspaceScope; v != "" {
if v := c.flagWorkspace; v != "" {
configVar.Target.Workspace = &pb.Ref_Workspace{
Workspace: v,
}
Expand Down Expand Up @@ -164,16 +163,6 @@ func (c *ConfigDeleteCommand) Flags() *flag.Sets {
Default: "project",
})

f.StringVar(&flag.StringVar{
Name: "workspace-scope",
Target: &c.flagWorkspaceScope,
Usage: "Specify that the configuration is only available within a " +
"specific workspace. This configuration will only be deleted for " +
"deployments or operations when the workspace " +
"matches this.",
Default: "",
})

f.StringVar(&flag.StringVar{
Name: "label-scope",
Target: &c.flagLabelScope,
Expand Down
24 changes: 7 additions & 17 deletions internal/cli/config_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import (
"os"
"strings"

"github.com/posener/complete"

"github.com/hashicorp/waypoint-plugin-sdk/terminal"
"github.com/hashicorp/waypoint/internal/clierrors"
"github.com/hashicorp/waypoint/internal/pkg/flag"
pb "github.com/hashicorp/waypoint/pkg/server/gen"
"github.com/posener/complete"
)

type ConfigSetCommand struct {
*baseCommand

flagGlobal bool
flagRunner bool
flagScope string
flagWorkspaceScope string
flagLabelScope string
flagGlobal bool
flagRunner bool
flagScope string
flagLabelScope string
}

func (c *ConfigSetCommand) Run(args []string) int {
Expand Down Expand Up @@ -147,7 +147,7 @@ func (c *ConfigSetCommand) Run(args []string) int {
//TODO: update to add flag to target runner by workspace and labels

// If we have a workspace flag set, set that.
if v := c.flagWorkspaceScope; v != "" {
if v := c.flagWorkspace; v != "" {
configVar.Target.Workspace = &pb.Ref_Workspace{
Workspace: v,
}
Expand Down Expand Up @@ -183,16 +183,6 @@ func (c *ConfigSetCommand) Flags() *flag.Sets {
Default: "project",
})

f.StringVar(&flag.StringVar{
Name: "workspace-scope",
Target: &c.flagWorkspaceScope,
Usage: "Specify that the configuration is only available within a " +
"specific workspace. This configuration will only be set for " +
"deployments or operations (if -runner is set) when the workspace " +
"matches this.",
Default: "",
})

f.StringVar(&flag.StringVar{
Name: "label-scope",
Target: &c.flagLabelScope,
Expand Down
3 changes: 0 additions & 3 deletions internal/cli/config_source_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,5 @@ Usage: waypoint config source-set [options]
source plugin. When modifying an existing configuration, all desired
"-config" flags will need to be set each time the command is ran.
Configuration for this command is global. The "-app", "-project", and
"-workspace" flags are ignored on this command.
` + c.Flags().Help())
}
1 change: 0 additions & 1 deletion website/content/commands/config-delete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Delete a config variable from the system. This cannot be undone.
#### Command Options

- `-scope=<string>` - The scope for this configuration to delete. The configuration will only delete within this scope. This can be one of 'global', 'project', or 'app'. The default is project.
- `-workspace-scope=<string>` - Specify that the configuration is only available within a specific workspace. This configuration will only be deleted for deployments or operations when the workspace matches this.
- `-label-scope=<string>` - If set, configuration will only be deleted if the deployment or operation has a matching label set.

@include "commands/config-delete_more.mdx"
1 change: 0 additions & 1 deletion website/content/commands/config-set.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Specify the "-app" flag to set a config variable for a specific app.
#### Command Options

- `-scope=<string>` - The scope for this configuration. The configuration will only appear within this scope. This can be one of 'global', 'project', or 'app'. The default is project.
- `-workspace-scope=<string>` - Specify that the configuration is only available within a specific workspace. This configuration will only be set for deployments or operations (if -runner is set) when the workspace matches this.
- `-label-scope=<string>` - If set, configuration will only be set if the deployment or operation (if -runner is set) has a matching label set.
- `-runner` - Expose this configuration on runners. This can be used to set things such as credentials to cloud platforms for remote runners. This configuration will not be exposed to deployed applications. If this is specified in the context of a project, this will apply only to runners operating on jobs for the specific project or application. The default is false.

Expand Down
3 changes: 0 additions & 3 deletions website/content/commands/config-source-set.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ This command overrides all configuration already set for a configuration
source plugin. When modifying an existing configuration, all desired
"-config" flags will need to be set each time the command is ran.

Configuration for this command is global. The "-app", "-project", and
"-workspace" flags are ignored on this command.

#### Global Options

- `-plain` - Plain output: no colors, no animation. The default is false.
Expand Down
6 changes: 3 additions & 3 deletions website/content/docs/runner/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ secrets on the Waypoint server, you must set the environment variables manually
[manually running the runner](/waypoint/docs/runner/run-manual).

You can use the `-scope` flag paired with flags such as `-project`,
`-label-scope`, and `-workspace-scope` to set runner variables that are only
`-label-scope`, and `-workspace` to set runner variables that are only
available within certain scoped situations. Unscoped variables are globally sent to
all runners.

Expand All @@ -62,9 +62,9 @@ submit jobs to the `prod` namespace for the `prod` Waypoint workspace. Here's wh
that could look like:

```shell-session
$ waypoint config set -runner -workspace-scope=dev NOMAD_TOKEN=abc123
$ waypoint config set -runner -workspace=dev NOMAD_TOKEN=abc123
$ waypoint config set -runner -workspace-scope=prod NOMAD_TOKEN=def456
$ waypoint config set -runner -workspace=prod NOMAD_TOKEN=def456
$ waypoint config get -runner
SCOPE | NAME | VALUE | WORKSPACE | LABELS
Expand Down
6 changes: 5 additions & 1 deletion website/content/partials/components/platform-aws-ecs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ Set along with alb.domain_name to have DNS automatically setup for the ALB.

Health check settings for the app.

These settings configure a health check for the application target group.

- **Optional**

##### health_check.grpc_code
Expand All @@ -120,6 +122,7 @@ The amount of time, in seconds, between health checks.

- Type: **int64**
- **Optional**
- Default: 30

##### health_check.matcher

Expand All @@ -142,10 +145,11 @@ The protocol for the health check to use.

##### health_check.timeout

The amount of time, in seconds, for which no target response means a failure.
The amount of time, in seconds, for which no target response means a failure. Must be lower than the interval.

- Type: **int64**
- **Optional**
- Default: 5

##### health_check.unhealthy_threshold_count

Expand Down

0 comments on commit 8debf26

Please sign in to comment.