Skip to content

Commit f677f2a

Browse files
committed
invalid yaml error message
1 parent ab4ce2d commit f677f2a

File tree

6 files changed

+106
-19
lines changed

6 files changed

+106
-19
lines changed

src/routes/team/[team]/+page.gql

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ query TeamOverview($team: Slug!) @cache(policy: NetworkOnly) {
2525
... on WorkloadStatusSynchronizationFailing {
2626
detail
2727
}
28+
... on WorkloadStatusInvalidNaisYaml {
29+
detail
30+
}
2831
}
2932
}
3033
}

src/routes/team/[team]/+page.svelte

+27-17
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,10 @@
1414
let { data }: PageProps = $props();
1515
let { TeamOverview, teamSlug, viewerIsMember } = $derived(data);
1616
17-
const deprecatedImages = $derived(
17+
const getErrors = (errorType: string) =>
1818
$TeamOverview.data?.team.workloads.nodes.filter((workload) =>
19-
workload.status.errors.some(
20-
(error) => error.__typename === 'WorkloadStatusDeprecatedRegistry'
21-
)
22-
)
23-
);
24-
25-
const syncFailed = $derived(
26-
$TeamOverview.data?.team.workloads.nodes.filter((workload) =>
27-
workload.status.errors.some(
28-
(error) => error.__typename === 'WorkloadStatusSynchronizationFailing'
29-
)
30-
)
31-
);
19+
workload.status.errors.some((error) => error.__typename === errorType)
20+
);
3221
</script>
3322

