Skip to content

Commit

Permalink
ADD recommended flag to plugin index
Browse files Browse the repository at this point in the history
  • Loading branch information
madebyrogal committed Dec 20, 2023
1 parent e4b054d commit 6f742de
Show file tree
Hide file tree
Showing 19 changed files with 128 additions and 82 deletions.
1 change: 1 addition & 0 deletions internal/executor/doctor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (d *Executor) Metadata(context.Context) (api.MetadataOutput, error) {
JSONSchema: api.JSONSchema{
Value: configJSONSchema,
},
Recommended: false,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/executor/flux/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func (d *Executor) Metadata(context.Context) (api.MetadataOutput, error) {
JSONSchema: api.JSONSchema{
Value: configJSONSchema,
},
Recommended: false,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/executor/helm/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (e *Executor) Metadata(context.Context) (api.MetadataOutput, error) {
URLs: helmBinaryDownloadLinks,
},
},
Recommended: false,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/executor/kubectl/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (e *Executor) Metadata(context.Context) (api.MetadataOutput, error) {
URLs: kcBinaryDownloadLinks,
},
},
Recommended: true,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugin/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type (
URLs []IndexURL `yaml:"urls"`
JSONSchema JSONSchema `yaml:"jsonSchema"`
ExternalRequest ExternalRequest `yaml:"externalRequest,omitempty"`
Recommended bool `yaml:"recommended"`
}

// ExternalRequest contains the external request metadata for a given plugin.
Expand Down
1 change: 1 addition & 0 deletions internal/plugin/index_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (i *IndexBuilder) Build(dir, urlBasePath, pluginNameFilter string, skipChec
},
},
},
Recommended: meta.Recommended,
})
}

Expand Down
3 changes: 3 additions & 0 deletions internal/plugin/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type (
URLs map[string]URL
Dependencies map[string]map[string]string
JSONSchema JSONSchema
Recommended bool
}

URL struct {
Expand Down Expand Up @@ -102,6 +103,7 @@ func newStoreRepositories(indexes map[string][]byte) (storeRepository, storeRepo
URLs: binURLs,
Dependencies: depURLs,
JSONSchema: entry.JSONSchema,
Recommended: entry.Recommended,
})
case TypeSource:
sourcesRepositories.Insert(repo, entry.Name, storeEntry{
Expand All @@ -111,6 +113,7 @@ func newStoreRepositories(indexes map[string][]byte) (storeRepository, storeRepo
URLs: binURLs,
Dependencies: depURLs,
JSONSchema: entry.JSONSchema,
Recommended: entry.Recommended,
})
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/source/argocd/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func (s *Source) Metadata(_ context.Context) (api.MetadataOutput, error) {
},
},
},
Recommended: false,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/source/github_events/source_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ func (s *Source) Metadata(_ context.Context) (api.MetadataOutput, error) {
JSONSchema: api.JSONSchema{
Value: configJSONSchema,
},
Recommended: false,
}, nil
}
1 change: 1 addition & 0 deletions internal/source/keptn/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (p *Source) Metadata(_ context.Context) (api.MetadataOutput, error) {
JSONSchema: api.JSONSchema{
Value: configJSONSchema,
},
Recommended: false,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/source/kubernetes/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func (s *Source) Metadata(_ context.Context) (api.MetadataOutput, error) {
JSONSchema: api.JSONSchema{
Value: configJSONSchema,
},
Recommended: true,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/source/prometheus/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (p *Source) Metadata(_ context.Context) (api.MetadataOutput, error) {
JSONSchema: api.JSONSchema{
Value: configJSONSchema,
},
Recommended: false,
}, nil
}

Expand Down
79 changes: 45 additions & 34 deletions pkg/api/executor/executor.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/api/executor/grpc_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func (p *grpcClient) Metadata(ctx context.Context) (api.MetadataOutput, error) {
RefURL: resp.GetJsonSchema().GetRefUrl(),
},
Dependencies: api.ConvertDependenciesToAPI(resp.Dependencies),
Recommended: resp.Recommended,
}, nil
}

Expand Down Expand Up @@ -300,6 +301,7 @@ func (p *grpcServer) Metadata(ctx context.Context, _ *emptypb.Empty) (*MetadataR
RefUrl: meta.JSONSchema.RefURL,
},
Dependencies: api.ConvertDependenciesFromAPI[*Dependency, Dependency](meta.Dependencies),
Recommended: meta.Recommended,
}, nil
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/api/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type MetadataOutput struct {

// Dependencies holds the dependencies for a given platform binary.
Dependencies map[string]Dependency
// Recommended says if plugin is recommended
Recommended bool
}

// ExternalRequestMetadata contains the metadata for external requests.
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/source/grpc_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func (p *grpcClient) Metadata(ctx context.Context) (api.MetadataOutput, error) {
},
ExternalRequest: externalRequest,
Dependencies: api.ConvertDependenciesToAPI(resp.Dependencies),
Recommended: resp.Recommended,
}, nil
}

Expand Down Expand Up @@ -277,6 +278,7 @@ func (p *grpcServer) Metadata(ctx context.Context, _ *emptypb.Empty) (*MetadataR
},
},
Dependencies: api.ConvertDependenciesFromAPI[*Dependency, Dependency](meta.Dependencies),
Recommended: meta.Recommended,
}, nil
}

Expand Down
Loading

0 comments on commit 6f742de

Please sign in to comment.