ci: Set file mtimes from git log
All checks were successful
infra/kickstart/pipeline/head This commit looks good
All checks were successful
infra/kickstart/pipeline/head This commit looks good
Every time the job runs, the _Publish_ stage changes the timestamps of the files on the server, even if their contents haven't changed. This is because each build runs from a fresh checkout, so every file appears to have just been created. To avoid this, and leave files on the server alone unless they've changed, we now set the modification timestamp of every file from its last commit.
This commit is contained in:
@@ -3,5 +3,6 @@
|
||||
- *.j2
|
||||
- .gitignore
|
||||
- Makefile
|
||||
- fixtimes.sh
|
||||
- publish.sh
|
||||
- render.py
|
||||
|
||||
1
ci/Jenkinsfile
vendored
1
ci/Jenkinsfile
vendored
@@ -10,6 +10,7 @@ pipeline {
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh './fixtimes.sh'
|
||||
sh 'make'
|
||||
}
|
||||
}
|
||||
|
||||
8
fixtimes.sh
Executable file
8
fixtimes.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
git ls-files | while IFS= read -r file; do
|
||||
ts=$(git log -1 --format=%at -- "${file}")
|
||||
if [ -n "${ts}" ]; then
|
||||
touch -d "@${ts}" -- "${file}"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user