3423
{#if page.url.searchParams.has('deleted')}
@@ -39,10 +28,30 @@
3928
</Alert>
4029
{/if}
4130
<div class="alerts-wrapper">
42-
{#if syncFailed?.length}
31+
{#if getErrors('WorkloadStatusInvalidNaisYaml')}
32+
{@const invalidYaml = getErrors('WorkloadStatusInvalidNaisYaml')!}
33+
<Alert variant="error">
34+
<div style="display: flex; flex-direction: column; gap: var(--a-spacing-3)">
35+
<Heading level="2" size="small">Rollout Failed - Invalid Manifest</Heading>
36+
<BodyShort>
37+
The rollout of the following workload{invalidYaml.length === 1 ? '' : 's'} failed because of
38+
{invalidYaml.length === 1 ? 'an' : ''}
39+
invalid manifest{invalidYaml.length === 1 ? '' : 's'}.
40+
</BodyShort>
41+
<div>
42+
{#each invalidYaml as workload (workload.id)}
43+
<WorkloadLink {workload} hideTeam />
44+
{/each}
45+
</div>
46+
</div>
47+
</Alert>
48+
{/if}
49+
50+
{#if getErrors('WorkloadStatusSynchronizationFailing')}
51+
{@const syncFailed = getErrors('WorkloadStatusSynchronizationFailing')!}
4352
<Alert variant="error">
4453
<div style="display: flex; flex-direction: column; gap: var(--a-spacing-3)">
45-
<Heading level="2" size="small">Synchronization failing</Heading>
54+
<Heading level="2" size="small">Rollout Failed - Synchronization Error</Heading>
4655
<BodyShort>
4756
The rollout of the following workload{syncFailed.length === 1 ? '' : 's'} failed because of
4857
synchronization errors.
@@ -56,7 +65,8 @@
5665
</Alert>
5766
{/if}
5867

59-
{#if deprecatedImages?.length}
68+
{#if getErrors('WorkloadStatusDeprecatedRegistry')}
69+
{@const deprecatedImages = getErrors('WorkloadStatusDeprecatedRegistry')!}
6070
<Alert variant="warning">
6171
Starting April 1st, applications and jobs on Nais must use images from Google Artifact
6272
Registry (GAR). The easiest way to ensure that images are stored in GAR is to use Nais' GitHub

src/routes/team/[team]/[env]/app/[app]/+page.gql

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ query App($app: String!, $team: Slug!, $env: String!) {
4343
... on WorkloadStatusSynchronizationFailing {
4444
detail
4545
}
46+
... on WorkloadStatusInvalidNaisYaml {
47+
detail
48+
}
4649
}
4750
}
4851

src/routes/team/[team]/[env]/app/[app]/+page.svelte

+37-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import Persistence from '$lib/components/persistence/Persistence.svelte';
1010
import Secrets from '$lib/components/Secrets.svelte';
1111
import WorkloadDeploy from '$lib/components/WorkloadDeploy.svelte';
12+
import { docURL } from '$lib/doc';
1213
import GraphErrors from '$lib/GraphErrors.svelte';
1314
import Time from '$lib/Time.svelte';
1415
import { Alert, BodyLong, BodyShort, Button, Heading } from '@nais/ds-svelte-community';
@@ -73,6 +74,41 @@
7374
<div class="wrapper">
7475
<div class="app-content">
7576
<div class="main-section">
77+
{#if app.status.errors.some((error) => error.__typename === 'WorkloadStatusInvalidNaisYaml')}
78+
<Alert
79+
variant={levelVariant(
80+
app.status.errors.find(
81+
(error) => error.__typename === 'WorkloadStatusInvalidNaisYaml'
82+
)?.level
83+
)}
84+
>
85+
<div style="display: grid; gap: var(--a-spacing-3);">
86+
<Heading level="2" size="small">Rollout Failed - Invalid Manifest</Heading>
87+
<BodyLong>
88+
The rollout of your application has failed due to an error in the application
89+
manifest.
90+
</BodyLong>
91+
92+
<Heading level="3" size="xsmall">Error details</Heading>
93+
94+
<code style="font-size: 0.8rem; line-height: 1.75;"
95+
>{app.status.errors.find(
96+
(error) => error.__typename === 'WorkloadStatusInvalidNaisYaml'
97+
)?.detail}</code
98+
>
99+
100+
<BodyLong>
101+
To resolve this issue, review the application manifest and correct any errors.
102+
Consult the <a
103+
target="_blank"
104+
rel="noopener noreferrer"
105+
href={docURL('/workloads/application/reference/application-spec/')}
106+
>Nais application reference</a
107+
> for manifest requirements.
108+
</BodyLong>
109+
</div>
110+
</Alert>
111+
{/if}
76112
{#if app.status.errors.some((error) => error.__typename === 'WorkloadStatusSynchronizationFailing')}
77113
<Alert
78114
variant={levelVariant(
@@ -81,7 +117,7 @@
81117
)?.level
82118
)}
83119
>
84-
<Heading level="2" size="small" spacing>Synchronization failing</Heading>
120+
<Heading level="2" size="small" spacing>Rollout Failed - Synchronization Error</Heading>
85121
<BodyLong spacing>
86122
The rollout of the application is failing, meaning it is not in sync with the latest
87123
deployment. This may be due to a misconfiguration or a temporary issue, so try again

src/routes/team/[team]/[env]/job/[job]/+page.gql

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ query Job($job: String!, $team: Slug!, $env: String!) @cache(policy: NetworkOnly
3232
... on WorkloadStatusSynchronizationFailing {
3333
detail
3434
}
35+
... on WorkloadStatusInvalidNaisYaml {
36+
detail
37+
}
3538
}
3639
}
3740

src/routes/team/[team]/[env]/job/[job]/+page.svelte

+33-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import Persistence from '$lib/components/persistence/Persistence.svelte';
88
import Secrets from '$lib/components/Secrets.svelte';
99
import WorkloadDeploy from '$lib/components/WorkloadDeploy.svelte';
10+
import { docURL } from '$lib/doc';
1011
import GraphErrors from '$lib/GraphErrors.svelte';
1112
import Time from '$lib/Time.svelte';
1213
import { Alert, BodyLong, BodyShort, Button, Heading } from '@nais/ds-svelte-community';
@@ -78,6 +79,37 @@
7879
{@const job = $Job.data.team.environment.job}
7980
<div class="job-content">
8081
<div style="display:flex; flex-direction: column; gap: 1rem;">
82+
{#if job.status.errors.some((error) => error.__typename === 'WorkloadStatusInvalidNaisYaml')}
83+
<Alert
84+
variant={levelVariant(
85+
job.status.errors.find((error) => error.__typename === 'WorkloadStatusInvalidNaisYaml')
86+
?.level
87+
)}
88+
>
89+
<div style="display: grid; gap: var(--a-spacing-3);">
90+
<Heading level="2" size="small">Rollout Failed - Invalid Manifest</Heading>
91+
<BodyLong>
92+
The rollout of your job has failed due to an error in the job manifest.
93+
</BodyLong>
94+
95+
<Heading level="3" size="xsmall">Error details</Heading>
96+
97+
<code style="font-size: 0.8rem; line-height: 1.75;"
98+
>{job.status.errors.find(
99+
(error) => error.__typename === 'WorkloadStatusInvalidNaisYaml'
100+
)?.detail}</code
101+
>
102+
103+
<BodyLong>
104+
To resolve this issue, review the job manifest and correct any errors. Consult the <a
105+
target="_blank"
106+
rel="noopener noreferrer"
107+
href={docURL('/workloads/job/reference/naisjob-spec/')}>Nais job reference</a
108+
> for manifest requirements.
109+
</BodyLong>
110+
</div>
111+
</Alert>
112+
{/if}
81113
{#if job.status.errors.some((error) => error.__typename === 'WorkloadStatusSynchronizationFailing')}
82114
<Alert
83115
variant={levelVariant(
@@ -86,7 +118,7 @@
86118
)?.level
87119
)}
88120
>
89-
<Heading level="2" size="small" spacing>Synchronization failing</Heading>
121+
<Heading level="2" size="small" spacing>Rollout Failed - Synchronization Error</Heading>
90122
<BodyLong spacing>
91123
The rollout of the job is failing, meaning it is not in sync with the latest deployment.
92124
This may be due to a misconfiguration or a temporary issue, so try again in a few

0 commit comments

Comments
 (0)