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

fix: expand cache probe support to more directives #17

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Jul 12, 2024

@mafredri mafredri force-pushed the mafredri/fix-expand-cache-probe-support branch 2 times, most recently from 19cd569 to e20fba2 Compare July 12, 2024 13:24
@mafredri mafredri marked this pull request as ready for review July 16, 2024 09:25
@mafredri mafredri self-assigned this Jul 16, 2024
}
logrus.Infof("Changed working directory to %s", config.WorkingDir)

// TODO(mafredri): Check if we need to do more here.
Copy link
Member

Choose a reason for hiding this comment

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

What are you concerned about?

Copy link
Member Author

Choose a reason for hiding this comment

The 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 w.snapshotFiles. My concern is if we need to mimic this behavior or not when running cached.

Testing or experience should tell us, though, so maybe I'll just remove the TODO.

Copy link
Member

Choose a reason for hiding this comment

The 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!

@@ -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")
Copy link
Member

Choose a reason for hiding this comment

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

nit: wouldn't it be noisy?

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha 👍

existingVolumes[volume] = x
util.AddVolumePathToIgnoreList(volume)
}
config.Volumes = existingVolumes
Copy link
Member

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?

Copy link
Member Author

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 🤔

Copy link
Member

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 👍

Copy link
Member Author

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.

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Fingers crossed!

@mafredri mafredri merged commit 70073a6 into main Jul 17, 2024
9 checks passed
@mafredri mafredri deleted the mafredri/fix-expand-cache-probe-support branch July 17, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coder/kaniko: support caching ENV and ARG directives
2 participants