You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge remote-tracking branch 'upstream/dev' into dev
* upstream/dev:
chore(release): v7.0.1
fix: execute delete query for pruning uploads (#123)
docs: use correct env var name for cache cleanup (#125)
ci(release): push also tag `dev`
chore(release): v7.0.0
docs: add `zstd` info
feat: proxy unknown requests to default GitHub `ACTIONS_RESULTS_URL` & revive v1 support
build(docker): use cluster size of 1 by default
chore(helm): add proxy port 8000
feat!: drop cache service v1 support
fix(proxy): disable passthrough websockets
feat(proxy): enable http2
feat(proxy): only tls intercept required hostname
feat: enable nitro `node-cluster` preset
feat: enable proxy debug logs if debug enabled
test: add random path prefix to `ACTIONS_CACHE_URL`
chore(release): v6.0.1
fix: handle random path prefix for cache service v1 routes
chore(release): v6.0.0
feat!: binary patching alternative (#112)
The number of days to keep stale cache data and metadata before deleting it. Set to `0` to disable cache cleanup.
68
66
67
+
#### `CACHE_CLEANUP_CRON`
68
+
69
+
- Default: `0 0 * * *`
70
+
71
+
The cron schedule for running the cache cleanup job.
72
+
73
+
#### `UPLOAD_CLEANUP_CRON`
74
+
75
+
- Default: `*/10 * * * *`
76
+
77
+
The cron schedule for running the upload cleanup job. This job will delete any dangling (failed or incomplete) uploads.
78
+
79
+
69
80
#### `NITRO_PORT`
70
81
71
82
- Default: `3000`
72
83
73
84
The port the server should listen on.
74
85
75
-
## 2. Setup with Self-Hosted Runners
86
+
#### `TEMP_DIR`
76
87
77
-
To leverage the GitHub Actions Cache Server with your self-hosted runners, you'll need to configure a couple of environment variables on your runners. This ensures that your runners can authenticate with and utilize the cache server effectively.
88
+
- Default: os temp dir
78
89
79
-
### Configuring Environment Variables on Self-Hosted Runners
90
+
The directory to use for temporary files.
80
91
81
-
**`ACTIONS_RESULTS_URL`**: This tells your self-hosted runner where to send cache requests. Set this environment variable to the `API_BASE_URL` of your cache server, making sure to include a trailing slash.
92
+
## 2. Setup with Self-Hosted Runners
82
93
83
-
For example, if your cache server's `API_BASE_URL` is `http://localhost:3000`, you would set `ACTIONS_RESULTS_URL` to `http://localhost:3000/`.
94
+
Set the `ACTIONS_RESULTS_URL` on your runner to the API URL (with a trailing slash).
84
95
85
96
::u-alert
86
97
---
87
98
icon: 'tabler:alert-triangle'
88
99
class: ring-amber-400
89
100
color: amber
90
-
description: Make sure to add a trailing slash to the ACTIONS_RESULTS_URL environment variable.
101
+
description: Ensure ACTIONS_RESULTS_URL ends with a trailing slash.
91
102
variant: subtle
92
103
---
93
104
::
94
105
95
-
### Getting the Actions Runner to Use the Cache Server
96
-
97
-
The default self-hosted runner overwrites the `ACTIONS_RESULTS_URL` environment variable with the GitHub-hosted cache server URL. To get the runner to use your self-hosted cache server, you'll need to modify the runner binary:
98
-
99
-
#### Docker
106
+
### Runner Configuration
100
107
101
-
Just add the following lines to your Dockerfile:
108
+
For Docker:
102
109
103
110
```dockerfile [Dockerfile]
104
111
FROM ghcr.io/actions/actions-runner:latest
105
-
106
-
# modify actions runner binaries to allow custom cache server implementation
112
+
# Modify runner binary to retain custom ACTIONS_RESULTS_URL
107
113
RUN sed -i 's/\x41\x00\x43\x00\x54\x00\x49\x00\x4F\x00\x4E\x00\x53\x00\x5F\x00\x52\x00\x45\x00\x53\x00\x55\x00\x4C\x00\x54\x00\x53\x00\x5F\x00\x55\x00\x52\x00\x4C\x00/\x41\x00\x43\x00\x54\x00\x49\x00\x4F\x00\x4E\x00\x53\x00\x5F\x00\x52\x00\x45\x00\x53\x00\x55\x00\x4C\x00\x54\x00\x53\x00\x5F\x00\x4F\x00\x52\x00\x4C\x00/g' /home/runner/bin/Runner.Worker.dll
This will replace the strings `ACTIONS_RESULTS_URL` with `ACTIONS_RESULTS_ORL` in the runner binary. This will prevent the runner from overwriting the `ACTIONS_RESULTS_URL` environment variable and allow it to use your self-hosted cache server.
134
+
This patch prevents the runner from overwriting your custom `ACTIONS_RESULTS_URL`.
129
135
130
-
Doing it this way is a bit of a hack, but it's easier than compiling your own runner binary from source and works great.
136
+
::u-alert
137
+
---
138
+
icon: 'tabler:info-circle'
139
+
class: ring-blue-400
140
+
color: blue
141
+
description: It is recommended to install zstd on your runners for faster compression and decompression.
Copy file name to clipboardExpand all lines: docs/content/1.getting-started/4.how-it-works.md
+5-15Lines changed: 5 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,15 @@
1
1
---
2
2
title: How it works
3
-
description: Learn how we built the GitHub Actions Cache Server and how it works without any workflow file changes
3
+
description: How the cache server integrates with GitHub Actions
4
4
---
5
5
6
-
## 1. Reverse-Engineering the cache server
6
+
## 1. Reverse-Engineering
7
7
8
-
This is actually a pretty simple process. We just need to look at the requests that the GitHub Actions runner makes to the cache server and then replicate the api routes. We can use the source code of the official `actions/cache` action to see how the requests are made.
8
+
We replicate the official cache API by examining runner requests and the actions/cache source. See GitHub docs on cache keys.
9
9
10
-
GitHub also has very good [documentation](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key) on how the cache keys are matched.
10
+
## 2. Configuring the Runner
11
11
12
-
## 2. Getting the actions runner to use our cache server
13
-
14
-
The whole idea of creating a self-hosted cache server originated from the discovery that the official `actions/cache` action uses an environment variable `ACTIONS_RESULTS_URL` to determine where to send cache requests. This means that we can simply set this environment variable to the base URL of our cache server and the runner will start using it ...right?
15
-
16
-
Well, not exactly. The `actions/cache` action uses the `ACTIONS_RESULTS_URL` environment variable to determine the base URL of the cache server but we cannot overrid this environment variable in any way.
17
-
18
-
The default actions runner always overrides the `ACTIONS_RESULTS_URL` environment variable with an internal URL that points to the official GitHub cache server. This is the code that does it:
12
+
The runner overrides ACTIONS_RESULTS_URL with its internal endpoint. We patched the binary by replacing "ACTIONS_RESULTS_URL" with "ACTIONS_RESULTS_ORL" (keeping the same length) to allow a custom cache URL.
The line `Environment["ACTIONS_RESULTS_URL"] = resultsUrl;` is the one that overrides the `ACTIONS_RESULTS_URL` environment variable with the internal URL.
49
-
50
-
To allow overriding the `ACTIONS_RESULTS_URL` environment variable, we need to modify the runner binary. This is a bit tricky because the runner is a compiled binary and we cannot simply modify the source code and recompile it. We need to modify the binary itself. So we did just that. We replaced the string `ACTIONS_RESULTS_URL` with `ACTIONS_RESULTS_ORL` (being careful to keep the same length) in the runner binary. This way, the runner will not override the `ACTIONS_RESULTS_URL` environment variable and we can set it to our cache server's base URL.
0 commit comments