Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ci): attest native connector fixtures before E2E

Steven Enamakel8a903f54d30e
diff --git a/.github/workflows/e2e-reusable.yml b/.github/workflows/e2e-reusable.yml
index 57624f6ab7..b12572c99f 100644
--- a/.github/workflows/e2e-reusable.yml
+++ b/.github/workflows/e2e-reusable.yml
@@ -356,8 +356,8 @@ jobs:
mkdir -p "$connectors_dir"
bash scripts/ci-cancel-aware.sh cargo build --release \
--manifest-path vendor/tinyconnectors/crates/tinyconnectors/Cargo.toml
- cp vendor/tinyconnectors/target/release/libtinyconnectors.so \
- "$connectors_dir/libtinyconnectors.so"
+ node scripts/ci/stage-connector-test-module.mjs \
+ vendor/tinyconnectors/target/release/libtinyconnectors.so "$connectors_dir"
echo "TINYCONNECTORS_TEST_MODULE=$connectors_dir/libtinyconnectors.so" \
>> "$GITHUB_ENV"
diff --git a/scripts/__tests__/connector-fixture-attestation.test.mjs b/scripts/__tests__/connector-fixture-attestation.test.mjs
index daab0d7260..c2f3a69574 100644
--- a/scripts/__tests__/connector-fixture-attestation.test.mjs
+++ b/scripts/__tests__/connector-fixture-attestation.test.mjs
@@ -1,7 +1,13 @@
import assert from "node:assert/strict";
import { spawnSync } from "node:child_process";
import { createHash } from "node:crypto";
-import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import {
+ mkdirSync,
+ mkdtempSync,
+ readFileSync,
+ rmSync,
+ writeFileSync,
+} from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import test from "node:test";
@@ -34,3 +40,60 @@ test("locally built connector fixtures carry the exact artifact digest for confi
rmSync(root, { recursive: true, force: true });
}
});
+
+test("native E2E installation attests the connector module before launching the app", () => {
+ const root = mkdtempSync(join(tmpdir(), "native-connector-fixture-"));
+ try {
+ const workflow = readFileSync(
+ new URL("../../.github/workflows/e2e-reusable.yml", import.meta.url),
+ "utf8",
+ );
+ const block = workflow.match(
+ /- name: Install native E2E test modules\n run: \|\n([\s\S]*?)(?=\n - name:)/,
+ );
+ assert.ok(block, "native module installation step exists");
+ const command = block[1]
+ .replace(/^ /gm, "")
+ .replace("/opt/openhuman-test-modules", join(root, "modules"));
+ const source = join(root, "vendor/tinyconnectors/target/release");
+ mkdirSync(source, { recursive: true });
+ const bytes = "pinned native connector module";
+ writeFileSync(join(source, "libtinyconnectors.so"), bytes);
+ mkdirSync(join(root, "scripts/ci"), { recursive: true });
+ writeFileSync(
+ join(root, "scripts/ci/stage-connector-test-module.mjs"),
+ readFileSync(stage),
+ );
+ writeFileSync(
+ join(root, "scripts/ci-cancel-aware.sh"),
+ 'test "$1" = cargo && test "$2" = build && test "$3" = --release\n',
+ );
+ const envFile = join(root, "env");
+ const result = spawnSync("bash", ["-c", command], {
+ cwd: root,
+ encoding: "utf8",
+ env: {
+ ...process.env,
+ GITHUB_RUN_ID: "fixture",
+ GITHUB_RUN_ATTEMPT: "1",
+ GITHUB_ENV: envFile,
+ },
+ });
+ assert.equal(result.status, 0, result.stdout + result.stderr);
+ const destination = join(root, "modules/fixture-1/tinyconnectors");
+ assert.equal(
+ readFileSync(join(destination, "libtinyconnectors.so"), "utf8"),
+ bytes,
+ );
+ assert.equal(
+ readFileSync(join(destination, "modules.toml"), "utf8"),
+ `"libtinyconnectors.so" = "${createHash("sha256").update(bytes).digest("hex")}"\n`,
+ );
+ assert.equal(
+ readFileSync(envFile, "utf8").trim(),
+ `TINYCONNECTORS_TEST_MODULE=${destination}/libtinyconnectors.so`,
+ );
+ } finally {
+ rmSync(root, { recursive: true, force: true });
+ }
+});