Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.12
- name: Rebuild packaged binaries
env:
VERSION: v0.3.0
VERSION: v0.3.1
run: scripts/build-dist.sh
- name: Verify packaged binaries are reproducible
run: git diff --exit-code -- dist
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Do not enable Bazel remote-cache compression with this release.
| `max-blob-size-mb` | `512` | Maximum spooled upload/download size |
| `max-concurrent-operations` | `4` | Backend-operation backpressure |
| `max-uploads-per-minute` | `180` | Evenly spaced uploads; must be below 200 |
| `backend-timeout-seconds` | `300` | Per-operation timeout |
| `backend-timeout-seconds` | `300` | Timeout for one GitHub cache operation and initial packed-manifest discovery |
| `port` | `0` | Loopback port; zero chooses a free dynamic port |

The main step outputs `url`, `stats-url`, `writable`, `bazel-args`, and
Expand Down Expand Up @@ -246,7 +246,7 @@ go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./...
go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 ./...
node --test action/*.test.js
VERSION=v0.3.0 scripts/build-dist.sh
VERSION=v0.3.1 scripts/build-dist.sh
git diff --exit-code -- dist
(cd dist && sha256sum --check SHA256SUMS)
```
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ inputs:
required: false
default: "180"
backend-timeout-seconds:
description: "Timeout for one GitHub cache load or save"
description: "Timeout for one GitHub cache operation and initial packed-manifest discovery"
required: false
default: "300"
port:
Expand Down
22 changes: 17 additions & 5 deletions action/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ const {

const sleep = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));

function startupTimeoutMilliseconds(storageMode, backendTimeoutSeconds) {
// Packed mode restores every discoverable manifest before accepting Bazel
// requests. Its server-side discovery already has this deadline, so the
// wrapper must not report a false startup failure after a fixed 15 seconds.
return (storageMode === "packs" ? backendTimeoutSeconds : 15) * 1000;
}

function positiveInteger(name, fallback, maximum = Number.MAX_SAFE_INTEGER) {
const value = Number.parseInt(input(name, String(fallback)), 10);
if (!Number.isSafeInteger(value) || value <= 0 || value > maximum) {
Expand Down Expand Up @@ -125,8 +132,9 @@ async function main() {
fs.closeSync(logDescriptor);
child.unref();

const readyDeadline = Date.now() + startupTimeoutMilliseconds(storageMode, backendTimeoutSeconds);
let ready;
for (let attempt = 0; attempt < 150; attempt += 1) {
while (Date.now() < readyDeadline) {
if (fs.existsSync(readyFile)) {
ready = JSON.parse(fs.readFileSync(readyFile, "utf8"));
break;
Expand Down Expand Up @@ -163,7 +171,11 @@ async function main() {
);
}

main().catch((error) => {
process.stderr.write(`::error::${String(error.message).replaceAll("\r", "").replaceAll("\n", "%0A")}\n`);
process.exitCode = 1;
});
if (require.main === module) {
main().catch((error) => {
process.stderr.write(`::error::${String(error.message).replaceAll("\r", "").replaceAll("\n", "%0A")}\n`);
process.exitCode = 1;
});
}

module.exports = { startupTimeoutMilliseconds };
14 changes: 14 additions & 0 deletions action/main.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";

const test = require("node:test");
const assert = require("node:assert/strict");

const { startupTimeoutMilliseconds } = require("./main");

test("packed startup waits for its configured manifest-discovery deadline", () => {
assert.equal(startupTimeoutMilliseconds("packs", 300), 300_000);
});

test("object startup retains the short local-server readiness deadline", () => {
assert.equal(startupTimeoutMilliseconds("objects", 300), 15_000);
});
4 changes: 2 additions & 2 deletions dist/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
100dfdbf3729558bd6953d0e836f6d22a6d7f4e53e67bae289008de2e971e96b cache-server-linux-amd64
5de1b5db9ffa1350bdda5ef1affcabad59be3527df3b7a2abd332d3a6c3e2bcd cache-server-linux-arm64
9b7e9b76bfa605420a0c5498ff6b40864ecaffef3d2ef16203502a1786cf7e93 cache-server-linux-amd64
08d858dfb6c528c79667c06d14d35575b9f32d05720656f4c13b6f1f39de4f91 cache-server-linux-arm64
Binary file modified dist/cache-server-linux-amd64
Binary file not shown.
Binary file modified dist/cache-server-linux-arm64
Binary file not shown.
Loading