The modification time of the cache archive uploaded to S3 is incorrect.
Summary
The modification time of the cache archive uploaded to S3 is incorrect.
Steps to reproduce
- Deploy a GitLab runner with S3 cache and clear all cache (runner and S3)
- Trigger a job with cache
- Trigger the job again
# .gitlab-ci.yml
test:
cache:
key: test
paths:
- cache
script:
- mkdir -p cache
- head -c 1M </dev/urandom > cache/random.bin
Actual behavior
The modification time of the cache archive uploaded to S3 is incorrect.
It may be a time zone issue.
After the first trigger:
- Modification time of local cache archive: 2024-12-25 22:52:32 +0800 (correct)
- Modification time of S3 cache archive: 2024-12-25 22:52:32 +0000 (incorrect)
After the second trigger:
- Modification time of local cache archive: 2024-12-26 06:52:32 +0800 (incorrect)
- Modification time of S3 cache archive: 2024-12-25 22:52:32 +0000 (incorrect)
Due to incorrect modification time, the cache was not updated properly in the second job.
Expected behavior
After the first trigger:
- Modification time of local cache archive: 2024-12-25 22:52:32 +0800 (correct)
- Modification time of S3 cache archive: 2024-12-25 14:52:32 +0000 (correct)
After the second trigger:
- Modification time of local cache archive: 2024-12-25 22:53:45 +0800 (updated)
- Modification time of S3 cache archive: 2024-12-25 14:53:45 +0000 (updated)
Relevant logs and/or screenshots
Environment description
[[runners]]
name = ""
url = ""
token = ""
executor = "shell"
[runners.cache]
Type = "s3"
[runners.cache.s3]
ServerAddress = ""
AccessKey = ""
SecretKey = ""
BucketName = ""
Used GitLab Runner version
- v16.11.4
- v15.11.1
Possible fixes
Edited by clyfish