-
Notifications
You must be signed in to change notification settings - Fork 1
fix: expand cache probe support to more directives #17
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,30 @@ func (w *WorkdirCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile | |
return nil | ||
} | ||
|
||
func (w *WorkdirCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error { | ||
logrus.Info("Cmd: workdir") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: wouldn't it be noisy? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is copy paste from the uncached execute, felt it's better to mimic the behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha 👍 |
||
workdirPath := w.cmd.Path | ||
replacementEnvs := buildArgs.ReplacementEnvs(config.Env) | ||
resolvedWorkingDir, err := util.ResolveEnvironmentReplacement(workdirPath, replacementEnvs, true) | ||
if err != nil { | ||
return err | ||
} | ||
if filepath.IsAbs(resolvedWorkingDir) { | ||
config.WorkingDir = resolvedWorkingDir | ||
} else { | ||
if config.WorkingDir != "" { | ||
config.WorkingDir = filepath.Join(config.WorkingDir, resolvedWorkingDir) | ||
} else { | ||
config.WorkingDir = filepath.Join("/", resolvedWorkingDir) | ||
} | ||
} | ||
logrus.Infof("Changed working directory to %s", config.WorkingDir) | ||
|
||
// TODO(mafredri): Check if we need to do more here. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are you concerned about? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this command runs in a build (uncached) and the target directory doesn't exist, it will be created and added to Testing or experience should tell us, though, so maybe I'll just remove the TODO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with leaving TODO here, we can always remove it later. Thanks for sharing the context! |
||
w.snapshotFiles = []string{} | ||
return nil | ||
} | ||
|
||
// FilesToSnapshot returns the workingdir, which should have been created if it didn't already exist | ||
func (w *WorkdirCommand) FilesToSnapshot() []string { | ||
return w.snapshotFiles | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add
logrus.Info()
to indicate which volumes will be ignored while building?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is copy paste from the uncached execute command. I don't think we should alter the behavior here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking only about improvements of debugging life, but it can be left as is 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's valid. We could always add it to both but maybe that's suited for a separate debugging PR.