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

Support inferred sync on Custom artifacts with a Dockerfile #3752

Merged
merged 1 commit into from
Feb 28, 2020
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 pkg/skaffold/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ func syncMapForArtifact(a *latest.Artifact, insecureRegistries map[string]bool)
case a.DockerArtifact != nil:
return docker.SyncMap(a.Workspace, a.DockerArtifact.DockerfilePath, a.DockerArtifact.BuildArgs, insecureRegistries)

case a.CustomArtifact != nil && a.CustomArtifact.Dependencies != nil && a.CustomArtifact.Dependencies.Dockerfile != nil:
return docker.SyncMap(a.Workspace, a.CustomArtifact.Dependencies.Dockerfile.Path, a.CustomArtifact.Dependencies.Dockerfile.BuildArgs, insecureRegistries)

case a.KanikoArtifact != nil:
return docker.SyncMap(a.Workspace, a.KanikoArtifact.DockerfilePath, a.KanikoArtifact.BuildArgs, insecureRegistries)

Expand Down
24 changes: 24 additions & 0 deletions pkg/skaffold/sync/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,30 @@ func TestSyncMap(t *testing.T) {
},
expectedMap: map[string][]string{"main.go": {"/app/main.go"}},
},
{
description: "custom - supported",
artifactType: latest.ArtifactType{
CustomArtifact: &latest.CustomArtifact{
Dependencies: &latest.CustomDependencies{
Dockerfile: &latest.DockerfileDependency{
Path: "Dockerfile",
},
},
},
},
files: map[string]string{
"Dockerfile": "FROM alpine\nCOPY *.go /app/",
"main.go": "",
},
expectedMap: map[string][]string{"main.go": {"/app/main.go"}},
},
{
description: "custom, no dockerfile - not supported",
artifactType: latest.ArtifactType{
CustomArtifact: &latest.CustomArtifact{},
},
shouldErr: true,
},
{
description: "not supported",
artifactType: latest.ArtifactType{},
Expand Down