INFRA-3279 | add perf and dataplatform support

This commit is contained in:
dhruvjoshi
2024-05-27 16:36:48 +05:30
parent f8d3a2c511
commit 67dae12ff9
4 changed files with 55 additions and 42 deletions

View File

@@ -51,8 +51,11 @@ export const getCardName = {
build: 'Build',
dev: 'Dev',
qa: 'Qa',
perf: 'Perf',
uat: 'Uat',
prod: 'Prod',
'data-platform-nonprod': 'Data Platform Non Prod',
'data-platform-prod': 'Data Platform Prod',
};
export const approvalTypes = ['success', 'manual'];
export const stageMap = {

View File

@@ -8,28 +8,20 @@ export enum Upstream {
UAT = 'uat',
PREF = 'perf',
PROD = 'prod',
CMD = 'cmd',
DATA_PLATFORM_PROD = 'data-platform-prod',
DATA_PLATFORM_NONPROD = 'data-platform-nonprod',
}
export const upstreamMap = {
[Environment.PROD]: [Upstream.BUILD, Upstream.DEV, Upstream.QA, Upstream.UAT],
[Environment.CMD]: [Upstream.BUILD, Upstream.DEV, Upstream.QA, Upstream.UAT],
[Environment.PROD]: [Upstream.BUILD, Upstream.DEV, Upstream.QA],
[Environment.CMD]: [Upstream.BUILD],
[Environment.DEV]: [Upstream.BUILD],
[Environment.QA]: [Upstream.BUILD, Upstream.DEV],
[Environment.PERF]: [Upstream.BUILD, Upstream.DEV, Upstream.QA, Upstream.UAT],
[Environment.PERF]: [Upstream.BUILD],
[Environment.UAT]: [Upstream.BUILD, Upstream.DEV, Upstream.QA],
[Environment.DATA_PLATFORM_PROD]: [Upstream.BUILD, Upstream.DEV, Upstream.QA, Upstream.UAT],
[Environment.DATA_PLATFORM_NONPROD]: [Upstream.BUILD, Upstream.DEV],
};
export const pipelineMap = {
[Environment.PROD]: Upstream.PROD,
[Environment.CMD]: Upstream.PROD,
[Environment.DEV]: Upstream.DEV,
[Environment.QA]: Upstream.QA,
[Environment.PERF]: Upstream.PREF,
[Environment.UAT]: Upstream.UAT,
[Environment.DATA_PLATFORM_PROD]: Upstream.PROD,
[Environment.DATA_PLATFORM_NONPROD]: Upstream.QA,
[Environment.DATA_PLATFORM_PROD]: [Upstream.BUILD, Upstream.DATA_PLATFORM_NONPROD],
[Environment.DATA_PLATFORM_NONPROD]: [Upstream.BUILD],
};
export const resourceMap = [
@@ -46,9 +38,12 @@ export const upstreamOrder = {
[Upstream.BUILD]: 2,
[Upstream.DEV]: 3,
[Upstream.QA]: 4,
[Upstream.PREF]: 4,
[Upstream.DATA_PLATFORM_NONPROD]: 4,
[Upstream.UAT]: 5,
[Upstream.PREF]: 6,
[Upstream.PROD]: 7,
[Upstream.DATA_PLATFORM_PROD]: 6,
[Upstream.CMD]: 6,
[Upstream.PROD]: 6,
};
export const approvalTypeMap = {
@@ -56,20 +51,35 @@ export const approvalTypeMap = {
build: 'success',
dev: 'manual',
qa: 'manual',
perf: 'manual',
uat: 'manual',
prod: 'manual',
cmd: 'manual',
'data-platform-nonprod': 'manual',
'data-platform-prod': 'manual',
};
export const whitelistedEnvForPipelineGeneration = new Set([
Environment.DEV,
Environment.QA,
Environment.PERF,
Environment.UAT,
Environment.DATA_PLATFORM_NONPROD,
Environment.DATA_PLATFORM_PROD,
Environment.CMD,
Environment.PROD,
]);
export const API_PIPELINE_MANIFEST = '/api/pipelines';
export const githubRepoTooltipText =
'Specify the GitHub repository to be used as the git material for the current pipeline and its associated resources.';
'GitHub repository to be used as the git material for the current pipeline and its associated resources.';
export const upstreamTooltipText =
"A build pipeline is automatically created when selected as an upstream for the first time, using the current pipeline's repository as git material. This build pipeline cannot be removed, and only one build pipeline is allowed per service";
'Pipelines are added in the order of the checkboxes. A build pipeline is created when selected as upstream for the first time. Only one build pipeline per service is allowed and it cannot be edited once created.';
export const resourcePipelineTooltipText =
"Selecting resources will create pipelines using the current pipeline's repository in git material. Any changes to the repo name will update all resources in the current pipeline to use the new repository. Unselecting resources will automatically remove their corresponding pipelines.";
'Creates pipelines for selected resources. Unselecting resources removes their pipelines.';
export const testPipelineTooltipText =
"The test pipeline cannot be used as an upstream pipeline. It will be automatically created using the current pipeline's repository as git material. Once created, it cannot be removed.";
'For the time being test pipeline needs to be created manually.';

View File

@@ -5,7 +5,7 @@ import { Check as CheckIcon, Close as CloseIcon } from '@material-ui/icons';
import './GeneratePipeline.module.css';
import PipelineCard from './PipelineCard';
import { pipelineMap } from '@src/constants/Pipeline';
import { whitelistedEnvForPipelineGeneration } from '@src/constants/Pipeline';
interface GeneratePipelineProp {
manifestName: string;
@@ -34,7 +34,7 @@ const GeneratePipeline: React.FC<GeneratePipelineProp> = (props: GeneratePipelin
onClick={() => {
setOpenDialog(true);
}}
disabled={!manifestId}
disabled={!manifestId || !whitelistedEnvForPipelineGeneration.has(environment)}
>
Generate Pipeline
</Button>
@@ -44,7 +44,7 @@ const GeneratePipeline: React.FC<GeneratePipelineProp> = (props: GeneratePipelin
<DialogContent>
<PipelineCard
manifestRepoName={manifestRepoName}
environment={pipelineMap[environment]}
environment={environment}
formSubmitButtonRef={formSubmitButtonRef}
manifestName={manifestName}
manifestId={manifestId}

View File

@@ -174,6 +174,7 @@ export const PipelineCard: FC<PipelineCardProps> = (props: PipelineCardProps) =>
fullWidth
variant="standard"
className="repo"
disabled={true}
/>
<TitleWithTooltip
title="Select upstream pipelines"
@@ -220,26 +221,25 @@ export const PipelineCard: FC<PipelineCardProps> = (props: PipelineCardProps) =>
))}
</div>
</div>
{!skipTextPipelineCheckBox && (
<div>
<TitleWithTooltip
title="Test pipeline"
tooltipText={_p.testPipelineTooltipText}
className="title-with-tooltip"
/>
<div>
<TitleWithTooltip
title="Test pipeline"
tooltipText={_p.testPipelineTooltipText}
className="title-with-tooltip"
<FormControlLabel
control={
<Checkbox
onChange={handleTestPipelineSelectionChange}
checked={includeTestPipeline}
disabled={skipTextPipelineCheckBox}
/>
}
label="Include test pipeline"
/>
<div>
<FormControlLabel
control={
<Checkbox
onChange={handleTestPipelineSelectionChange}
checked={includeTestPipeline}
/>
}
label="Include test pipeline"
/>
</div>
</div>
)}
</div>
</>
</Formik>
);