Commit graph

67 commits

Author SHA1 Message Date
Luc Perkins a6e08a2a14
Remove info statement when not in GHA 2024-05-16 14:54:44 -03:00
Luc Perkins 8ad3089e93
Remove unnecessary determine func 2024-05-16 14:50:28 -03:00
Luc Perkins 41327e96b5
Address Clippy issues 2024-05-16 14:46:17 -03:00
Luc Perkins 136a3d43d6
Periodically fetch JWT only in GHA 2024-05-16 14:29:20 -03:00
Luc Perkins 90180e31ef
Add logic for determining environment 2024-05-16 13:53:46 -03:00
Cole Helbling 3d9bcd16a4 Make flakehub-flake-name truly optional 2024-05-09 14:29:14 -07:00
Graham Christensen 389a63ce68
Ignore post-build-hook errors 2024-05-06 12:00:24 -04:00
Cole Helbling 0434d467d3 Refresh GitHub Actions JWT in the background
GitHub Actions JWTs are only valid for 5 minutes after being issued.

FlakeHub uses these JWTs for authentication, which means that after
those 5 minutes have passed and the token is expired, FlakeHub (and
by extension FlakeHub Cache) will no longer allow requests using this
token.

However, GitHub gives us a way to repeatedly request new tokens, so we
utilize that and refresh the token every 2 minutes (less than half of
the lifetime of the token).
2024-04-19 08:32:45 -07:00
Eelco Dolstra fd6db08ef0
Merge pull request #52 from DeterminateSystems/build-hook-in-store
Move the post-build hook script to the Nix store
2024-04-12 10:37:39 +02:00
Luc Perkins 415818d147
Merge pull request #48 from DeterminateSystems/fix-dev-shells
Fix dev shell upload to cache
2024-04-11 23:23:35 -03:00
Graham Christensen b64bf3f4e5
Merge pull request #53 from DeterminateSystems/correlation
Use detsys_correlation if it is set
2024-04-11 22:11:18 -04:00
Graham Christensen 2d747212b0 Use detsys_correlation if it is set 2024-04-11 20:15:52 -04:00
Eelco Dolstra 4d66c1f308 Move the post-build hook script to the Nix store
In self-hosted GHA runners on NixOS, the runner has a different /tmp
than the Nix daemon, so the daemon would get "file not found" trying
to execute the post-build hook. As a workaround, move the script to
the Nix store so we can be sure that the daemon can access it.
2024-04-11 18:10:56 +02:00
Luc Perkins 974048fcd6
Fix Clippy issues 2024-03-29 17:19:44 -03:00
Eelco Dolstra 150468c70d Fix post-build hook
"exec" needs to come after the environment variables.
2024-03-27 16:32:14 +01:00
Graham Christensen fa32a1bad7 ? 2024-03-11 12:07:15 -04:00
Graham Christensen 64de95e342 0.2.0 2024-03-09 10:51:56 -05:00
Graham Christensen d0115f624f
Merge branch 'main' into flakehub-cache 2024-03-06 09:38:44 -05:00
Eelco Dolstra fbf0bbed94
Merge pull request #35 from Kiskae/pass-through-429
Pass through HTTP 429 to the nix daemon
2024-03-04 18:04:20 +01:00
Cole Helbling 619a6346c0 Merge remote-tracking branch 'origin/eelcodolstra/fh-224-magic-nix-cache-use-post-build-hook-for-the-gha-cache-as' into merge-against-upstream 2024-03-01 08:40:20 -08:00
Eelco Dolstra 9bf26f0680 Invalidate negative narinfo cache entries 2024-03-01 11:55:59 +01:00
Eelco Dolstra b53876db25 Typo 2024-02-29 22:48:51 +01:00
Eelco Dolstra e99ef6ba61 Log upload 2024-02-29 22:31:07 +01:00
Eelco Dolstra f16e3c292a Make NAR upload streaming 2024-02-29 21:22:44 +01:00
Eelco Dolstra 334bcc7df9 Compress 2024-02-29 20:45:12 +01:00
Eelco Dolstra 625e95f484 Trigger GHA cache uploads from the post-build hook
Also, a worker task now does the uploads directly rather than having
magic-nix-cache invoke "nix copy" via HTTP to itself.
2024-02-29 16:31:29 +01:00
Eelco Dolstra e5513406df Update to latest attic 2024-02-29 16:26:48 +01:00
Cole Helbling 8ce3c6cafb fixup: Cargo.toml 2024-02-27 09:57:20 -08:00
Cole Helbling 531387f66f Allow configuring the FlakeHub flake name 2024-02-27 09:47:46 -08:00
Cole Helbling bf8c52586b Merge remote-tracking branch 'upstream/main' into merge-against-upstream 2024-02-27 08:51:49 -08:00
Cole Helbling 3b8363028d just hack in an unsafe way to turn a string into a cache name without validation 2024-02-27 08:49:21 -08:00
Cole Helbling 34956e86bb checkpoint 2024-02-27 08:30:35 -08:00
Eelco Dolstra 1f46e11aa7 Cleanup 2024-02-24 10:28:18 +01:00
Eelco Dolstra b41211dc24
Apply suggestions from code review
Co-authored-by: Cole Helbling <cole.helbling@determinate.systems>
2024-02-24 10:12:54 +01:00
Eelco Dolstra 5f981d2f91 Get rid of unwraps/expects
The remaining ones should be genuine "impossible" conditions.

