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

Only apply cache result progress if resulted in diff #778

Merged
merged 1 commit into from
Jun 14, 2022

Conversation

eseliger
Copy link
Member

A user reported this, we store execution step results in the cache also when no diff was generated (rightfully), but then we should only apply the patch when there is actually anything to do.

Also, I initially couldn't reproduce this locally because we swallowed this error in volume mode. It would only happen in bind mode.

Closes #755

Test plan

Verified this does properly fail in volume mode now, too and don't fail anymore at all.

@eseliger eseliger added the bug Something isn't working label Jun 12, 2022
@eseliger eseliger requested a review from a team June 12, 2022 12:24
Copy link
Contributor

@Piszmog Piszmog left a comment

Choose a reason for hiding this comment

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

Looks good, just one question

return execResult, nil, errors.Wrap(err, "getting changed files in step")
// If the previous steps made any modifications in the workspace yet,
// apply them.
if opts.task.CachedResult.Diff != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there existing tests to cover when CachedResult.Diff is blank and not blank?

Copy link
Member Author

Choose a reason for hiding this comment

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

Another PR just found this bug, and it has a test for it so will merge this and then in the next PR you'll get that test :)

Copy link
Contributor

@courier-new courier-new left a comment

Choose a reason for hiding this comment

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

Wow we were REALLY swallowing that error in volume mode, huh? 😬 Thanks for pulling it back out, and fixing the error itself haha.

This was reported by a user, we store execution step results in the cache also when no diff was generated (rightfully), but then we should only apply the patch when there is actually anything to do.

Also, I initially couldn't reproduce this locally because we swallowed this error in volume mode. It would only happen in bind mode.
@eseliger eseliger force-pushed the es/fix-workspace-diff-apply branch from dedd19b to cfc2e91 Compare June 14, 2022 23:07
@eseliger eseliger merged commit 181e3de into main Jun 14, 2022
@eseliger eseliger deleted the es/fix-workspace-diff-apply branch June 14, 2022 23:10
scjohns pushed a commit that referenced this pull request Apr 24, 2023
This was reported by a user, we store execution step results in the cache also when no diff was generated (rightfully), but then we should only apply the patch when there is actually anything to do.

Also, I initially couldn't reproduce this locally because we swallowed this error in volume mode. It would only happen in bind mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

batches: getting changed files in step: applying cached diff: error: unrecognized input: exit status 128
4 participants