Skip to content

surface airgap build failures#115

Open
bennyyang11 wants to merge 4 commits into
mainfrom
bennyyang/sc-136443/wait-for-airgap-failures
Open

surface airgap build failures#115
bennyyang11 wants to merge 4 commits into
mainfrom
bennyyang/sc-136443/wait-for-airgap-failures

Conversation

@bennyyang11
Copy link
Copy Markdown
Member

Makes create-release fail the workflow when an airgap build ends in failed, failed_with_metadata, or cancelled (with the parsed error in setFailed), treats warn as a soft warning that stays green, and writes the outcome to the GitHub job summary.

@bennyyang11 bennyyang11 force-pushed the bennyyang/sc-136443/wait-for-airgap-failures branch from ff2c828 to f9253e5 Compare May 13, 2026 20:51
Comment thread src/create-release/index.ts Outdated
if (!body.releases || !Array.isArray(body.releases)) {
return null;
}
const release = body.releases.find((r: any) => r.sequence === releaseSequence);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this return the first result? last result? random?

we should probably return the latest channelSequence that matches the release sequence

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes this does just return whichever match comes first in the array. Switching it to filter + reduce so we pick the highest channel sequence instead of relying on whatever find() happens to return first.


core.setOutput("airgap-status", result.status);

if (result.status === "built") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be a case for built_metadata too? no airgap url, but it is a successful completion

Copy link
Copy Markdown
Member

@jdewinne jdewinne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also from another repo, make a github workflow that uses your modified action using your branch name bennyyang/sc-136443/wait-for-airgap-failures and add that in the description of the PR.

error: body.airgapBuildError || "",
channelSequence: channelSequence
};
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in the replicated-lib repo (if not already in it)

Comment on lines +25 to +50
export async function getAirgapStatusFromChannelReleases(api: VendorPortalApi, appId: string, channelId: string, releaseSequence: number): Promise<AirgapStatusResult | null> {
const http = await api.client();
const uri = `${api.endpoint}/app/${appId}/channel/${channelId}/releases`;
const res = await http.get(uri);
if (res.message.statusCode !== 200) {
await res.readBody();
throw new Error(`Failed to get channel releases: Server responded with ${res.message.statusCode}`);
}
const body = JSON.parse(await res.readBody());
if (!body.releases || !Array.isArray(body.releases)) {
return null;
}
// A release can be promoted to the same channel multiple times — each
// promote produces a distinct channelSequence with its own airgap build.
// We want the most recent one (highest channelSequence) since the action
// just promoted, so its airgap build is the one we should follow.
const matching = body.releases.filter((r: any) => r.sequence === releaseSequence);
if (matching.length === 0) {
return null;
}
const release = matching.reduce((latest: any, r: any) => ((r.channelSequence ?? 0) > (latest.channelSequence ?? 0) ? r : latest));
return {
status: release.airgapBuildStatus || "",
error: release.airgapBuildError || "",
channelSequence: release.channelSequence || 0
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in the replicated-lib repo (if not already in it)

Comment on lines +235 to +240
const uri = `${apiClient.endpoint}/app/${app.id}/channel/${resolvedChannel.id}/airgap/download-url?channelSequence=${result.channelSequence}`;
const res = await http.get(uri);
if (res.message.statusCode === 200) {
const body = JSON.parse(await res.readBody());
core.setOutput("airgap-url", body.url);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use replicated-lib.
Check https://github.com/replicatedhq/replicated-lib/blob/main/src/channels.ts#L128
And modify or add the lib vs doing everything within the action js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants