1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-05-07 14:09:30 +02:00

include e2e builder launch time the complete request payload (#9)

This commit is contained in:
Aayush Shah 2024-09-26 17:50:25 -04:00 committed by GitHub
parent 828fa88525
commit cb07435230
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 8 deletions

View file

@ -33,9 +33,11 @@ async function getBlacksmithHttpClient(): Promise<AxiosInstance> {
async function reportBuildCompleted() {
try {
const builderLaunchTime = stateHelper.blacksmithBuilderLaunchTime;
const client = await getBlacksmithHttpClient();
const response = await client.post(`/${stateHelper.blacksmithBuildTaskId}/complete`);
core.info(`Blacksmith builder ${stateHelper.blacksmithBuildTaskId} completed: ${JSON.stringify(response.data)}`);
client.post(`/${stateHelper.blacksmithBuildTaskId}/complete`, {
builder_launch_time: builderLaunchTime
});
} catch (error) {
core.warning('Error completing Blacksmith build:', error);
throw error;
@ -78,7 +80,6 @@ async function getRemoteBuilderAddr(inputs: context.Inputs): Promise<string | nu
payload = {dockerfile_path: dockerfilePath};
core.info(`Using dockerfile path: ${dockerfilePath}`);
}
core.info(`Anvil service: ${client.defaults.baseURL}`);
let response;
let retries = 0;
const maxRetries = 10;
@ -117,9 +118,8 @@ async function getRemoteBuilderAddr(inputs: context.Inputs): Promise<string | nu
if (ec2Instance) {
const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
core.info(`Blacksmith builder agent ready after ${elapsedTime} seconds`);
stateHelper.setBlacksmithBuilderLaunchTime(elapsedTime);
return `tcp://${ec2Instance['instance_ip']}:4242` as string;
} else {
core.info(`Waiting...`);
}
await new Promise(resolve => setTimeout(resolve, 200));
}