Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulling changes upstream into main #49

Merged
merged 2 commits into from
Jun 18, 2021
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
2 changes: 0 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
],
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"go.useGoProxyToCheckForToolUpdates": false,
"go.gopath": "/go"
},
// Add the IDs of extensions you want installed when the container is created.
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ jobs:
uses: actions/setup-go@v1
with:
go-version: 1.13.x
- name: Docker login
- name: Docker login (github packages)
uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: disneystreaming
password: ${{ secrets.GO_RELEASER }}
- name: Docker login (ghcr)
uses: azure/docker-login@v1
with:
login-server: ghcr.io
username: disneystreaming
password: ${{ secrets.GO_RELEASER }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
Expand Down
4 changes: 4 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ dockers:
- "docker.pkg.github.com/disneystreaming/ssm-helpers/ssm:{{ .Tag }}"
- "docker.pkg.github.com/disneystreaming/ssm-helpers/ssm:{{ .Major }}"
- "docker.pkg.github.com/disneystreaming/ssm-helpers/ssm:{{ .Major }}.{{ .Minor }}"
- "ghcr.io/disneystreaming/ssm:latest"
- "ghcr.io/disneystreaming/ssm:{{ .Tag }}"
- "ghcr.io/disneystreaming/ssm:{{ .Major }}"
- "ghcr.io/disneystreaming/ssm:{{ .Major }}.{{ .Minor }}"

nfpms:
- license: MIT
Expand Down
8 changes: 8 additions & 0 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ func validateSessionFlags(cmd *cobra.Command, instanceList []string, filterList
return cmdutil.UsageError(cmd, "The --filter and --instance flags cannot be used simultaneously.")
}

if len(filterList) > 5 {
return cmdutil.UsageError(cmd, "A maximum of 5 tag filters can be specified at a time.")
}

return nil
}

Expand All @@ -164,6 +168,10 @@ func validateRunFlags(cmd *cobra.Command, instanceList []string, commandList []s
return cmdutil.UsageError(cmd, "You must supply target arguments using either the --filter or --instance flags.")
}

if len(filterList) > 5 {
return cmdutil.UsageError(cmd, "A maximum of 5 tag filters can be specified at a time.")
}

if len(instanceList) > 50 {
return cmdutil.UsageError(cmd, "The --instance flag can only be used to specify a maximum of 50 instances.")
}
Expand Down
19 changes: 19 additions & 0 deletions cmd/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ func Test_validateRunFlags(t *testing.T) {
assert.Error(err)
})

t.Run("specify more than 5 filters", func(t *testing.T) {
targetList := make([]*ssm.Target, 6)
err := validateRunFlags(cmd, nil, []string{"hostname"}, targetList)
assert.Error(err)
})

t.Run("no instances or filters specified", func(t *testing.T) {
err := validateRunFlags(cmd, nil, []string{"hostname"}, nil)
assert.Error(err)
Expand Down Expand Up @@ -365,6 +371,19 @@ func Test_validateSessionFlags(t *testing.T) {
assert.Error(err)
})

t.Run("specify more than 5 filters", func(t *testing.T) {
targetList := map[string]string{
"1": "a",
"2": "b",
"3": "c",
"4": "d",
"5": "e",
"6": "f",
}
err := validateSessionFlags(cmd, nil, targetList)
assert.Error(err)
})

t.Run("valid flag combination", func(t *testing.T) {
err := validateSessionFlags(cmd, instanceList, nil)
assert.NoError(err)
Expand Down