Commit 5b14f2f
committed
feat: pre-cache GitHub Actions and tools to eliminate download delays
Add comprehensive caching to runner image for both actions and runtime tools,
eliminating download timeouts and speeding up workflow execution.
## Action Archive Cache
Pre-cache commonly used GitHub Actions in /home/runner/action-archive-cache/
**How it works:**
- Runner checks ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE before downloading
- Format: {owner}_{repo}/{SHA}.tar.gz
- If found: unpacks cached tar.gz (instant)
- If not found: downloads from GitHub API (slow, can timeout)
**Actions cached (18 versions):**
- docker/build-push-action: v5, v6
- docker/login-action: v2, v3
- docker/metadata-action: v4, v5
- actions/checkout: v3, v4
- actions/setup-java: v3, v4
- actions/upload-artifact: v3, v4
- actions/download-artifact: v3, v4
- dorny/paths-filter: v2, v3
## Tool Cache
Pre-install runtime tools in /opt/hostedtoolcache/
**How it works:**
- setup-* actions check RUNNER_TOOL_CACHE for pre-installed tools
- Format: /opt/hostedtoolcache/{tool}/{version}/{arch}/.complete
- If found: use immediately (instant)
- If not found: download and install (200-500 MB, 2-5 min per tool)
**Tools cached:**
- Java: 8.0.442, 17.0.13 (Temurin distribution)
- Python: 3.9, 3.10, 3.11
- Node.js: 20.x LTS
## Benefits
**Speed:**
- Action downloads: 10-30 sec saved per workflow
- Tool setup: 2-5 min saved per tool (first use)
- Eliminates 100-second timeout errors
**Reliability:**
- Works offline or with network issues
- No dependency on GitHub API availability
**Flexibility:**
- Multiple versions supported (v3-v6)
- Compatible across different workflows
## Implementation
**Files:**
- cache_github_actions.sh: Clones and packages actions
- cache_tools.sh: Runs setup-* actions to install tools
- Dockerfile: Sets env vars, runs cache scripts
**Environment variables:**
- ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE=/home/runner/action-archive-cache
- AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
**Size impact:**
- Action cache: ~200-500 MB
- Tool cache: ~1-1.5 GB
- Total: ~1.5-2 GB (acceptable for self-hosted runners)
**Usage:**
Completely automatic - workflows transparently use cached content
without any modifications required.1 parent 487b494 commit 5b14f2f
3 files changed
+172
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
22 | 35 | | |
23 | 36 | | |
24 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
0 commit comments