From 2cd1bdbc32479268e7adaa326e86ca893b59d2cc Mon Sep 17 00:00:00 2001 From: Aaron Prindle Date: Thu, 11 Nov 2021 10:08:41 -0800 Subject: [PATCH] fix: fix multi-module issue for skaffold lint dockerfile support (#6831) --- pkg/skaffold/lint/dockerfiles.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/skaffold/lint/dockerfiles.go b/pkg/skaffold/lint/dockerfiles.go index 8247b26470f..b0141cde07c 100644 --- a/pkg/skaffold/lint/dockerfiles.go +++ b/pkg/skaffold/lint/dockerfiles.go @@ -28,7 +28,6 @@ import ( ) // for testing -// var getDockerDependencies = docker.GetDependencies var getDockerDependenciesForEachFromTo = docker.GetDependenciesByDockerCopyFromTo var dockerfileRules = &dockerfileLintRules @@ -128,7 +127,12 @@ func GetDockerfilesLintResults(ctx context.Context, opts Options, dockerCfg dock for _, c := range cfgs { for _, a := range c.Build.Artifacts { if a.DockerArtifact != nil { - ws := filepath.Join(workdir, a.Workspace) + // TODO(aaron-prindle) HACK - multi-module configs use abs path for a.Workspace vs single module which has rel path + // see if there is a built-in/better way of handling this. This is currently working for multi-module + ws := a.Workspace + if !filepath.IsAbs(ws) { + ws = filepath.Join(workdir, a.Workspace) + } fp := filepath.Join(ws, a.DockerArtifact.DockerfilePath) if _, ok := seen[fp]; ok { continue