@backstage-community/plugin-gocd 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/components/GoCdBuildsComponent/GoCdBuildsComponent.esm.js +33 -28
- package/dist/components/GoCdBuildsComponent/GoCdBuildsComponent.esm.js.map +1 -1
- package/dist/components/GoCdBuildsInsights/GoCdBuildsInsights.esm.js +21 -3
- package/dist/components/GoCdBuildsInsights/GoCdBuildsInsights.esm.js.map +1 -1
- package/dist/components/GoCdBuildsTable/GoCdBuildsTable.esm.js +68 -36
- package/dist/components/GoCdBuildsTable/GoCdBuildsTable.esm.js.map +1 -1
- package/dist/components/Select/Select.esm.js +9 -7
- package/dist/components/Select/Select.esm.js.map +1 -1
- package/package.json +15 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @backstage-community/plugin-gocd
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 87f0a61: Backstage version bump to v1.38.1
|
|
8
|
+
|
|
9
|
+
## 0.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4aad9f3: remove unused devDependency `canvas`
|
|
14
|
+
|
|
3
15
|
## 0.5.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
3
4
|
import { EmptyState, Page, Content, ContentHeader } from '@backstage/core-components';
|
|
4
5
|
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
@@ -35,10 +36,10 @@ const GoCdBuildsComponent = () => {
|
|
|
35
36
|
return apiResult?.message !== void 0;
|
|
36
37
|
}
|
|
37
38
|
if (!rawPipelines) {
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(MissingAnnotationEmptyState, { annotation: GOCD_PIPELINES_ANNOTATION });
|
|
39
40
|
}
|
|
40
41
|
if (isError(pipelineHistory)) {
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
42
43
|
EmptyState,
|
|
43
44
|
{
|
|
44
45
|
title: "GoCD pipelines",
|
|
@@ -48,7 +49,7 @@ const GoCdBuildsComponent = () => {
|
|
|
48
49
|
);
|
|
49
50
|
}
|
|
50
51
|
if (!loading && !pipelineHistory) {
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
52
53
|
EmptyState,
|
|
53
54
|
{
|
|
54
55
|
title: "GoCD pipelines",
|
|
@@ -57,30 +58,34 @@ const GoCdBuildsComponent = () => {
|
|
|
57
58
|
}
|
|
58
59
|
);
|
|
59
60
|
}
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
61
|
+
return /* @__PURE__ */ jsx(Page, { themeId: "tool", children: /* @__PURE__ */ jsxs(Content, { noPadding: true, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(ContentHeader, { title: entity.metadata.name, children: /* @__PURE__ */ jsx(
|
|
63
|
+
SelectComponent,
|
|
64
|
+
{
|
|
65
|
+
value: selectedPipeline,
|
|
66
|
+
onChange: (pipeline) => onSelectedPipelineChanged(pipeline),
|
|
67
|
+
label: "Pipeline",
|
|
68
|
+
items: getSelectionItems(rawPipelines)
|
|
69
|
+
}
|
|
70
|
+
) }),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
GoCdBuildsInsights,
|
|
73
|
+
{
|
|
74
|
+
pipelineHistory,
|
|
75
|
+
loading,
|
|
76
|
+
error
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
GoCdBuildsTable,
|
|
81
|
+
{
|
|
82
|
+
goCdBaseUrl: config.getString("gocd.baseUrl"),
|
|
83
|
+
pipelineHistory,
|
|
84
|
+
loading,
|
|
85
|
+
error
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] }) });
|
|
84
89
|
};
|
|
85
90
|
|
|
86
91
|
export { GOCD_PIPELINES_ANNOTATION, GoCdBuildsComponent, isGoCdAvailable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoCdBuildsComponent.esm.js","sources":["../../../src/components/GoCdBuildsComponent/GoCdBuildsComponent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
|
1
|
+
{"version":3,"file":"GoCdBuildsComponent.esm.js","sources":["../../../src/components/GoCdBuildsComponent/GoCdBuildsComponent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useState } from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport {\n Content,\n ContentHeader,\n EmptyState,\n Page,\n} from '@backstage/core-components';\nimport { useApi, configApiRef } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/esm/useAsync';\nimport { gocdApiRef } from '../../plugin';\nimport { GoCdBuildsTable } from '../GoCdBuildsTable/GoCdBuildsTable';\nimport { GoCdBuildsInsights } from '../GoCdBuildsInsights/GoCdBuildsInsights';\nimport { GoCdApiError, PipelineHistory } from '../../api/gocdApi.model';\nimport { Item, Select } from '../Select';\n\n/**\n * Constant storing GoCD pipelines annotation.\n *\n * @public\n */\nexport const GOCD_PIPELINES_ANNOTATION = 'gocd.org/pipelines';\n\n/**\n * Returns true if GoCD annotation is present in the given entity.\n *\n * @public\n */\nexport const isGoCdAvailable = (entity: Entity): boolean =>\n Boolean(entity.metadata.annotations?.[GOCD_PIPELINES_ANNOTATION]);\n\nexport const GoCdBuildsComponent = (): JSX.Element => {\n const { entity } = useEntity();\n const config = useApi(configApiRef);\n const rawPipelines: string[] | undefined = (\n entity.metadata.annotations?.[GOCD_PIPELINES_ANNOTATION] as\n | string\n | undefined\n )\n ?.split(',')\n .map(p => p.trim());\n const gocdApi = useApi(gocdApiRef);\n\n const [selectedPipeline, setSelectedPipeline] = useState<string>(\n rawPipelines ? rawPipelines[0] : '',\n );\n\n const {\n value: pipelineHistory,\n loading,\n error,\n } = useAsync(async (): Promise<PipelineHistory | GoCdApiError> => {\n return await gocdApi.getPipelineHistory(selectedPipeline);\n }, [selectedPipeline]);\n\n const onSelectedPipelineChanged = (pipeline: string) => {\n setSelectedPipeline(pipeline);\n };\n\n const getSelectionItems = (pipelines: string[]): Item[] => {\n return pipelines.map(p => ({ label: p, value: p }));\n };\n\n function isError(\n apiResult: PipelineHistory | GoCdApiError | undefined,\n ): apiResult is GoCdApiError {\n return (apiResult as GoCdApiError)?.message !== undefined;\n }\n\n if (!rawPipelines) {\n return (\n <MissingAnnotationEmptyState annotation={GOCD_PIPELINES_ANNOTATION} />\n );\n }\n\n if (isError(pipelineHistory)) {\n return (\n <EmptyState\n title=\"GoCD pipelines\"\n description={`Could not fetch pipelines defined for entity ${entity.metadata.name}. Error: ${pipelineHistory.message}`}\n missing=\"content\"\n />\n );\n }\n\n if (!loading && !pipelineHistory) {\n return (\n <EmptyState\n title=\"GoCD pipelines\"\n description={`We could not find pipelines defined for entity ${entity.metadata.name}.`}\n missing=\"data\"\n />\n );\n }\n\n return (\n <Page themeId=\"tool\">\n <Content noPadding>\n <ContentHeader title={entity.metadata.name}>\n <Select\n value={selectedPipeline}\n onChange={pipeline => onSelectedPipelineChanged(pipeline)}\n label=\"Pipeline\"\n items={getSelectionItems(rawPipelines)}\n />\n </ContentHeader>\n <GoCdBuildsInsights\n pipelineHistory={pipelineHistory}\n loading={loading}\n error={error}\n />\n <GoCdBuildsTable\n goCdBaseUrl={config.getString('gocd.baseUrl')}\n pipelineHistory={pipelineHistory}\n loading={loading}\n error={error}\n />\n </Content>\n </Page>\n );\n};\n"],"names":["Select"],"mappings":";;;;;;;;;;;AAwCO,MAAM,yBAA4B,GAAA;AAO5B,MAAA,eAAA,GAAkB,CAAC,MAC9B,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,yBAAyB,CAAC;AAE3D,MAAM,sBAAsB,MAAmB;AACpD,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAM,MAAA,MAAA,GAAS,OAAO,YAAY,CAAA;AAClC,EAAA,MAAM,YACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,yBAAyB,CAAA,EAIrD,KAAM,CAAA,GAAG,CACV,CAAA,GAAA,CAA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Status } from '../../api/gocdApi.model.esm.js';
|
|
4
4
|
import Box from '@material-ui/core/Box';
|
|
@@ -114,12 +114,30 @@ function failureRate(jobs) {
|
|
|
114
114
|
const GoCdBuildsInsights = (props) => {
|
|
115
115
|
const { pipelineHistory, loading, error } = props;
|
|
116
116
|
if (loading || error || !pipelineHistory) {
|
|
117
|
-
return /* @__PURE__ */
|
|
117
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
118
118
|
}
|
|
119
119
|
const stages = pipelineHistory.pipelines.slice().reverse().map((p) => p.stages).flat();
|
|
120
120
|
const jobs = stages.map((s) => s.jobs).flat();
|
|
121
121
|
const failureRateObj = failureRate(jobs);
|
|
122
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ jsx(Box, { "data-testid": "GoCdBuildsInsightsBox", sx: { mb: 1 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 1, children: [
|
|
123
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 6, sm: 3, children: /* @__PURE__ */ jsx(Tooltip, { title: "What is your deployment frequency?", children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
124
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: "Run Frequency" }),
|
|
125
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", children: runFrequency(pipelineHistory) })
|
|
126
|
+
] }) }) }) }),
|
|
127
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 6, sm: 3, children: /* @__PURE__ */ jsx(Tooltip, { title: "How long does it take to fix a failure?", children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
128
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: "Mean Time to Recovery" }),
|
|
129
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", children: meanTimeToRecovery(jobs) })
|
|
130
|
+
] }) }) }) }),
|
|
131
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 6, sm: 3, children: /* @__PURE__ */ jsx(Tooltip, { title: "How often do changes fail?", children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
132
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: "Mean Time Between Failures" }),
|
|
133
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", children: meanTimeBetweenFailures(jobs) })
|
|
134
|
+
] }) }) }) }),
|
|
135
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 6, sm: 3, children: /* @__PURE__ */ jsx(Tooltip, { title: "What percentage of changes result in a failure?", children: /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
136
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: "Failure Rate" }),
|
|
137
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", children: failureRateObj.title }),
|
|
138
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: failureRateObj.subtitle })
|
|
139
|
+
] }) }) }) })
|
|
140
|
+
] }) });
|
|
123
141
|
};
|
|
124
142
|
|
|
125
143
|
export { GoCdBuildsInsights };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoCdBuildsInsights.esm.js","sources":["../../../src/components/GoCdBuildsInsights/GoCdBuildsInsights.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { groupBy, mean } from 'lodash';\nimport {\n PipelineHistory,\n Job,\n toBuildResultStatus,\n GoCdBuildResultStatus,\n} from '../../api/gocdApi.model';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport { DateTime, Duration } from 'luxon';\n\nexport type GoCdBuildsInsightsProps = {\n pipelineHistory: PipelineHistory | undefined;\n loading: boolean;\n error: Error | undefined;\n};\n\nfunction runFrequency(pipelineHistory: PipelineHistory): string {\n const lastMonth = DateTime.now().minus({ month: 1 });\n const buildLastMonth = pipelineHistory.pipelines\n .map(p => p.scheduled_date)\n .filter((d): d is number => !!d)\n .map(d => DateTime.fromMillis(d))\n .filter(d => d > lastMonth).length;\n return `${buildLastMonth} last month`;\n}\n\nfunction meanTimeBetweenFailures(jobs: Job[]): string {\n const timeBetweenFailures: Duration[] = [];\n for (let index = 1; index < jobs.length; index++) {\n const job = jobs[index];\n if (!job.result) {\n continue;\n }\n if (toBuildResultStatus(job.result) === GoCdBuildResultStatus.error) {\n let previousFailedJob: Job | null = null;\n for (let j = index - 1; j >= 0; j--) {\n const candidateJob = jobs[j];\n if (!candidateJob.result) {\n continue;\n }\n if (\n toBuildResultStatus(candidateJob.result) ===\n GoCdBuildResultStatus.error\n ) {\n previousFailedJob = candidateJob;\n break;\n }\n }\n if (\n !previousFailedJob ||\n !job.scheduled_date ||\n !previousFailedJob.scheduled_date\n ) {\n continue;\n }\n const failedJobDate = DateTime.fromMillis(job.scheduled_date);\n const previousFailedJobDate = DateTime.fromMillis(\n previousFailedJob.scheduled_date,\n );\n const timeBetweenFailure = failedJobDate.diff(previousFailedJobDate);\n timeBetweenFailures.push(timeBetweenFailure);\n }\n }\n return formatMean(timeBetweenFailures);\n}\n\n/**\n * Imagine a sequence like:\n * S - S - S - F - S - F - F - S - S\n *\n * We iterate until finding a failure, and then iterate forward\n * until we find the first immediate success to then\n * calculate the time difference between the scheduling of the jobs.\n */\nfunction meanTimeToRecovery(jobs: Job[]): string {\n const timeToRecoverIntervals: Duration[] = [];\n for (let index = 0; index < jobs.length; index++) {\n const job = jobs[index];\n if (!job.result) {\n continue;\n }\n if (toBuildResultStatus(job.result) === GoCdBuildResultStatus.error) {\n let nextSuccessfulJob: Job | null = null;\n for (let j = index + 1; j < jobs.length; j++) {\n const candidateJob = jobs[j];\n if (!candidateJob.result) {\n continue;\n }\n if (\n toBuildResultStatus(candidateJob.result) ===\n GoCdBuildResultStatus.successful\n ) {\n nextSuccessfulJob = candidateJob;\n break;\n }\n }\n if (\n !nextSuccessfulJob ||\n !job.scheduled_date ||\n !nextSuccessfulJob.scheduled_date\n ) {\n continue;\n }\n const failedJobDate = DateTime.fromMillis(job.scheduled_date);\n const successfulJobDate = DateTime.fromMillis(\n nextSuccessfulJob.scheduled_date,\n );\n const timeToRecovery = successfulJobDate.diff(failedJobDate);\n timeToRecoverIntervals.push(timeToRecovery);\n }\n }\n\n return formatMean(timeToRecoverIntervals);\n}\n\nfunction formatMean(durations: Duration[]): string {\n if (durations.length === 0) {\n return 'N/A';\n }\n\n const mttr: Duration = Duration.fromMillis(\n mean(durations.map(i => i.milliseconds)),\n );\n return mttr.toFormat(\"d'd' h'h' m'm' s's'\");\n}\n\nfunction failureRate(jobs: Job[]): {\n title: string;\n subtitle: string;\n} {\n const resultGroups = new Map(\n Object.entries(groupBy(jobs, 'result')).map(([key, value]) => [\n toBuildResultStatus(key),\n value.flat(),\n ]),\n );\n const failedJobs = resultGroups.get(GoCdBuildResultStatus.error);\n if (!failedJobs) {\n return {\n title: '0',\n subtitle: '(no failed jobs found)',\n };\n }\n\n resultGroups.delete(GoCdBuildResultStatus.error);\n const nonFailedJobs = Array.from(resultGroups.values()).flat();\n\n const totalJobs = failedJobs.length + nonFailedJobs.length;\n const percentage = (failedJobs.length / totalJobs) * 100;\n const decimalPercentage = (Math.round(percentage * 100) / 100).toFixed(2);\n return {\n title: `${decimalPercentage}%`,\n subtitle: `(${failedJobs.length} out of ${totalJobs} jobs)`,\n };\n}\n\nexport const GoCdBuildsInsights = (\n props: GoCdBuildsInsightsProps,\n): JSX.Element => {\n const { pipelineHistory, loading, error } = props;\n\n if (loading || error || !pipelineHistory) {\n return <></>;\n }\n\n // We reverse the array to calculate insights to make sure jobs are ordered\n // by their schedule date.\n const stages = pipelineHistory.pipelines\n .slice()\n .reverse()\n .map(p => p.stages)\n .flat();\n const jobs = stages.map(s => s.jobs).flat();\n\n const failureRateObj: { title: string; subtitle: string } = failureRate(jobs);\n\n return (\n <Box data-testid=\"GoCdBuildsInsightsBox\" sx={{ mb: 1 }}>\n <Grid container spacing={1}>\n <Grid item xs={6} sm={3}>\n <Tooltip title=\"What is your deployment frequency?\">\n <Card>\n <CardContent>\n <Typography variant=\"body2\">Run Frequency</Typography>\n <Typography variant=\"h4\">\n {runFrequency(pipelineHistory)}\n </Typography>\n </CardContent>\n </Card>\n </Tooltip>\n </Grid>\n <Grid item xs={6} sm={3}>\n <Tooltip title=\"How long does it take to fix a failure?\">\n <Card>\n <CardContent>\n <Typography variant=\"body2\">Mean Time to Recovery</Typography>\n <Typography variant=\"h4\">{meanTimeToRecovery(jobs)}</Typography>\n </CardContent>\n </Card>\n </Tooltip>\n </Grid>\n <Grid item xs={6} sm={3}>\n <Tooltip title=\"How often do changes fail?\">\n <Card>\n <CardContent>\n <Typography variant=\"body2\">\n Mean Time Between Failures\n </Typography>\n <Typography variant=\"h4\">\n {meanTimeBetweenFailures(jobs)}\n </Typography>\n </CardContent>\n </Card>\n </Tooltip>\n </Grid>\n <Grid item xs={6} sm={3}>\n <Tooltip title=\"What percentage of changes result in a failure?\">\n <Card>\n <CardContent>\n <Typography variant=\"body2\">Failure Rate</Typography>\n <Typography variant=\"h4\">{failureRateObj.title}</Typography>\n <Typography variant=\"body2\">\n {failureRateObj.subtitle}\n </Typography>\n </CardContent>\n </Card>\n </Tooltip>\n </Grid>\n </Grid>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAqCA,SAAS,a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AA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,4BAE5B,CAAA,sCACC,UAAW,EAAA,EAAA,OAAA,EAAQ,IACjB,EAAA,EAAA,uBAAA,CAAwB,IAAI,CAC/B,CACF,CACF,CACF,CACF,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,CAAA,EAAG,EAAI,EAAA,CAAA,EAAA,sCACnB,OAAQ,EAAA,EAAA,KAAA,EAAM,iDACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,4BACE,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,OAAQ,EAAA,EAAA,cAAY,CACxC,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAQ,EAAA,IAAA,EAAA,EAAM,cAAe,CAAA,KAAM,mBAC9C,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EACjB,eAAe,QAClB,CACF,CACF,CACF,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"GoCdBuildsInsights.esm.js","sources":["../../../src/components/GoCdBuildsInsights/GoCdBuildsInsights.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { groupBy, mean } from 'lodash';\nimport {\n PipelineHistory,\n Job,\n toBuildResultStatus,\n GoCdBuildResultStatus,\n} from '../../api/gocdApi.model';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport { DateTime, Duration } from 'luxon';\n\nexport type GoCdBuildsInsightsProps = {\n pipelineHistory: PipelineHistory | undefined;\n loading: boolean;\n error: Error | undefined;\n};\n\nfunction runFrequency(pipelineHistory: PipelineHistory): string {\n const lastMonth = DateTime.now().minus({ month: 1 });\n const buildLastMonth = pipelineHistory.pipelines\n .map(p => p.scheduled_date)\n .filter((d): d is number => !!d)\n .map(d => DateTime.fromMillis(d))\n .filter(d => d > lastMonth).length;\n return `${buildLastMonth} last month`;\n}\n\nfunction meanTimeBetweenFailures(jobs: Job[]): string {\n const timeBetweenFailures: Duration[] = [];\n for (let index = 1; index < jobs.length; index++) {\n const job = jobs[index];\n if (!job.result) {\n continue;\n }\n if (toBuildResultStatus(job.result) === GoCdBuildResultStatus.error) {\n let previousFailedJob: Job | null = null;\n for (let j = index - 1; j >= 0; j--) {\n const candidateJob = jobs[j];\n if (!candidateJob.result) {\n continue;\n }\n if (\n toBuildResultStatus(candidateJob.result) ===\n GoCdBuildResultStatus.error\n ) {\n previousFailedJob = candidateJob;\n break;\n }\n }\n if (\n !previousFailedJob ||\n !job.scheduled_date ||\n !previousFailedJob.scheduled_date\n ) {\n continue;\n }\n const failedJobDate = DateTime.fromMillis(job.scheduled_date);\n const previousFailedJobDate = DateTime.fromMillis(\n previousFailedJob.scheduled_date,\n );\n const timeBetweenFailure = failedJobDate.diff(previousFailedJobDate);\n timeBetweenFailures.push(timeBetweenFailure);\n }\n }\n return formatMean(timeBetweenFailures);\n}\n\n/**\n * Imagine a sequence like:\n * S - S - S - F - S - F - F - S - S\n *\n * We iterate until finding a failure, and then iterate forward\n * until we find the first immediate success to then\n * calculate the time difference between the scheduling of the jobs.\n */\nfunction meanTimeToRecovery(jobs: Job[]): string {\n const timeToRecoverIntervals: Duration[] = [];\n for (let index = 0; index < jobs.length; index++) {\n const job = jobs[index];\n if (!job.result) {\n continue;\n }\n if (toBuildResultStatus(job.result) === GoCdBuildResultStatus.error) {\n let nextSuccessfulJob: Job | null = null;\n for (let j = index + 1; j < jobs.length; j++) {\n const candidateJob = jobs[j];\n if (!candidateJob.result) {\n continue;\n }\n if (\n toBuildResultStatus(candidateJob.result) ===\n GoCdBuildResultStatus.successful\n ) {\n nextSuccessfulJob = candidateJob;\n break;\n }\n }\n if (\n !nextSuccessfulJob ||\n !job.scheduled_date ||\n !nextSuccessfulJob.scheduled_date\n ) {\n continue;\n }\n const failedJobDate = DateTime.fromMillis(job.scheduled_date);\n const successfulJobDate = DateTime.fromMillis(\n nextSuccessfulJob.scheduled_date,\n );\n const timeToRecovery = successfulJobDate.diff(failedJobDate);\n timeToRecoverIntervals.push(timeToRecovery);\n }\n }\n\n return formatMean(timeToRecoverIntervals);\n}\n\nfunction formatMean(durations: Duration[]): string {\n if (durations.length === 0) {\n return 'N/A';\n }\n\n const mttr: Duration = Duration.fromMillis(\n mean(durations.map(i => i.milliseconds)),\n );\n return mttr.toFormat(\"d'd' h'h' m'm' s's'\");\n}\n\nfunction failureRate(jobs: Job[]): {\n title: string;\n subtitle: string;\n} {\n const resultGroups = new Map(\n Object.entries(groupBy(jobs, 'result')).map(([key, value]) => [\n toBuildResultStatus(key),\n value.flat(),\n ]),\n );\n const failedJobs = resultGroups.get(GoCdBuildResultStatus.error);\n if (!failedJobs) {\n return {\n title: '0',\n subtitle: '(no failed jobs found)',\n };\n }\n\n resultGroups.delete(GoCdBuildResultStatus.error);\n const nonFailedJobs = Array.from(resultGroups.values()).flat();\n\n const totalJobs = failedJobs.length + nonFailedJobs.length;\n const percentage = (failedJobs.length / totalJobs) * 100;\n const decimalPercentage = (Math.round(percentage * 100) / 100).toFixed(2);\n return {\n title: `${decimalPercentage}%`,\n subtitle: `(${failedJobs.length} out of ${totalJobs} jobs)`,\n };\n}\n\nexport const GoCdBuildsInsights = (\n props: GoCdBuildsInsightsProps,\n): JSX.Element => {\n const { pipelineHistory, loading, error } = props;\n\n if (loading || error || !pipelineHistory) {\n return <></>;\n }\n\n // We reverse the array to calculate insights to make sure jobs are ordered\n // by their schedule date.\n const stages = pipelineHistory.pipelines\n .slice()\n .reverse()\n .map(p => p.stages)\n .flat();\n const jobs = stages.map(s => s.jobs).flat();\n\n const failureRateObj: { title: string; subtitle: string } = failureRate(jobs);\n\n return (\n <Box data-testid=\"GoCdBuildsInsightsBox\" sx={{ mb: 1 }}>\n <Grid container spacing={1}>\n <Grid item xs={6} sm={3}>\n <Tooltip title=\"What is your deployment frequency?\">\n <Card>\n <CardContent>\n <Typography variant=\"body2\">Run Frequency</Typography>\n <Typography variant=\"h4\">\n {runFrequency(pipelineHistory)}\n </Typography>\n </CardContent>\n </Card>\n </Tooltip>\n </Grid>\n <Grid item xs={6} sm={3}>\n <Tooltip title=\"How long does it take to fix a failure?\">\n <Card>\n <CardContent>\n <Typography variant=\"body2\">Mean Time to Recovery</Typography>\n <Typography variant=\"h4\">{meanTimeToRecovery(jobs)}</Typography>\n </CardContent>\n </Card>\n </Tooltip>\n </Grid>\n <Grid item xs={6} sm={3}>\n <Tooltip title=\"How often do changes fail?\">\n <Card>\n <CardContent>\n <Typography variant=\"body2\">\n Mean Time Between Failures\n </Typography>\n <Typography variant=\"h4\">\n {meanTimeBetweenFailures(jobs)}\n </Typography>\n </CardContent>\n </Card>\n </Tooltip>\n </Grid>\n <Grid item xs={6} sm={3}>\n <Tooltip title=\"What percentage of changes result in a failure?\">\n <Card>\n <CardContent>\n <Typography variant=\"body2\">Failure Rate</Typography>\n <Typography variant=\"h4\">{failureRateObj.title}</Typography>\n <Typography variant=\"body2\">\n {failureRateObj.subtitle}\n </Typography>\n </CardContent>\n </Card>\n </Tooltip>\n </Grid>\n </Grid>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAoCA,SAAS,aAA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,EACb,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EACC,+BAAC,WACC,EAAA,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAQ,QAE5B,EAAA,4BAAA,EAAA,CAAA;AAAA,0BACC,UAAW,EAAA,EAAA,OAAA,EAAQ,IACjB,EAAA,QAAA,EAAA,uBAAA,CAAwB,IAAI,CAC/B,EAAA;AAAA,KACF,EAAA,CAAA,EACF,GACF,CACF,EAAA,CAAA;AAAA,oBACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,CAAG,EAAA,EAAA,EAAI,CACpB,EAAA,QAAA,kBAAA,GAAA,CAAC,WAAQ,KAAM,EAAA,iDAAA,EACb,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EACC,+BAAC,WACC,EAAA,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAQ,QAAY,EAAA,cAAA,EAAA,CAAA;AAAA,sBACvC,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAM,yBAAe,KAAM,EAAA,CAAA;AAAA,sBAC9C,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,yBAAe,QAClB,EAAA;AAAA,KACF,EAAA,CAAA,EACF,GACF,CACF,EAAA;AAAA,GAAA,EACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { getEntitySourceLocation } from '@backstage/catalog-model';
|
|
3
4
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
4
5
|
import Alert from '@material-ui/lab/Alert';
|
|
@@ -9,51 +10,79 @@ import { DateTime } from 'luxon';
|
|
|
9
10
|
import { Table, SubvalueCell, StatusWarning, StatusPending, StatusAborted, StatusRunning, StatusError, StatusOK, Link } from '@backstage/core-components';
|
|
10
11
|
|
|
11
12
|
const renderTrigger = (build) => {
|
|
12
|
-
const subvalue = /* @__PURE__ */
|
|
13
|
-
|
|
13
|
+
const subvalue = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
build.pipeline,
|
|
15
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
16
|
+
build.author
|
|
17
|
+
] });
|
|
18
|
+
return /* @__PURE__ */ jsx(SubvalueCell, { value: build.message, subvalue });
|
|
14
19
|
};
|
|
15
20
|
const renderStages = (build) => {
|
|
16
21
|
return build.stages.map((s) => {
|
|
17
22
|
switch (s.status) {
|
|
18
23
|
case GoCdBuildResultStatus.successful: {
|
|
19
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(StatusOK, { children: s.text }),
|
|
26
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
27
|
+
/* @__PURE__ */ jsx("br", {})
|
|
28
|
+
] });
|
|
20
29
|
}
|
|
21
30
|
case GoCdBuildResultStatus.error: {
|
|
22
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(StatusError, { children: s.text }),
|
|
33
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
34
|
+
/* @__PURE__ */ jsx("br", {})
|
|
35
|
+
] });
|
|
23
36
|
}
|
|
24
37
|
case GoCdBuildResultStatus.running: {
|
|
25
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx(StatusRunning, { children: s.text }),
|
|
40
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
41
|
+
/* @__PURE__ */ jsx("br", {})
|
|
42
|
+
] });
|
|
26
43
|
}
|
|
27
44
|
case GoCdBuildResultStatus.aborted: {
|
|
28
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(StatusAborted, { children: s.text }),
|
|
47
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
48
|
+
/* @__PURE__ */ jsx("br", {})
|
|
49
|
+
] });
|
|
29
50
|
}
|
|
30
51
|
case GoCdBuildResultStatus.pending: {
|
|
31
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53
|
+
/* @__PURE__ */ jsx(StatusPending, { children: s.text }),
|
|
54
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
55
|
+
/* @__PURE__ */ jsx("br", {})
|
|
56
|
+
] });
|
|
32
57
|
}
|
|
33
58
|
default: {
|
|
34
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(StatusWarning, { children: s.text }),
|
|
61
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
62
|
+
/* @__PURE__ */ jsx("br", {})
|
|
63
|
+
] });
|
|
35
64
|
}
|
|
36
65
|
}
|
|
37
66
|
});
|
|
38
67
|
};
|
|
39
68
|
const renderSource = (build) => {
|
|
40
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
41
70
|
Button,
|
|
42
71
|
{
|
|
43
72
|
href: build.source,
|
|
44
73
|
target: "_blank",
|
|
45
74
|
rel: "noreferrer",
|
|
46
|
-
startIcon: /* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
|
|
75
|
+
startIcon: /* @__PURE__ */ jsx(GitHubIcon, {}),
|
|
76
|
+
children: build.commitHash
|
|
77
|
+
}
|
|
49
78
|
);
|
|
50
79
|
};
|
|
51
80
|
const renderId = (goCdBaseUrl, build) => {
|
|
52
81
|
const goCdBuildUrl = `${goCdBaseUrl}/go/pipelines/value_stream_map/${build.buildSlug}`;
|
|
53
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
54
83
|
SubvalueCell,
|
|
55
84
|
{
|
|
56
|
-
value: /* @__PURE__ */
|
|
85
|
+
value: /* @__PURE__ */ jsx(Link, { to: goCdBuildUrl, target: "_blank", rel: "noreferrer", children: build.id }),
|
|
57
86
|
subvalue: build.triggerTime && DateTime.fromMillis(build.triggerTime).toLocaleString(
|
|
58
87
|
DateTime.DATETIME_MED
|
|
59
88
|
)
|
|
@@ -61,7 +90,7 @@ const renderId = (goCdBaseUrl, build) => {
|
|
|
61
90
|
);
|
|
62
91
|
};
|
|
63
92
|
const renderError = (error) => {
|
|
64
|
-
return /* @__PURE__ */
|
|
93
|
+
return /* @__PURE__ */ jsx(Alert, { severity: "error", children: error.message });
|
|
65
94
|
};
|
|
66
95
|
const toBuildResults = (entity, builds) => {
|
|
67
96
|
const entitySourceLocation = getEntitySourceLocation(entity).target.split("/tree")[0];
|
|
@@ -109,26 +138,29 @@ const GoCdBuildsTable = (props) => {
|
|
|
109
138
|
render: (build) => renderSource(build)
|
|
110
139
|
}
|
|
111
140
|
];
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
142
|
+
error && renderError(error),
|
|
143
|
+
!error && /* @__PURE__ */ jsx(
|
|
144
|
+
Table,
|
|
145
|
+
{
|
|
146
|
+
title: "GoCD builds",
|
|
147
|
+
isLoading: loading,
|
|
148
|
+
options: {
|
|
149
|
+
search: true,
|
|
150
|
+
searchAutoFocus: true,
|
|
151
|
+
debounceInterval: 800,
|
|
152
|
+
paging: true,
|
|
153
|
+
padding: "dense",
|
|
154
|
+
pageSizeOptions: [5, 10, 20, 50],
|
|
155
|
+
showFirstLastPageButtons: false,
|
|
156
|
+
pageSize: 20
|
|
157
|
+
},
|
|
158
|
+
columns,
|
|
159
|
+
data: pipelineHistory ? toBuildResults(entity, pipelineHistory.pipelines) || [] : [],
|
|
160
|
+
onSearchChange: (searchTerm) => setSelectedSearchTerm(searchTerm)
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] });
|
|
132
164
|
};
|
|
133
165
|
|
|
134
166
|
export { GoCdBuildsTable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoCdBuildsTable.esm.js","sources":["../../../src/components/GoCdBuildsTable/GoCdBuildsTable.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react';\nimport { Entity, getEntitySourceLocation } from '@backstage/catalog-model';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport Alert from '@material-ui/lab/Alert';\nimport Button from '@material-ui/core/Button';\nimport GitHubIcon from '@material-ui/icons/GitHub';\nimport {\n GoCdBuildResult,\n GoCdBuildResultStatus,\n toBuildResultStatus,\n PipelineHistory,\n Pipeline,\n} from '../../api/gocdApi.model';\nimport { DateTime } from 'luxon';\nimport {\n Table,\n TableColumn,\n Link,\n SubvalueCell,\n StatusOK,\n StatusWarning,\n StatusAborted,\n StatusError,\n StatusRunning,\n StatusPending,\n} from '@backstage/core-components';\n\ntype GoCdBuildsProps = {\n goCdBaseUrl: string;\n pipelineHistory: PipelineHistory | undefined;\n loading: boolean;\n error: Error | undefined;\n};\n\nconst renderTrigger = (build: GoCdBuildResult): React.ReactNode => {\n const subvalue = (\n <>\n {build.pipeline}\n <br />\n {build.author}\n </>\n );\n return <SubvalueCell value={build.message} subvalue={subvalue} />;\n};\n\nconst renderStages = (build: GoCdBuildResult): React.ReactNode => {\n return build.stages.map(s => {\n switch (s.status) {\n case GoCdBuildResultStatus.successful: {\n return (\n <>\n <StatusOK>{s.text}</StatusOK>\n <br />\n <br />\n </>\n );\n }\n case GoCdBuildResultStatus.error: {\n return (\n <>\n <StatusError>{s.text}</StatusError>\n <br />\n <br />\n </>\n );\n }\n case GoCdBuildResultStatus.running: {\n return (\n <>\n <StatusRunning>{s.text}</StatusRunning>\n <br />\n <br />\n </>\n );\n }\n case GoCdBuildResultStatus.aborted: {\n return (\n <>\n <StatusAborted>{s.text}</StatusAborted>\n <br />\n <br />\n </>\n );\n }\n case GoCdBuildResultStatus.pending: {\n return (\n <>\n <StatusPending>{s.text}</StatusPending>\n <br />\n <br />\n </>\n );\n }\n default: {\n return (\n <>\n <StatusWarning>{s.text}</StatusWarning>\n <br />\n <br />\n </>\n );\n }\n }\n });\n};\n\nconst renderSource = (build: GoCdBuildResult): React.ReactNode => {\n return (\n <Button\n href={build.source}\n target=\"_blank\"\n rel=\"noreferrer\"\n startIcon={<GitHubIcon />}\n >\n {build.commitHash}\n </Button>\n );\n};\n\nconst renderId = (\n goCdBaseUrl: string,\n build: GoCdBuildResult,\n): React.ReactNode => {\n const goCdBuildUrl = `${goCdBaseUrl}/go/pipelines/value_stream_map/${build.buildSlug}`;\n return (\n <SubvalueCell\n value={\n <Link to={goCdBuildUrl} target=\"_blank\" rel=\"noreferrer\">\n {build.id}\n </Link>\n }\n subvalue={\n build.triggerTime &&\n DateTime.fromMillis(build.triggerTime).toLocaleString(\n DateTime.DATETIME_MED,\n )\n }\n />\n );\n};\n\nconst renderError = (error: Error): JSX.Element => {\n return <Alert severity=\"error\">{error.message}</Alert>;\n};\n\nconst toBuildResults = (\n entity: Entity,\n builds: Pipeline[],\n): GoCdBuildResult[] | undefined => {\n // TODO(julioz): What if not git 'type'?\n const entitySourceLocation =\n getEntitySourceLocation(entity).target.split('/tree')[0];\n return builds.map(build => ({\n id: build.counter,\n source: `${entitySourceLocation}/commit/${build.build_cause?.material_revisions[0]?.modifications[0].revision}`,\n stages: build.stages.map(s => ({\n status: toBuildResultStatus(s.status),\n text: s.name,\n })),\n buildSlug: `${build.name}/${build.counter}`,\n message:\n build.build_cause?.material_revisions[0]?.modifications[0].comment ?? '',\n pipeline: build.name,\n author:\n build.build_cause?.material_revisions[0]?.modifications[0].user_name,\n commitHash: build.label,\n triggerTime: build.scheduled_date,\n }));\n};\n\nexport const GoCdBuildsTable = (props: GoCdBuildsProps): JSX.Element => {\n const { pipelineHistory, loading, error } = props;\n const { entity } = useEntity();\n const [, setSelectedSearchTerm] = useState<string>('');\n\n const columns: TableColumn<GoCdBuildResult>[] = [\n {\n title: 'ID',\n field: 'id',\n highlight: true,\n render: build => renderId(props.goCdBaseUrl, build),\n },\n {\n title: 'Trigger',\n customFilterAndSearch: (query, row: GoCdBuildResult) =>\n `${row.message} ${row.pipeline} ${row.author}`\n .toLocaleUpperCase('en-US')\n .includes(query.toLocaleUpperCase('en-US')),\n field: 'message',\n highlight: true,\n render: build => renderTrigger(build),\n },\n {\n title: 'Stages',\n field: 'status',\n render: build => renderStages(build),\n },\n {\n title: 'Source',\n field: 'source',\n render: build => renderSource(build),\n },\n ];\n\n return (\n <>\n {error && renderError(error)}\n {!error && (\n <Table\n title=\"GoCD builds\"\n isLoading={loading}\n options={{\n search: true,\n searchAutoFocus: true,\n debounceInterval: 800,\n paging: true,\n padding: 'dense',\n pageSizeOptions: [5, 10, 20, 50],\n showFirstLastPageButtons: false,\n pageSize: 20,\n }}\n columns={columns}\n data={\n pipelineHistory\n ? toBuildResults(entity, pipelineHistory.pip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,cAAe,CAAA,MAAA,EAAQ,gBAAgB,SAAS,CAAA,IAAK,EAAC,GACtD,EAAC;AAAA,MAEP,cAAgB,EAAA,CAAC,UACf,KAAA,qBAAA,CAAsB,UAAU;AAAA;AAAA,GAIxC,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"GoCdBuildsTable.esm.js","sources":["../../../src/components/GoCdBuildsTable/GoCdBuildsTable.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useState } from 'react';\n\nimport * as React from 'react';\nimport { Entity, getEntitySourceLocation } from '@backstage/catalog-model';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport Alert from '@material-ui/lab/Alert';\nimport Button from '@material-ui/core/Button';\nimport GitHubIcon from '@material-ui/icons/GitHub';\nimport {\n GoCdBuildResult,\n GoCdBuildResultStatus,\n toBuildResultStatus,\n PipelineHistory,\n Pipeline,\n} from '../../api/gocdApi.model';\nimport { DateTime } from 'luxon';\nimport {\n Table,\n TableColumn,\n Link,\n SubvalueCell,\n StatusOK,\n StatusWarning,\n StatusAborted,\n StatusError,\n StatusRunning,\n StatusPending,\n} from '@backstage/core-components';\n\ntype GoCdBuildsProps = {\n goCdBaseUrl: string;\n pipelineHistory: PipelineHistory | undefined;\n loading: boolean;\n error: Error | undefined;\n};\n\nconst renderTrigger = (build: GoCdBuildResult): React.ReactNode => {\n const subvalue = (\n <>\n {build.pipeline}\n <br />\n {build.author}\n </>\n );\n return <SubvalueCell value={build.message} subvalue={subvalue} />;\n};\n\nconst renderStages = (build: GoCdBuildResult): React.ReactNode => {\n return build.stages.map(s => {\n switch (s.status) {\n case GoCdBuildResultStatus.successful: {\n return (\n <>\n <StatusOK>{s.text}</StatusOK>\n <br />\n <br />\n </>\n );\n }\n case GoCdBuildResultStatus.error: {\n return (\n <>\n <StatusError>{s.text}</StatusError>\n <br />\n <br />\n </>\n );\n }\n case GoCdBuildResultStatus.running: {\n return (\n <>\n <StatusRunning>{s.text}</StatusRunning>\n <br />\n <br />\n </>\n );\n }\n case GoCdBuildResultStatus.aborted: {\n return (\n <>\n <StatusAborted>{s.text}</StatusAborted>\n <br />\n <br />\n </>\n );\n }\n case GoCdBuildResultStatus.pending: {\n return (\n <>\n <StatusPending>{s.text}</StatusPending>\n <br />\n <br />\n </>\n );\n }\n default: {\n return (\n <>\n <StatusWarning>{s.text}</StatusWarning>\n <br />\n <br />\n </>\n );\n }\n }\n });\n};\n\nconst renderSource = (build: GoCdBuildResult): React.ReactNode => {\n return (\n <Button\n href={build.source}\n target=\"_blank\"\n rel=\"noreferrer\"\n startIcon={<GitHubIcon />}\n >\n {build.commitHash}\n </Button>\n );\n};\n\nconst renderId = (\n goCdBaseUrl: string,\n build: GoCdBuildResult,\n): React.ReactNode => {\n const goCdBuildUrl = `${goCdBaseUrl}/go/pipelines/value_stream_map/${build.buildSlug}`;\n return (\n <SubvalueCell\n value={\n <Link to={goCdBuildUrl} target=\"_blank\" rel=\"noreferrer\">\n {build.id}\n </Link>\n }\n subvalue={\n build.triggerTime &&\n DateTime.fromMillis(build.triggerTime).toLocaleString(\n DateTime.DATETIME_MED,\n )\n }\n />\n );\n};\n\nconst renderError = (error: Error): JSX.Element => {\n return <Alert severity=\"error\">{error.message}</Alert>;\n};\n\nconst toBuildResults = (\n entity: Entity,\n builds: Pipeline[],\n): GoCdBuildResult[] | undefined => {\n // TODO(julioz): What if not git 'type'?\n const entitySourceLocation =\n getEntitySourceLocation(entity).target.split('/tree')[0];\n return builds.map(build => ({\n id: build.counter,\n source: `${entitySourceLocation}/commit/${build.build_cause?.material_revisions[0]?.modifications[0].revision}`,\n stages: build.stages.map(s => ({\n status: toBuildResultStatus(s.status),\n text: s.name,\n })),\n buildSlug: `${build.name}/${build.counter}`,\n message:\n build.build_cause?.material_revisions[0]?.modifications[0].comment ?? '',\n pipeline: build.name,\n author:\n build.build_cause?.material_revisions[0]?.modifications[0].user_name,\n commitHash: build.label,\n triggerTime: build.scheduled_date,\n }));\n};\n\nexport const GoCdBuildsTable = (props: GoCdBuildsProps): JSX.Element => {\n const { pipelineHistory, loading, error } = props;\n const { entity } = useEntity();\n const [, setSelectedSearchTerm] = useState<string>('');\n\n const columns: TableColumn<GoCdBuildResult>[] = [\n {\n title: 'ID',\n field: 'id',\n highlight: true,\n render: build => renderId(props.goCdBaseUrl, build),\n },\n {\n title: 'Trigger',\n customFilterAndSearch: (query, row: GoCdBuildResult) =>\n `${row.message} ${row.pipeline} ${row.author}`\n .toLocaleUpperCase('en-US')\n .includes(query.toLocaleUpperCase('en-US')),\n field: 'message',\n highlight: true,\n render: build => renderTrigger(build),\n },\n {\n title: 'Stages',\n field: 'status',\n render: build => renderStages(build),\n },\n {\n title: 'Source',\n field: 'source',\n render: build => renderSource(build),\n },\n ];\n\n return (\n <>\n {error && renderError(error)}\n {!error && (\n <Table\n title=\"GoCD builds\"\n isLoading={loading}\n options={{\n search: true,\n searchAutoFocus: true,\n debounceInterval: 800,\n paging: true,\n padding: 'dense',\n pageSizeOptions: [5, 10, 20, 50],\n showFirstLastPageButtons: false,\n pageSize: 20,\n }}\n columns={columns}\n data={\n pipelineHistory\n ? toBuildResults(entity, pipelineHistory.pipelines) || []\n : []\n }\n onSearchChange={(searchTerm: string) =>\n setSelectedSearchTerm(searchTerm)\n }\n />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAmDA,MAAM,aAAA,GAAgB,CAAC,KAA4C,KAAA;AACjE,EAAA,MAAM,2BAED,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAM,KAAA,CA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AA,EAAQ,CAAS,KAAA,KAAA,YAAA,CAAa,KAAK;AAAA,KACrC;AAAA,IACA;AAAA,MACE,KAAO,EAAA,QAAA;AAAA,MACP,KAAO,EAAA,QAAA;AAAA,MACP,MAAA,EAAQ,CAAS,KAAA,KAAA,YAAA,CAAa,KAAK;AAAA;AACrC,GACF;AAEA,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,KAAA,IAAS,YAAY,KAAK,CAAA;AAAA,IAC1B,CAAC,KACA,oBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,aAAA;AAAA,QACN,SAAW,EAAA,OAAA;AAAA,QACX,OAAS,EAAA;AAAA,UACP,MAAQ,EAAA,IAAA;AAAA,UACR,eAAiB,EAAA,IAAA;AAAA,UACjB,gBAAkB,EAAA,GAAA;AAAA,UAClB,MAAQ,EAAA,IAAA;AAAA,UACR,OAAS,EAAA,OAAA;AAAA,UACT,eAAiB,EAAA,CAAC,CAAG,EAAA,EAAA,EAAI,IAAI,EAAE,CAAA;AAAA,UAC/B,wBAA0B,EAAA,KAAA;AAAA,UAC1B,QAAU,EAAA;AAAA,SACZ;AAAA,QACA,OAAA;AAAA,QACA,IAAA,EACE,kBACI,cAAe,CAAA,MAAA,EAAQ,gBAAgB,SAAS,CAAA,IAAK,EAAC,GACtD,EAAC;AAAA,QAEP,cAAgB,EAAA,CAAC,UACf,KAAA,qBAAA,CAAsB,UAAU;AAAA;AAAA;AAEpC,GAEJ,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import FormControl from '@material-ui/core/FormControl';
|
|
2
3
|
import InputLabel from '@material-ui/core/InputLabel';
|
|
3
4
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
4
5
|
import Select from '@material-ui/core/Select';
|
|
5
6
|
import { makeStyles, createStyles } from '@material-ui/core/styles';
|
|
6
|
-
import React from 'react';
|
|
7
7
|
|
|
8
8
|
const useStyles = makeStyles(
|
|
9
9
|
(theme) => createStyles({
|
|
@@ -18,7 +18,7 @@ const useStyles = makeStyles(
|
|
|
18
18
|
);
|
|
19
19
|
const renderItems = (items) => {
|
|
20
20
|
return items.map((item) => {
|
|
21
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ jsx(MenuItem, { value: item.value, children: item.label }, item.label);
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
const SelectComponent = ({
|
|
@@ -32,15 +32,17 @@ const SelectComponent = ({
|
|
|
32
32
|
const val = event.target.value;
|
|
33
33
|
onChange(val);
|
|
34
34
|
};
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ jsxs(
|
|
36
36
|
FormControl,
|
|
37
37
|
{
|
|
38
38
|
variant: "outlined",
|
|
39
39
|
className: classes.formControl,
|
|
40
|
-
disabled: items.length === 0
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
disabled: items.length === 0,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx(InputLabel, { children: label }),
|
|
43
|
+
/* @__PURE__ */ jsx(Select, { label, value, onChange: handleChange, children: renderItems(items) })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
44
46
|
);
|
|
45
47
|
};
|
|
46
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.esm.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport FormControl from '@material-ui/core/FormControl';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport React from 'react';\n\nexport type Item = {\n label: string;\n value: string | number;\n};\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n formControl: {\n margin: theme.spacing(1),\n minWidth: 120,\n },\n selectEmpty: {\n marginTop: theme.spacing(2),\n },\n }),\n);\n\ntype SelectComponentProps = {\n value: string;\n items: Item[];\n label: string;\n onChange: (value: string) => void;\n};\n\nconst renderItems = (items: Item[]) => {\n return items.map(item => {\n return (\n <MenuItem value={item.value} key={item.label}>\n {item.label}\n </MenuItem>\n );\n });\n};\n\nexport const SelectComponent = ({\n value,\n items,\n label,\n onChange,\n}: SelectComponentProps): JSX.Element => {\n const classes = useStyles();\n\n const handleChange = (event: React.ChangeEvent<{ value: unknown }>) => {\n const val = event.target.value as string;\n onChange(val);\n };\n\n return (\n <FormControl\n variant=\"outlined\"\n className={classes.formControl}\n disabled={items.length === 0}\n >\n <InputLabel>{label}</InputLabel>\n <Select label={label} value={value} onChange={handleChange}>\n {renderItems(items)}\n </Select>\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,WAAa,EAAA;AAAA,MACX,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACvB,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,WAAa,EAAA;AAAA,MACX,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAC5B,GACD;AACH,CAAA;AASA,MAAM,WAAA,GAAc,CAAC,KAAkB,KAAA;AACrC,EAAO,OAAA,KAAA,CAAM,IAAI,CAAQ,IAAA,KAAA;AACvB,IACE,uBAAA,
|
|
1
|
+
{"version":3,"file":"Select.esm.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport FormControl from '@material-ui/core/FormControl';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\nimport * as React from 'react';\n\nexport type Item = {\n label: string;\n value: string | number;\n};\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n formControl: {\n margin: theme.spacing(1),\n minWidth: 120,\n },\n selectEmpty: {\n marginTop: theme.spacing(2),\n },\n }),\n);\n\ntype SelectComponentProps = {\n value: string;\n items: Item[];\n label: string;\n onChange: (value: string) => void;\n};\n\nconst renderItems = (items: Item[]) => {\n return items.map(item => {\n return (\n <MenuItem value={item.value} key={item.label}>\n {item.label}\n </MenuItem>\n );\n });\n};\n\nexport const SelectComponent = ({\n value,\n items,\n label,\n onChange,\n}: SelectComponentProps): JSX.Element => {\n const classes = useStyles();\n\n const handleChange = (event: React.ChangeEvent<{ value: unknown }>) => {\n const val = event.target.value as string;\n onChange(val);\n };\n\n return (\n <FormControl\n variant=\"outlined\"\n className={classes.formControl}\n disabled={items.length === 0}\n >\n <InputLabel>{label}</InputLabel>\n <Select label={label} value={value} onChange={handleChange}>\n {renderItems(items)}\n </Select>\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CA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
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-gocd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A Backstage plugin that integrates towards GoCD",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@backstage/catalog-model": "^1.7.3",
|
|
42
|
-
"@backstage/core-components": "^0.17.
|
|
43
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
42
|
+
"@backstage/core-components": "^0.17.1",
|
|
43
|
+
"@backstage/core-plugin-api": "^1.10.6",
|
|
44
44
|
"@backstage/errors": "^1.2.7",
|
|
45
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
45
|
+
"@backstage/plugin-catalog-react": "^1.17.0",
|
|
46
46
|
"@material-ui/core": "^4.12.2",
|
|
47
47
|
"@material-ui/icons": "^4.9.1",
|
|
48
48
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"react-use": "^17.2.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@backstage/cli": "^0.
|
|
56
|
-
"@backstage/core-app-api": "^1.16.
|
|
57
|
-
"@backstage/dev-utils": "^1.1.
|
|
58
|
-
"@backstage/test-utils": "^1.7.
|
|
55
|
+
"@backstage/cli": "^0.32.0",
|
|
56
|
+
"@backstage/core-app-api": "^1.16.1",
|
|
57
|
+
"@backstage/dev-utils": "^1.1.9",
|
|
58
|
+
"@backstage/test-utils": "^1.7.7",
|
|
59
59
|
"@testing-library/dom": "^10.0.0",
|
|
60
60
|
"@testing-library/jest-dom": "^6.0.0",
|
|
61
61
|
"@testing-library/react": "^15.0.0",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"@types/luxon": "^3.0.0",
|
|
65
65
|
"@types/react": "^16.13.1 || ^17.0.0",
|
|
66
66
|
"@types/react-dom": "^18.2.19",
|
|
67
|
-
"canvas": "^2.11.2",
|
|
68
67
|
"msw": "^2.0.0",
|
|
69
68
|
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
70
69
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
@@ -83,5 +82,12 @@
|
|
|
83
82
|
]
|
|
84
83
|
}
|
|
85
84
|
},
|
|
85
|
+
"typesVersions": {
|
|
86
|
+
"*": {
|
|
87
|
+
"package.json": [
|
|
88
|
+
"package.json"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
86
92
|
"module": "./dist/index.esm.js"
|
|
87
93
|
}
|