From b7b00c5a22c2923b289a5f3dab8c0d7f6bf4143c Mon Sep 17 00:00:00 2001 From: David Gannon <19214156+dgannon991@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:06:13 +0100 Subject: [PATCH] Feat/3140/better error message on mixin missing (#3145) * WIP: Add extra error when mixin missing Signed-off-by: David Gannon <19214156+dgannon991@users.noreply.github.com> * Added more information to the error message Signed-off-by: David Gannon <19214156+dgannon991@users.noreply.github.com> --------- Signed-off-by: David Gannon <19214156+dgannon991@users.noreply.github.com> Co-authored-by: schristoff <28318173+schristoff@users.noreply.github.com> --- pkg/linter/linter.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/linter/linter.go b/pkg/linter/linter.go index f5e67f8c3..3a763c771 100644 --- a/pkg/linter/linter.go +++ b/pkg/linter/linter.go @@ -210,7 +210,7 @@ func (l *Linter) Lint(ctx context.Context, m *manifest.Manifest) (Results, error return nil, span.Error(fmt.Errorf("error validating action: %s", action.name)) } results = append(results, res...) - } + } deps := make(map[string]interface{}, len(m.Dependencies.Requires)) for _, dep := range m.Dependencies.Requires { @@ -247,6 +247,10 @@ func (l *Linter) Lint(ctx context.Context, m *manifest.Manifest) (Results, error if strings.Contains(response.Error.Error(), "unknown command") { continue } + // put a helpful error when the mixin is not installed + if strings.Contains(response.Error.Error(), "not installed") { + return nil, span.Error(fmt.Errorf("mixin %[1]s is not currently installed. To find view more details you can run: porter mixin search %[1]s. To install you can run porter mixin install %[1]s", response.Name)) + } return nil, span.Error(fmt.Errorf("lint command failed for mixin %s: %s", response.Name, response.Stdout)) }