From 5ae416afad74256a7f96f3655f8989430992b136 Mon Sep 17 00:00:00 2001 From: Sergey Smolnikov Date: Mon, 11 Nov 2024 12:54:30 +0100 Subject: [PATCH] Specify env for build deploy pipeline job dev (#1126) * Added environment selector for build-deploy * Fixed environment info for env, select branch env --- docker-compose-host-macos.yml | 2 - docker-compose-host.yml | 2 - docker-compose.yml | 2 - .../pipeline-form-build-branches.tsx | 66 +++++++++++++++---- .../create-job-form/target-envs.tsx | 6 +- src/components/job-overview/index.tsx | 31 +++++++-- .../page-environment/environment-overview.tsx | 2 +- src/store/radix-api.ts | 6 ++ 8 files changed, 85 insertions(+), 32 deletions(-) diff --git a/docker-compose-host-macos.yml b/docker-compose-host-macos.yml index 46863fd0a..43bf51ead 100644 --- a/docker-compose-host-macos.yml +++ b/docker-compose-host-macos.yml @@ -1,5 +1,3 @@ -version: "3.8" - services: web: image: node:20.9-alpine diff --git a/docker-compose-host.yml b/docker-compose-host.yml index 81fdd1a5f..80f91bad0 100644 --- a/docker-compose-host.yml +++ b/docker-compose-host.yml @@ -1,5 +1,3 @@ -version: "3.8" - services: web: image: node:20.9-alpine diff --git a/docker-compose.yml b/docker-compose.yml index cef8d7bb6..eaad12527 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.8" - services: web: image: node:20.9-alpine diff --git a/src/components/create-job-form/pipeline-form-build-branches.tsx b/src/components/create-job-form/pipeline-form-build-branches.tsx index 03477a885..d640e2184 100644 --- a/src/components/create-job-form/pipeline-form-build-branches.tsx +++ b/src/components/create-job-form/pipeline-form-build-branches.tsx @@ -32,6 +32,7 @@ export function PipelineFormBuildBranches({ const [branch, setBranch] = useState(''); const [selectedBranch, setSelectedBranch] = useState(''); const [branchFullName, setBranchFullName] = useState(''); + const [toEnvironment, setToEnvironment] = useState(''); const branches = useGetApplicationBranches(appName); const handleOnTextChange = ({ @@ -54,7 +55,7 @@ export function PipelineFormBuildBranches({ const body = { appName, - pipelineParametersBuild: { branch }, + pipelineParametersBuild: { branch, toEnvironment }, }; let jobName = ''; if (pipelineName === 'build-deploy') { @@ -102,22 +103,59 @@ export function PipelineFormBuildBranches({ ))} {isAnyValidRegex(selectedBranch) && ( -
- -
+ <> + + Git branch full name + +
+ +
+ )} - {pipelineName === 'build-deploy' && ( + {selectedBranch && branches[selectedBranch]?.length > 1 && ( +
+ + Environment (optional) + + setToEnvironment(e.target.value)} + value={toEnvironment} + > + + {branches[selectedBranch]?.map((envName) => ( + + ))} + +
+ )} + {pipelineName === 'build-deploy' && branches && selectedBranch && ( )} diff --git a/src/components/create-job-form/target-envs.tsx b/src/components/create-job-form/target-envs.tsx index ece711229..4754334f1 100644 --- a/src/components/create-job-form/target-envs.tsx +++ b/src/components/create-job-form/target-envs.tsx @@ -2,12 +2,10 @@ import { Typography } from '@equinor/eds-core-react'; import { Fragment } from 'react'; type Props = { - selectedBranch?: string; - branches: Record>; + targetEnvs: Array; branch?: string; }; -export function TargetEnvs({ selectedBranch, branches, branch }: Props) { - const targetEnvs = branches[selectedBranch] || []; +export function TargetEnvs({ targetEnvs, branch }: Props) { const penultimateId = targetEnvs.length - 2; return targetEnvs.length > 0 ? ( diff --git a/src/components/job-overview/index.tsx b/src/components/job-overview/index.tsx index 726cac347..75e94676c 100644 --- a/src/components/job-overview/index.tsx +++ b/src/components/job-overview/index.tsx @@ -240,6 +240,30 @@ export const JobOverview = ({ appName, jobName }: Props) => { )} + {job.branch && ( +
+ + Branch {job.branch} + +
+ )} + {job.deployedToEnvironment && ( +
+ + Environment{' '} + + {job.deployedToEnvironment} + + +
+ )} Triggered by {job.triggeredBy || 'N/A'} {job.commitID && ( @@ -315,13 +339,6 @@ export const JobOverview = ({ appName, jobName }: Props) => { ))} - {job.branch && ( -
- - Branch {job.branch} - -
- )} {job.components && ( Environment {envName} - {environment.branchMapping ? ( + {environment.branchMapping && environment.activeDeployment ? ( Built and deployed from{' '}