Skip to content

Commit f6b1301

Browse files
committed
ci: improve caching
1 parent e1e13ea commit f6b1301

3 files changed

Lines changed: 162 additions & 71 deletions

File tree

ci/scripts/create_uv_config.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#! /usr/bin/env bash
2+
# This script creates a global configuration file for Jenkins to make the UV cache metadata for longer than standard
3+
4+
set -e
5+
6+
MAX_AGE_API=6000
7+
MAX_AGE_FILES=365000000
8+
9+
GLOBAL_CONFIG_FILE=uv.toml
10+
11+
echo "# This file is auto-generated by $(basename $0)" > $GLOBAL_CONFIG_FILE
12+
13+
echo '' >> $GLOBAL_CONFIG_FILE
14+
echo '[[index]]' >> $GLOBAL_CONFIG_FILE
15+
echo "url = \"https://pypi.org/simple\"" >> $GLOBAL_CONFIG_FILE
16+
echo 'default = true' >> $GLOBAL_CONFIG_FILE
17+
echo "cache-control = { api = \"max-age=$MAX_AGE_API\", files = \"max-age=$MAX_AGE_FILES, immutable\" }" >> $GLOBAL_CONFIG_FILE
18+
19+
for arg in "$@"; do
20+
echo '' >> $GLOBAL_CONFIG_FILE
21+
echo '[[index]]' >> $GLOBAL_CONFIG_FILE
22+
echo "url = \"$arg\"" >> $GLOBAL_CONFIG_FILE
23+
echo "cache-control = { api = \"max-age=$MAX_AGE_API\", files = \"max-age=$MAX_AGE_FILES, immutable\" }" >> $GLOBAL_CONFIG_FILE
24+
done
25+
26+
echo "$(realpath $GLOBAL_CONFIG_FILE)"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
$GLOBAL_CONFIG_FILE = "uv.toml"
2+
$MAX_AGE_API="6000"
3+
$MAX_AGE_FILES="365000000"
4+
5+
$scriptName = $MyInvocation.MyCommand.Name
6+
"# This file is auto-generated by $scriptName" | Set-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
7+
8+
'' | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
9+
'[[index]]' | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
10+
"url = `"https://pypi.org/simple`"" | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
11+
'default = true' | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
12+
"cache-control = { api = `"max-age=$MAX_AGE_API`", files = `"max-age=$MAX_AGE_FILES, immutable`" }" | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
13+
14+
15+
foreach ($arg in $args) {
16+
'' | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
17+
'[[index]]' | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
18+
"url = `"$arg`"" | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
19+
'default = true' | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
20+
"cache-control = { api = `"max-age=$MAX_AGE_API`", files = `"max-age=$MAX_AGE_FILES, immutable`" }" | Add-Content -Path $GLOBAL_CONFIG_FILE -Encoding UTF8
21+
}
22+
23+
Write-Output (Get-ChildItem -Path $GLOBAL_CONFIG_FILE).FullName

0 commit comments

Comments
 (0)