fix: apply metadata outside symlink handling #146
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira: https://harness.atlassian.net/browse/CI-18276?focusedCommentId=1217420
This PR addresses a critical issue where the Harness CI cache plugin fails to preserve file timestamps when restoring caches from S3 or GCS. This bug prevents time-based cleanup mechanisms, like Gradle's built-in pruning and standard find commands, from correctly identifying and deleting old cache files.
The fix introduces a new, optional boolean flag, preserve_metadata, which defaults to false for backward compatibility. When set to true, the plugin will now explicitly restore the original file timestamps upon extracting the cache to the build agent.
Key changes:
New Flag: preserve_metadata is added to the plugin settings.
Core Logic: The plugin will now restore file timestamps to their original values.
Scope: This fix applies to the S3 and GCS backends of the drone-cache plugin.
Acceptance Criteria: After this change, time-based cache cleanup will function correctly, ensuring that old files are properly removed to save disk space.
This enhancement is crucial for ensuring the efficiency and health of build agent disk space over time.
Executions:
S3
linux k8s: https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]pUPZp3rkw&step=whCLcek2SMuCX3MqLgcWLQ&childStage=&stageExecId=
linux amd64 hosted:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]1MDTygs4g&step=dfb1JTzcTHqCXcNAG8K54w&childStage=&stageExecId=
linux arm64 hosted:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]iIGiPhZTA&step=VwLtHBo2SoiIMabgltI0IA&childStage=&stageExecId=
windows amd64 hosted:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]Y6rC-JcSg&step=GWAuWMkVRlWi25QNkoLNEA&childStage=&stageExecId=
GCS
linux amd k8:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]s/HIB37_VXQxuqu32T1KN02w/pipeline?stage=fxJ4nGhOSVGR7AwmVhXyBw
linux amd64 hosted:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]s/QQDhNZTgRoCu8J1vvi2Hpw/pipeline?stage=joHCSxrDRseWKIRWS6HfEQ
linux arm64 hosted:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]s/Leng1b3WRBCxt7KpinNqaA/pipeline?stage=bBDq1S5AQDeQchI0YzL67A
windows amd64 hosted:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]s/C8scgYOESyCAUJF6xdYXNQ/pipeline?stage=SVHJ1EBiQj2uq1rscpvirw
disabled:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/V[…]ed/executions/jiTjxCsLS9C_ZOJhCgeakA/pipeline?storeType=INLINE
Final execution with deletion logic:
https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/Vikas/pipelines/GCS_Test_Hosted/executions/6RTWbmiSQyiUnYV71rS2gg/pipeline
without the flag: https://qa.harness.io/ng/account/h61p38AZSV6MzEkpWWBtew/all/orgs/default/projects/Vikas/pipelines/GCS_Test_Hosted/executions/TAu-LxlfRK-UYznsAcCHaQ/pipeline
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Fixes #
Proposed Changes
Description
Checklist
Unreleasedsection of CHANGELOG.