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

Allow --no-cache to be passed to docker #2054

Merged
merged 10 commits into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions pkg/skaffold/docker/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ func (l *localDaemon) Build(ctx context.Context, out io.Writer, workspace string
Target: a.Target,
ForceRemove: l.forceRemove,
NetworkMode: a.NetworkMode,
NoCache: a.NoCache,
})
if err != nil {
return "", errors.Wrap(err, "docker build")
Expand Down Expand Up @@ -367,6 +368,11 @@ func GetBuildArgs(a *latest.DockerArtifact) ([]string, error) {
if a.NetworkMode != "" {
args = append(args, "--network", strings.ToLower(a.NetworkMode))
}

if a.NoCache != "" {
tejal29 marked this conversation as resolved.
Show resolved Hide resolved
args = append(args, "--no-cache")
}


return args, nil
}
3 changes: 3 additions & 0 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ type DockerArtifact struct {
// CacheFrom lists the Docker images used as cache sources.
// For example: `["golang:1.10.1-alpine3.7", "alpine:3.7"]`.
CacheFrom []string `yaml:"cacheFrom,omitempty"`

// pass in --no-cache to docker build to prevent caching
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment needs to be in the form

NoCache blah blah blah. otherwise the tests will complain 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed

NoCache string `yaml:"noCache,omitempty"`
tejal29 marked this conversation as resolved.
Show resolved Hide resolved
}

// BazelArtifact *beta* describes an artifact built with [Bazel](https://bazel.build/).
Expand Down