fix: wait for QuickStack deployment visibility
vadimenovikau/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (push) Successful in 30s
Platform CI tests / QuickStack deploy action tests (pull_request) Successful in 22s
vadimenovikau/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (pull_request) Successful in 21s
vadimenovikau/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (push) Successful in 30s
Platform CI tests / QuickStack deploy action tests (pull_request) Successful in 22s
vadimenovikau/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (pull_request) Successful in 21s
This commit is contained in:
@@ -101,7 +101,10 @@ export function createQuickStackClient({ baseUrl, token, fetchImpl = fetch }) {
|
||||
});
|
||||
const parsed = await readBody(response);
|
||||
if (!response.ok) {
|
||||
throw new Error(`${method} ${pathname} failed with HTTP ${response.status}: ${parsed?.detail ?? response.statusText}`);
|
||||
throw Object.assign(
|
||||
new Error(`${method} ${pathname} failed with HTTP ${response.status}: ${parsed?.detail ?? response.statusText}`),
|
||||
{ statusCode: response.status },
|
||||
);
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
@@ -118,7 +121,17 @@ export function createQuickStackClient({ baseUrl, token, fetchImpl = fetch }) {
|
||||
|
||||
async function waitForDeployment(client, appId, deploymentId, sleep) {
|
||||
for (let attempt = 1; attempt <= 180; attempt += 1) {
|
||||
const deployment = await client.getDeployment(appId, deploymentId);
|
||||
let deployment;
|
||||
try {
|
||||
deployment = await client.getDeployment(appId, deploymentId);
|
||||
} catch (error) {
|
||||
if (error?.statusCode === 404) {
|
||||
console.log(`QuickStack deployment ${deploymentId}: NOT_VISIBLE_YET (${attempt}/180)`);
|
||||
await sleep(5_000);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
const status = String(deployment?.status ?? "UNKNOWN").toUpperCase();
|
||||
console.log(`QuickStack deployment ${deploymentId}: ${status} (${attempt}/180)`);
|
||||
if (SUCCESS.has(status)) return deployment;
|
||||
|
||||
Reference in New Issue
Block a user