1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00

track quota errors in deployment

This commit is contained in:
Martin McKeaveney 2020-11-12 12:58:05 +00:00
parent dee8af1332
commit 4e54f6d0d1
3 changed files with 18 additions and 12 deletions

View file

@ -7,6 +7,12 @@
import { notifier } from "builderStore/store/notifications"
import CreateWebhookDeploymentModal from "./CreateWebhookDeploymentModal.svelte"
const DeploymentStatus = {
SUCCESS: "SUCCESS",
PENDING: "PENDING",
FAILURE: "FAILURE",
}
const DATE_OPTIONS = {
fullDate: {
weekday: "long",
@ -56,7 +62,7 @@
<header>
<h4>Deployment History</h4>
<div class="deploy-div">
{#if deployments.some(deployment => deployment.status === 'SUCCESS')}
{#if deployments.some(deployment => deployment.status === DeploymentStatus.SUCCESS)}
<a target="_blank" href={`https://${appId}.app.budi.live/${appId}`}>
View Your Deployed App →
</a>
@ -82,6 +88,9 @@
<div class={`deployment-status ${deployment.status}`}>
{deployment.status}
</div>
{#if deployment.status === DeploymentStatus.FAILURE}
<span>{deployment.err}</span>
{/if}
</div>
</article>
{/each}

View file

@ -55,17 +55,17 @@ exports.verifyDeployment = async function({ appId, quota }) {
}),
})
const json = await response.json()
if (json.errors) {
throw new Error(json.errors)
}
if (response.status !== 200) {
throw new Error(
`Error fetching temporary credentials for api key: ${env.BUDIBASE_API_KEY}`
)
}
const json = await response.json()
if (json.errors) {
throw new Error(json.errors)
}
// set credentials here, means any time we're verified we're ready to go
if (json.credentials) {
AWS.config.update({

View file

@ -21,18 +21,15 @@ const DeploymentStatus = {
// checks that deployments are in a good state, any pending will be updated
async function checkAllDeployments(deployments) {
let updated = false
function update(deployment, status) {
deployment.status = status
updated = true
}
for (let deployment of Object.values(deployments.history)) {
// check that no deployments have crashed etc and are now stuck
if (
deployment.status === DeploymentStatus.PENDING &&
Date.now() - deployment.updatedAt > MAX_PENDING_TIME_MS
) {
update(deployment, DeploymentStatus.FAILURE)
deployment.status = status
deployment.err = "Timed out"
updated = true
}
}
return { updated, deployments }