Skip to content

Commit a4d11a1

Browse files
committed
feat: Add historic release caching and archival system
Implement caching and archival system for historic Garden Linux releases to improve dashboard performance and enable offline viewing of past releases. Features: - Historic release data collector script with pagination support (up to 200 pages) - Local filesystem caching for API responses and collected GL day data - Dashboard integration with automatic cache loading and force bypass option - GitHub Actions workflow for nightly automated archival - Minimum GL version enforcement (GL 1825) due to workflow structure changes Performance: - Reduced API calls through intelligent caching - Faster dashboard loading for historic releases - Smart date-based pagination stopping Breaking Changes: - Minimum supported GL version is now 1825 Signed-off-by: Eike Waldt <waldt@b1-systems.de> On-behalf-of: SAP <eike.waldt@sap.com>
1 parent 68df09b commit a4d11a1

12 files changed

Lines changed: 2454 additions & 196 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Archive Historic Releases
2+
3+
on:
4+
schedule:
5+
# Run nightly at 2 AM UTC
6+
- cron: "0 2 * * *"
7+
workflow_dispatch: # Allow manual triggering
8+
9+
jobs:
10+
archive:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: "20"
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Collect historic release data
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
node scripts/collect-historic.js --days 14 --start-from-yesterday
34+
35+
- name: Checkout historic-releases branch
36+
run: |
37+
git fetch origin
38+
git checkout -B historic-releases origin/historic-releases || git checkout -b historic-releases
39+
40+
- name: Commit and push historic data
41+
run: |
42+
git config user.email "release_historian@gardenlinux.io"
43+
git config user.name "release_historian"
44+
45+
if [ -n "$(git status --porcelain historic/)" ]; then
46+
git add historic/
47+
git commit -m "Archive historic release data for last 14 days (starting from yesterday)"
48+
git push origin historic-releases
49+
else
50+
echo "No changes to commit"
51+
fi

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
_site
2+
.cache
23
.venv
34
shell.nix
45
vendor
@@ -15,3 +16,6 @@ dist/
1516

1617
# packages are in packages branch
1718
packages/
19+
20+
# historic releases are in historic-releases branch
21+
historic/

index.html

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ <h3>Historic Releases Settings</h3>
108108
type="number"
109109
id="historic-count-input"
110110
min="1"
111-
max="100"
111+
max="2000"
112112
step="1"
113113
value="14"
114114
onchange="updateHistoricCount()"
@@ -138,6 +138,27 @@ <h3>Historic Releases Settings</h3>
138138

139139
<hr class="settings-separator" />
140140

141+
<h3>Cache Settings</h3>
142+
<div class="branch-settings">
143+
<div class="branch-toggle-group">
144+
<label for="force-cache" class="branch-toggle-label">
145+
<input
146+
type="checkbox"
147+
id="force-cache"
148+
onchange="toggleForceCache()"
149+
/>
150+
Disable historic cache (force live GitHub API)
151+
</label>
152+
<small class="branch-help">
153+
When enabled, the dashboard ignores cached historic
154+
data and always fetches it directly from GitHub.
155+
This can be slower and may hit API rate limits.
156+
</small>
157+
</div>
158+
</div>
159+
160+
<hr class="settings-separator" />
161+
141162
<h3>Workflow Branch Settings</h3>
142163
<div class="branch-settings">
143164
<div class="branch-toggle-group">

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
"type": "module",
66
"main": "dist/dashboard.js",
77
"scripts": {
8-
"packages": "git fetch origin && git checkout origin/packages packages",
8+
"packages": "git fetch origin && git checkout origin/packages packages && git restore --staged packages",
9+
"historic": "git fetch origin && git checkout origin/historic-releases historic && git restore --staged historic",
10+
"historic:collect": "node scripts/collect-historic.js --days 14",
911
"build": "rollup -c",
1012
"dev": "rollup -c -w",
11-
"serve": "npm run packages && python3 -m http.server 8000",
13+
"serve": "npm run packages && npm run historic && python3 -m http.server 8000",
1214
"start": "npm run build && npm run serve",
1315
"lint": "npm run lint:js; npm run lint:format",
1416
"lint:js": "eslint src/**/*.js",

0 commit comments

Comments
 (0)