github.com/jfrog/jfrog-cli-platform-services@v1.2.0/commands/templates/AFTER_BUILD_INFO_SAVE.ts_template (about) 1 import { PlatformContext, AfterBuildInfoSaveRequest, AfterBuildInfoSaveResponse, Status } from 'jfrog-workers'; 2 3 export default async (context: PlatformContext, data: AfterBuildInfoSaveRequest): Promise<AfterBuildInfoSaveResponse> => { 4 try { 5 // The HTTP client facilitates calls to the JFrog Platform REST APIs 6 //To call an external endpoint, use 'await context.clients.axios.get("https://foo.com")' 7 const res = await context.clients.platformHttp.get("/artifactory/api/v1/system/readiness"); 8 9 // You should reach this part if the HTTP request status is successful (HTTP Status 399 or lower) 10 if (res.status === 200) { 11 console.log("Artifactory ping success"); 12 } else { 13 console.warn(`Request was successful and returned status code : ${res.status}`); 14 } 15 } catch (error) { 16 // The platformHttp client throws PlatformHttpClientError if the HTTP request status is 400 or higher 17 console.error(`Request failed with status code ${error.status || "<none>"} caused by : ${error.message}`); 18 } 19 20 return { 21 message: "proceed", 22 executionStatus: Status.STATUS_SUCCESS, 23 }; 24 };