|
|
|
|
@ -52,6 +52,11 @@ async function getBlacksmithHttpClient(): Promise<AxiosInstance> {
|
|
|
|
|
|
|
|
|
|
// Reports a successful build to the local sticky disk manager
|
|
|
|
|
async function reportBuildCompleted() {
|
|
|
|
|
if (!stateHelper.blacksmithDockerBuildId) {
|
|
|
|
|
core.warning('No docker build ID found, skipping build completion report');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const client = await getBlacksmithHttpClient();
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
@ -80,6 +85,11 @@ async function reportBuildCompleted() {
|
|
|
|
|
|
|
|
|
|
// Reports a failed build to both the local sticky disk manager and the Blacksmith API
|
|
|
|
|
async function reportBuildFailed() {
|
|
|
|
|
if (!stateHelper.blacksmithDockerBuildId) {
|
|
|
|
|
core.warning('No docker build ID found, skipping build completion report');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const client = await getBlacksmithHttpClient();
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
@ -300,6 +310,7 @@ async function getNumCPUs(): Promise<number> {
|
|
|
|
|
|
|
|
|
|
// reportBuild reports the build to the Blacksmith API and returns the build ID
|
|
|
|
|
async function reportBuild(dockerfilePath: string) {
|
|
|
|
|
try {
|
|
|
|
|
const client = await getBlacksmithAPIClient();
|
|
|
|
|
const requestOptions = {
|
|
|
|
|
dockerfile_path: dockerfilePath,
|
|
|
|
|
@ -316,6 +327,10 @@ async function reportBuild(dockerfilePath: string) {
|
|
|
|
|
const response = await postWithRetryToBlacksmithAPI(client, '/stickydisks/dockerbuilds', requestOptions, retryCondition);
|
|
|
|
|
stateHelper.setBlacksmithDockerBuildId(response.data.docker_build_id);
|
|
|
|
|
return response.data;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
core.warning('Error reporting build to Blacksmith API:', error);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function reportBuilderCreationFailed(stickydiskKey: string) {
|
|
|
|
|
|