Skip to content

Commit b581a40

Browse files
Merge pull request #7 from WarpBuilds/feat/builder-v2
2 parents d75581d + bf68146 commit b581a40

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

.github/workflows/debug.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ env:
1212
jobs:
1313
test-multi-warp:
1414
name: Debug Run ${{ matrix.run_number }}
15-
runs-on: warpdev-ubuntu-latest-x64-2x
15+
runs-on: warpdev-ubuntu-latest-x64-8x
1616
strategy:
1717
matrix:
18-
run_number: [1]
18+
run_number: [1,2,3]
1919
fail-fast: false
2020
steps:
2121
- name: Checkout repository
@@ -30,7 +30,6 @@ jobs:
3030
push: false
3131
# platforms: linux/amd64,linux/arm64
3232
platforms: linux/amd64
33-
profile-name: test-dev,dev-eph
34-
timeout: 40000
33+
profile-name: test-dev
3534

3635

__tests__/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ RUN apt-get update && apt-get install -y \
44
curl \
55
&& rm -rf /var/lib/apt/lists/*
66

7+
8+
RUN echo "Sleeping..." && \
9+
sleep 60 && \
10+
echo "Done sleeping!"
11+
712
CMD ["python3", "--version"]

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/warpbuild.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ interface BuilderConfig {
1616

1717
interface BuilderInstance {
1818
id: string;
19+
request_id: string;
1920
arch: string;
2021
metadata: {
2122
host: string;
@@ -485,13 +486,16 @@ export class WarpBuildRemoteBuilders {
485486
public async removeBuilderInstances(): Promise<void> {
486487
for (const builderInstance of this.builderInstances) {
487488
try {
488-
const removeBuilderEndpoint = `${this.apiDomain}/api/v1/builders/${builderInstance.id}/teardown`;
489+
core.info(`Removing builder instance ${builderInstance.id} request ${builderInstance.request_id}`);
490+
const removeBuilderEndpoint = `${this.apiDomain}/api/v1/builder-session-requests/complete`;
489491
const authHeader = this.isWarpBuildRunner ? `Bearer ${process.env.WARPBUILD_RUNNER_VERIFICATION_TOKEN}` : `Bearer ${this.apiKey}`;
490492

491493
const response = await fetch(removeBuilderEndpoint, {
492-
method: 'DELETE',
493-
headers: {Authorization: authHeader}
494-
});
494+
method: 'POST',
495+
headers: {Authorization: authHeader},
496+
body: JSON.stringify({request_id: builderInstance.request_id})
497+
},
498+
);
495499

496500
if (!response.ok) {
497501
const errorData = await response.json().catch(() => ({message: 'Unknown error'}));
@@ -500,7 +504,7 @@ export class WarpBuildRemoteBuilders {
500504

501505
core.info(`Builder instance ${builderInstance.id} removed successfully`);
502506
} catch (error) {
503-
core.warning(`Failed to remove builder instance: ${error.message}`);
507+
core.warning(`Failed to remove builder request ${builderInstance.request_id}: ${error.message}`);
504508
}
505509
}
506510
}

0 commit comments

Comments
 (0)