Skip to content

Commit 9625822

Browse files
committed
infra: parallelise attestation verifies, drop fee-quoting verify
preflightVerifyImages now runs gh attestation verify concurrently via promisified execFile + Promise.all, deduping by image:tag first. Status prints in input order after all verifies settle so output ordering is preserved. For deploy-agents running all three roles this cuts preflight latency from sequential 3× to a single round-trip worth. Also drop the fee-quoting verify call: DockerImageRepos.FEE_QUOTING is not built by any workflow in this repo, so the verify always failed and trained operators to bypass the banner. Left a comment to restore verification when/if the image gets a build+sign workflow.
1 parent f92a69c commit 9625822

2 files changed

Lines changed: 27 additions & 22 deletions

File tree

typescript/infra/scripts/fee-quoting/deploy-fee-quoting.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import {
55
rootLogger,
66
} from '@hyperlane-xyz/utils';
77

8-
import { DockerImageRepos, mainnetDockerTags } from '../../config/docker.js';
98
import { FeeQuotingHelmManager } from '../../src/fee-quoting/helm.js';
10-
import { verifyImagesAndConfirm } from '../../src/utils/attestation.js';
119
import { HelmCommand } from '../../src/utils/helm.js';
1210
import {
1311
assertCorrectKubeContext,
@@ -24,13 +22,9 @@ async function main() {
2422

2523
await assertCorrectKubeContext(getEnvironmentConfig(environment));
2624

27-
await verifyImagesAndConfirm([
28-
{
29-
component: 'fee-quoting',
30-
image: DockerImageRepos.FEE_QUOTING,
31-
tag: mainnetDockerTags.feeQuoting,
32-
},
33-
]);
25+
// Note: FEE_QUOTING image is not built by a workflow in this repo and
26+
// therefore has no attestation to verify. Add attestation verify here
27+
// once the image is built + signed by CI.
3428

3529
const helmManager = new FeeQuotingHelmManager(
3630
environment,

typescript/infra/src/utils/attestation.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { confirm } from '@inquirer/prompts';
22
import chalk from 'chalk';
3-
import { execSync } from 'child_process';
3+
import { execFile } from 'child_process';
4+
import { promisify } from 'util';
5+
6+
const execFileP = promisify(execFile);
47

58
const DEFAULT_REPO = 'hyperlane-xyz/hyperlane-monorepo';
69
const YOUNG_BUILD_THRESHOLD_MS = 60 * 60 * 1000; // 1h
@@ -33,12 +36,13 @@ export async function verifyImageAttestation({
3336
}): Promise<AttestationStatus> {
3437
const ref = `oci://${image}:${tag}`;
3538
try {
36-
const raw = execSync(
37-
`gh attestation verify ${ref} --repo ${repo} --format json`,
38-
{ stdio: ['ignore', 'pipe', 'pipe'] },
39-
).toString();
39+
const { stdout } = await execFileP(
40+
'gh',
41+
['attestation', 'verify', ref, '--repo', repo, '--format', 'json'],
42+
{ maxBuffer: 10 * 1024 * 1024 },
43+
);
4044

41-
const finishedOn = extractFinishedOn(raw);
45+
const finishedOn = extractFinishedOn(stdout);
4246
if (!finishedOn) {
4347
return { verified: true };
4448
}
@@ -205,19 +209,26 @@ export async function preflightVerifyImages(refs: ImageRef[]): Promise<{
205209
allVerified: boolean;
206210
results: Array<{ ref: ImageRef; status: AttestationStatus }>;
207211
}> {
212+
const unique: ImageRef[] = [];
208213
const seen = new Set<string>();
209-
const results: Array<{ ref: ImageRef; status: AttestationStatus }> = [];
210-
let allVerified = true;
211-
212214
for (const ref of refs) {
213215
const key = `${ref.image}:${ref.tag}`;
214216
if (seen.has(key)) continue;
215217
seen.add(key);
218+
unique.push(ref);
219+
}
220+
221+
const statuses = await Promise.all(
222+
unique.map((ref) =>
223+
verifyImageAttestation({ image: ref.image, tag: ref.tag }),
224+
),
225+
);
216226

217-
const status = await verifyImageAttestation({
218-
image: ref.image,
219-
tag: ref.tag,
220-
});
227+
const results: Array<{ ref: ImageRef; status: AttestationStatus }> = [];
228+
let allVerified = true;
229+
for (let i = 0; i < unique.length; i++) {
230+
const ref = unique[i];
231+
const status = statuses[i];
221232
printAttestationStatus(ref, status);
222233
results.push({ ref, status });
223234
if (!status.verified) allVerified = false;

0 commit comments

Comments
 (0)