Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: increase timeout to the same as build-push-action #11

Merged
merged 1 commit into from
Feb 10, 2025
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
10 changes: 7 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/post/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 27 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@actions/core": "^1.10.1",
"@buf/blacksmith_vm-agent.connectrpc_es": "^1.6.1-20241220192643-e85a9caa965d.2",
"@buf/blacksmith_vm-agent.connectrpc_es": "^1.6.1-20250209182455-7d83cfb8ddb1.2",
"@bufbuild/connect": "^0.13.0",
"@bufbuild/connect-web": "^0.13.0",
"@bufbuild/protobuf": "^1.4.2",
Expand Down
11 changes: 8 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import { createStickyDiskClient } from './utils';

const execAsync = promisify(exec);

// stickyDiskTimeoutMs states the max amount of time this action will wait for the VM agent to
// expose the sticky disk from the storage agent, map it onto the host and then patch the drive
// into the VM.
const stickyDiskTimeoutMs = 45000;

async function getStickyDisk(stickyDiskKey: string, options?: {signal?: AbortSignal}): Promise<{expose_id: string; device: string}> {
const client = createStickyDiskClient();

Expand Down Expand Up @@ -64,14 +69,14 @@ async function maybeFormatBlockDevice(device: string): Promise<string> {
return device;
} catch (error) {
if (error instanceof Error) {
core.error(`Failed to format device ${device}: ${error}`);
core.warning(`Failed to format device ${device}: ${error}`);
}
throw error;
}
}

async function mountStickyDisk(stickyDiskKey: string, stickyDiskPath: string, signal: AbortSignal, controller: AbortController): Promise<{device: string, exposeId: string}> {
const timeoutId = setTimeout(() => controller.abort(), 15000);
const timeoutId = setTimeout(() => controller.abort(), stickyDiskTimeoutMs);
const stickyDiskResponse = await getStickyDisk(stickyDiskKey, {signal});
const device = stickyDiskResponse.device;
const exposeId = stickyDiskResponse.expose_id;
Expand Down Expand Up @@ -126,7 +131,7 @@ async function run(): Promise<void> {
}

if (stickyDiskError) {
core.setFailed(`Error getting sticky disk: ${stickyDiskError}`);
core.warning(`Error getting sticky disk: ${stickyDiskError}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async function run(): Promise<void> {
}
} catch (error) {
if (error instanceof Error) {
core.error(`Failed to cleanup and commit sticky disk at ${stickyDiskPath}: ${error}`);
core.warning(`Failed to cleanup and commit sticky disk at ${stickyDiskPath}: ${error}`);
}
}
}
Expand Down
Loading