Skip to content

Improve validation checks after copying#285

Merged
nikola-jokic merged 2 commits intoactions:mainfrom
vvanouytsel:main
Nov 24, 2025
Merged

Improve validation checks after copying#285
nikola-jokic merged 2 commits intoactions:mainfrom
vvanouytsel:main

Conversation

@vvanouytsel
Copy link
Copy Markdown
Contributor

@vvanouytsel vvanouytsel commented Nov 24, 2025

These commits improve the validation process after copying data from the source to the destination pod.
A more detailed description is written in each of the commits.

The find command now uses %s to list the actual size of the file instead of the block size, as these can be different because the source and target run in different containers and can have a different block size that is defined.

We noticed this when investigating why the checksums did not match.

diff runner-pod-sorted.txt workflow-pod-sorted.txt
913c913
< 236560 ./cc67f53d-c61d-4918-bf3a-48bca2ce9278/bin/node
---
> 236568 ./cc67f53d-c61d-4918-bf3a-48bca2ce9278/bin/node

Another thing that is fixed in this PR is the fact that the source checksum is only generated once. If the checksums do not match, the target checksum is created again, but the source checksum is never recreated.

We noticed that sometimes there are files in the source that are not present in the target.

 ❯ diff -y --suppress-common-lines workflow-pod.txt runner-pod.txt
5170 ./b99f33c0-c915-11f0-acee-cf89f10755bc.sh		     <
0 ./_runner_file_commands/set_env_034d3b41-5136-4200-aad8-ae5 <
0 ./_runner_file_commands/save_state_034d3b41-5136-4200-aad8- <
0 ./_runner_file_commands/step_summary_034d3b41-5136-4200-aad <
0 ./_runner_file_commands/add_path_034d3b41-5136-4200-aad8-ae <
0 ./_runner_file_commands/set_output_034d3b41-5136-4200-aad8- <
0 ./b894d959-4bf6-4b5f-8546-b858b54d81b9/bin/npm	     |	38 ./b894d959-4bf6-4b5f-8546-b858b54d81b9/bin/npm
0 ./b894d959-4bf6-4b5f-8546-b858b54d81b9/bin/npx	     |	38 ./b894d959-4bf6-4b5f-8546-b858b54d81b9/bin/npx
0 ./b894d959-4bf6-4b5f-8546-b858b54d81b9/bin/corepack	     |	45 ./b894d959-4bf6-4b5f-8546-b858b54d81b9/bin/corepack

When checking manually with the find command we saw that this diff is only temporary because if we ran the find command again, the files were the same.

With this change, if the source and target hashes do not match, the hash of the source and target are created again. This prevents the above race condition from occurring multiple times.

Fixes #275
Fixes #269

The hash from the source is calculated only once. The source hash is
checked with the destination hash, but if the destination hash does not
match, the destination match is calculated again.

The problem is that if the source hash is incorrect, the check will keep
failing because the source hash is never re-calculated.

Now, in the event that the hashes do not match, the hash of the source
and the destination are calculated again.
Previously the %b parameter was used with stat. This displays the block
size of the file. We noticed that in some cases the block size of the
source and the destination file could be slightly different. Since the
source and target run in different containers, they can have different
block sizes defined. If the block size did not match, the hash would also not match, even if
the file content would be exactly the same.

With this change, the block size is no longer used. Instead the actual
size in bytes of the file is listed.
@vvanouytsel vvanouytsel requested review from a team and nikola-jokic as code owners November 24, 2025 12:59
Copy link
Copy Markdown
Collaborator

@nikola-jokic nikola-jokic left a comment

Choose a reason for hiding this comment

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

Thanks!

@nikola-jokic nikola-jokic merged commit 0951cc7 into actions:main Nov 24, 2025
5 checks passed
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.

Copy mechanism does not seem to be consistent Steps delayed due to hash mismatch with kubernetes-novolume mode

2 participants