Skip to content

Commit 58a9e2b

Browse files
nuclearcatgctucker
authored andcommitted
staging.kernelci.org: Add --no-cache to docker builds once per week
To have compiler images up to date we need to build docker images at least once per week without cache. We cannot set --no-cache permanently as it will increase build time significantly (about 2 hours) and staging run several times per day. Signed-off-by: Denys Fedoryshchenko <[email protected]>
1 parent 2cae8d9 commit 58a9e2b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

staging.kernelci.org

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,25 @@ cmd_docker() {
173173

174174
# Build the images with kci_docker
175175
cd checkout/kernelci-core/config/docker
176+
177+
# Build without cache if flag file doesn't exist or older than x days
178+
purge_flag_file=".last_docker_purge"
179+
if [ -f "$purge_flag_file" ]; then
180+
flag_time=$(date -r "$purge_flag_file" +%s)
181+
week_ago=$(date -d 'now - 7 days' +%s)
182+
fi
183+
if [ ! -f "$purge_flag_file" ] || (( flag_time <= week_ago )); then
184+
echo "Building without cache"
185+
cache_arg="--no-cache"
186+
touch "$purge_flag_file"
187+
else
188+
cache_arg=""
189+
fi
190+
176191
core_rev=$(git show --pretty=format:%H -s origin/staging.kernelci.org)
177192
rev_arg="--build-arg core_rev=$core_rev"
178193
px_arg='--prefix=kernelci/staging-'
179-
args="build --push $px_arg $rev_arg"
194+
args="build --push $px_arg $cache_arg $rev_arg"
180195

181196
# KernelCI tools
182197
./kci_docker $args kernelci

0 commit comments

Comments
 (0)