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

Fixed providers to search by most-specific module contract #180

Merged
merged 3 commits into from
Jan 19, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 0.0.111 (Jan 19, 2024)
* Fixed an issue where a Beanstalk app would sporadically use the EC2 providers for commands. (e.g. `ssh`)

# 0.0.110 (Jan 18, 2024)
* Fixed `error starting ssm session` bug when using `nullstone ssh` against AWS. (Upgraded aws sdk packages)

Expand Down
23 changes: 2 additions & 21 deletions admin/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package admin

import (
"github.com/nullstone-io/deployment-sdk/app"
"github.com/nullstone-io/deployment-sdk/contract"
"github.com/nullstone-io/deployment-sdk/logging"
"github.com/nullstone-io/deployment-sdk/outputs"
"gopkg.in/nullstone-io/go-api-client.v0/types"
Expand All @@ -26,25 +27,5 @@ func (s Providers) FindRemoter(osWriters logging.OsWriters, source outputs.Retri
}

func (s Providers) FindFactory(curModule types.Module) *Provider {
if len(curModule.ProviderTypes) <= 0 {
return nil
}

// NOTE: We are matching app modules, so category is redundant
// However, this should guard against non-app modules trying to use these app providers
curContract := types.ModuleContractName{
Category: string(curModule.Category),
Subcategory: string(curModule.Subcategory),
// TODO: Enforce module provider can only contain one and only one provider type
Provider: curModule.ProviderTypes[0],
Platform: curModule.Platform,
Subplatform: curModule.Subplatform,
}
for k, v := range s {
if k.Match(curContract) {
return &v
}
}

return nil
return contract.FindInRegistrarByModule(s, &curModule)
}
43 changes: 22 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ require (
github.com/cristalhq/jwt/v3 v3.1.0
github.com/go-git/go-git/v5 v5.4.2
github.com/gosuri/uilive v0.0.4
github.com/nullstone-io/deployment-sdk v0.0.0-20240118232924-7cfcb37f6288
github.com/nullstone-io/deployment-sdk v0.0.0-20240119221556-8aa8a346063f
github.com/nullstone-io/module v0.2.9
github.com/ryanuber/columnize v2.1.2+incompatible
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.4
github.com/urfave/cli/v2 v2.3.0
golang.org/x/crypto v0.1.0
golang.org/x/crypto v0.18.0
golang.org/x/sync v0.5.0
gopkg.in/nullstone-io/go-api-client.v0 v0.0.0-20231109204408-47911e567aec
gopkg.in/nullstone-io/go-api-client.v0 v0.0.0-20240119221247-7d13771b44f8
k8s.io/api v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v0.27.2
Expand All @@ -40,8 +40,8 @@ require (
github.com/emirpasic/gods v1.12.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/google/uuid v1.3.0
github.com/hashicorp/hcl/v2 v2.14.1 // indirect
github.com/google/uuid v1.5.0
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand All @@ -53,25 +53,26 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/tmccombs/hcl2json v0.3.4 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/tmccombs/hcl2json v0.6.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/zclconf/go-cty v1.12.0 // indirect
golang.org/x/mod v0.8.0
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
golang.org/x/mod v0.14.0
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1
)

require (
cloud.google.com/go v0.81.0 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Microsoft/hcsshim v0.9.0 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.16.16 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.13 // indirect
Expand Down Expand Up @@ -111,11 +112,11 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down Expand Up @@ -152,10 +153,10 @@ require (
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/cli-runtime v0.27.1 // indirect
Expand Down
Loading