main() now renders the error value using anyhow.
2024-02-23 19:45:38 +01:00
Eelco Dolstra 0607f5efa4 Use reqwest::header::CONTENT_TYPE 2024-02-23 18:18:34 +01:00
Eelco Dolstra f6c21a9184 Send startup notification via HTTP 2024-02-23 15:34:22 +01:00
Ana Hobden 0e4f6af07b FlakeHub not Flakehub 2024-02-13 09:37:11 -08:00
Ana Hobden f1d5b7fdc5 Try logging into FlakeHub if nix-installer didn't do that for us 2024-02-12 14:17:20 -08:00
Eelco Dolstra 7965e647fe Fix support for multiple output derivations
OUT_PATHS is split by spaces, not newlines.
2024-02-12 15:05:59 +01:00
Eelco Dolstra de2b44169c Don't crash if the client sends an invalid store path name 2024-02-12 14:52:35 +01:00
Cole Helbling f61523931c Don't exit with an error if we can help it
Otherwise, the Nix build will fail.
2024-01-19 07:06:21 -08:00
Cole Helbling 04197c7742 Improve error handling if enqueuing paths failed 2024-01-18 14:27:58 -08:00
Cole Helbling 3cb4c6dbe0 Show full backtrace if build hook panics 2024-01-18 14:20:57 -08:00
Cole Helbling 28eca6460d Don't create the cache
attic-priv has functionality to getsert caches as they are requested.
2024-01-18 11:06:19 -08:00
Cole Helbling b08e97efea Don't rely on cache.nixos.org
Users can substitute from it the first time they encounter a path it
has, but otherwise they should re-substitute from us.
2024-01-18 07:38:51 -08:00
Eelco Dolstra ffccb9bd98 BadURL -> BadUrl 2024-01-10 23:34:15 +01:00
Eelco Dolstra 0d5e889783 Remove use of /cache/token to get a fallback cache
We rely on the GitHub token creating a project on FlakeHub as a side
effect.
2024-01-10 21:31:14 +01:00
Eelco Dolstra 0d9e0c088c Don't use /cache/token anymore except as a fallback 2024-01-10 20:48:48 +01:00
Eelco Dolstra 9781bb8b6e Improve error handling in FlakeHub cache setup
Also update the token endpoint.
2024-01-10 20:19:04 +01:00