From f7888f48a656f70e9b63d1ccb7971c63bc63ca63 Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:10:14 +0530 Subject: [PATCH 1/9] feat: enable mandatory plugin for Job CI --- src/components/CIPipelineN/CIPipeline.tsx | 2 +- src/components/CIPipelineN/Sidebar.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/CIPipelineN/CIPipeline.tsx b/src/components/CIPipelineN/CIPipeline.tsx index febf893a01..7981306bcf 100644 --- a/src/components/CIPipelineN/CIPipeline.tsx +++ b/src/components/CIPipelineN/CIPipeline.tsx @@ -241,7 +241,7 @@ export default function CIPipeline({ } } - const areMandatoryPluginPossible = !isJobCard && !!processPluginData + const areMandatoryPluginPossible = !!processPluginData // NOTE: Wrap this method in try catch block to handle error const getMandatoryPluginData = async ( diff --git a/src/components/CIPipelineN/Sidebar.tsx b/src/components/CIPipelineN/Sidebar.tsx index 2c920cd56c..5593cd2a31 100644 --- a/src/components/CIPipelineN/Sidebar.tsx +++ b/src/components/CIPipelineN/Sidebar.tsx @@ -89,7 +89,6 @@ export const Sidebar = ({ const showMandatoryWarning = (): boolean => { return ( !!MandatoryPluginWarning && - !isJobCard && mandatoryPluginData && ((isPreBuildTab && !mandatoryPluginData.isValidPre) || (activeStageName === BuildStageVariable.PostBuild && !mandatoryPluginData.isValidPost)) From 834665610d1550615cd34f3b4053b87ff78c1d7c Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:53:10 +0530 Subject: [PATCH 2/9] feat: add prop for isJobView in MissingPluginBlockState --- src/components/CIPipelineN/CIPipeline.tsx | 2 +- src/components/cdPipeline/types.ts | 2 +- src/components/common/GitInfoMaterial.tsx | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/CIPipelineN/CIPipeline.tsx b/src/components/CIPipelineN/CIPipeline.tsx index 7981306bcf..ea57a6cf10 100644 --- a/src/components/CIPipelineN/CIPipeline.tsx +++ b/src/components/CIPipelineN/CIPipeline.tsx @@ -249,7 +249,7 @@ export default function CIPipeline({ /** * ids required to fetch in case we have a plugin in step */ - requiredPluginIds?: PluginDetailPayloadType['pluginId'], + requiredPluginIds?: PluginDetailPayloadType['pluginIds'], ): Promise => { if (areMandatoryPluginPossible) { let branchName = '' diff --git a/src/components/cdPipeline/types.ts b/src/components/cdPipeline/types.ts index 0c469debe9..82548b0211 100644 --- a/src/components/cdPipeline/types.ts +++ b/src/components/cdPipeline/types.ts @@ -78,6 +78,6 @@ export interface BuildCDProps releaseMode: ReleaseMode getMandatoryPluginData: ( form: PipelineFormType, - requiredPluginIds?: PluginDetailPayloadType['pluginId'], + requiredPluginIds?: PluginDetailPayloadType['pluginIds'], ) => Promise } diff --git a/src/components/common/GitInfoMaterial.tsx b/src/components/common/GitInfoMaterial.tsx index 2edaf82654..fd6b418c58 100644 --- a/src/components/common/GitInfoMaterial.tsx +++ b/src/components/common/GitInfoMaterial.tsx @@ -448,7 +448,11 @@ export default function GitInfoMaterial({ <> {(!fromBulkCITrigger || showWebhookModal) && renderMaterialHeader()} {MissingPluginBlockState && isCITriggerBlocked ? ( - + ) : (
{showWebhookModal == true ? ( From ce08d6bf2843bf5210832a2a8f62c4b3aed6a5b9 Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:03:10 +0530 Subject: [PATCH 3/9] feat: show the allowed with warning tippy for job ci --- .../app/details/triggerView/ciMaterial.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/app/details/triggerView/ciMaterial.tsx b/src/components/app/details/triggerView/ciMaterial.tsx index a3e41ed7d2..d6d1b1d409 100644 --- a/src/components/app/details/triggerView/ciMaterial.tsx +++ b/src/components/app/details/triggerView/ciMaterial.tsx @@ -230,6 +230,7 @@ class CIMaterial extends Component { showTriggerButton onTrigger={this.handleStartBuildAction} nodeType={nodeType} + isJobView={this.props.isJobCI} > { isLoading={this.props.isLoading} onClick={noop} > - - Start Build + {this.props.isJobCI ? ( + <> + + Run Job + + ) : ( + <> + + Start Build + + )} ) From c53e81ae48ad5ddd7554bea54e07a1836fc8c116 Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:04:49 +0530 Subject: [PATCH 4/9] fix: condition for job ci --- src/components/CIPipelineN/Sidebar.tsx | 2 ++ src/components/common/GitInfoMaterial.tsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/CIPipelineN/Sidebar.tsx b/src/components/CIPipelineN/Sidebar.tsx index 5593cd2a31..ff537a5533 100644 --- a/src/components/CIPipelineN/Sidebar.tsx +++ b/src/components/CIPipelineN/Sidebar.tsx @@ -89,6 +89,8 @@ export const Sidebar = ({ const showMandatoryWarning = (): boolean => { return ( !!MandatoryPluginWarning && + // mandatory plugins are applicable for Job CI but not Jobs + !isJobView && mandatoryPluginData && ((isPreBuildTab && !mandatoryPluginData.isValidPre) || (activeStageName === BuildStageVariable.PostBuild && !mandatoryPluginData.isValidPost)) diff --git a/src/components/common/GitInfoMaterial.tsx b/src/components/common/GitInfoMaterial.tsx index fd6b418c58..a83049246f 100644 --- a/src/components/common/GitInfoMaterial.tsx +++ b/src/components/common/GitInfoMaterial.tsx @@ -451,7 +451,7 @@ export default function GitInfoMaterial({ ) : (
From 938f862e2f934f17cfcfc629aaab92c6c9332306 Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:12:35 +0530 Subject: [PATCH 5/9] chore: bump common --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 18aae6ceb8..9430d04f8d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "homepage": "/dashboard", "dependencies": { - "@devtron-labs/devtron-fe-common-lib": "0.6.4-beta-3", + "@devtron-labs/devtron-fe-common-lib": "0.6.4-beta-6", "@esbuild-plugins/node-globals-polyfill": "0.2.3", "@rjsf/core": "^5.13.3", "@rjsf/utils": "^5.13.3", diff --git a/yarn.lock b/yarn.lock index 03901f26d8..961894b9c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1061,10 +1061,10 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@devtron-labs/devtron-fe-common-lib@0.6.4-beta-3": - version "0.6.4-beta-3" - resolved "https://registry.yarnpkg.com/@devtron-labs/devtron-fe-common-lib/-/devtron-fe-common-lib-0.6.4-beta-3.tgz#9bb11fa44fad5e529a3fe226a75a93991db58938" - integrity sha512-x1cu6NVN+cXkQMTjXYEahdCIh/sSUUh8dTY78chUDA79N+r1uwiyoR4nNFBq5WZFe8xF2NEmnffrmTIXa5oDCQ== +"@devtron-labs/devtron-fe-common-lib@0.6.4-beta-6": + version "0.6.4-beta-6" + resolved "https://registry.yarnpkg.com/@devtron-labs/devtron-fe-common-lib/-/devtron-fe-common-lib-0.6.4-beta-6.tgz#45aa768000944d367a5615ea9760fb72ebb9f114" + integrity sha512-cHNj+FPiHHJk5SYZOSUUo0Jx7FH4AFLt5+DdDVI4+PntXSkPPb6/1pce8YHXYQOUhzyEnRF1kgxbCykqR+KFRA== dependencies: "@types/react-dates" "^21.8.6" ansi_up "^5.2.1" From 9deb98b252973e83a37b53ce56e74825516a2760 Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:16:55 +0530 Subject: [PATCH 6/9] fix: condition for areMandatoryPluginPossible --- src/components/CIPipelineN/CIPipeline.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/CIPipelineN/CIPipeline.tsx b/src/components/CIPipelineN/CIPipeline.tsx index ea57a6cf10..a0496e2dba 100644 --- a/src/components/CIPipelineN/CIPipeline.tsx +++ b/src/components/CIPipelineN/CIPipeline.tsx @@ -241,7 +241,8 @@ export default function CIPipeline({ } } - const areMandatoryPluginPossible = !!processPluginData + // mandatory plugins are applicable for job ci but not jobs + const areMandatoryPluginPossible = !isJobView && !!processPluginData // NOTE: Wrap this method in try catch block to handle error const getMandatoryPluginData = async ( From dd79a4e7772d27cb7ced211fb480d00fce8c2663 Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:25:19 +0530 Subject: [PATCH 7/9] refactor: use getEnvironmentListMinPublic from common lib --- src/components/app/details/triggerView/TriggerView.tsx | 3 ++- src/components/cdPipeline/CDPipeline.tsx | 2 +- src/components/cdPipeline/cdPipeline.service.ts | 4 ++-- src/components/security/SecurityPolicyEnvironment.tsx | 10 ++++++++-- src/services/service.ts | 9 --------- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/components/app/details/triggerView/TriggerView.tsx b/src/components/app/details/triggerView/TriggerView.tsx index 32b33e687a..7478b4065c 100644 --- a/src/components/app/details/triggerView/TriggerView.tsx +++ b/src/components/app/details/triggerView/TriggerView.tsx @@ -33,6 +33,7 @@ import { ToastVariantType, TOAST_ACCESS_DENIED, BlockedStateData, + getEnvironmentListMinPublic, } from '@devtron-labs/devtron-fe-common-lib' import ReactGA from 'react-ga4' import { withRouter, NavLink, Route, Switch } from 'react-router-dom' @@ -65,7 +66,7 @@ import { NO_COMMIT_SELECTED, } from '../../../../config' import { AppNotConfigured } from '../appDetails/AppDetails' -import { getEnvironmentListMinPublic, getHostURLConfiguration } from '../../../../services/service' +import { getHostURLConfiguration } from '../../../../services/service' import { ReactComponent as ICError } from '../../../../assets/icons/ic-error-exclamation.svg' import { ReactComponent as CloseIcon } from '../../../../assets/icons/ic-close.svg' import { getCIWebhookRes } from './ciWebhook.service' diff --git a/src/components/cdPipeline/CDPipeline.tsx b/src/components/cdPipeline/CDPipeline.tsx index fd522f3338..34b1a61c56 100644 --- a/src/components/cdPipeline/CDPipeline.tsx +++ b/src/components/cdPipeline/CDPipeline.tsx @@ -48,6 +48,7 @@ import { ProcessPluginDataParamsType, ProcessPluginDataReturnType, ResourceKindType, + getEnvironmentListMinPublic, } from '@devtron-labs/devtron-fe-common-lib' import { useEffect, useMemo, useRef, useState } from 'react' import { Redirect, Route, Switch, useParams, useRouteMatch } from 'react-router-dom' @@ -71,7 +72,6 @@ import { saveCDPipeline, updateCDPipeline, } from './cdPipeline.service' -import { getEnvironmentListMinPublic } from '../../services/service' import { Sidebar } from '../CIPipelineN/Sidebar' import DeleteCDNode from './DeleteCDNode' import { PreBuild } from '../CIPipelineN/PreBuild' diff --git a/src/components/cdPipeline/cdPipeline.service.ts b/src/components/cdPipeline/cdPipeline.service.ts index cb8a84daae..c798784e22 100644 --- a/src/components/cdPipeline/cdPipeline.service.ts +++ b/src/components/cdPipeline/cdPipeline.service.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import { post, get, sortCallback } from '@devtron-labs/devtron-fe-common-lib' +import { post, get, sortCallback, getEnvironmentListMinPublic } from '@devtron-labs/devtron-fe-common-lib' import { Routes, TriggerType } from '../../config' -import { getEnvironmentSecrets, getEnvironmentListMinPublic, getEnvironmentConfigs } from '../../services/service' +import { getEnvironmentSecrets, getEnvironmentConfigs } from '../../services/service' export function getCDPipelineNameSuggestion(appId: string | number): Promise { const URL = `app/pipeline/suggest/cd/${appId}` diff --git a/src/components/security/SecurityPolicyEnvironment.tsx b/src/components/security/SecurityPolicyEnvironment.tsx index 1f42232edb..07ba08b48b 100644 --- a/src/components/security/SecurityPolicyEnvironment.tsx +++ b/src/components/security/SecurityPolicyEnvironment.tsx @@ -16,9 +16,15 @@ import React, { Component } from 'react' import { RouteComponentProps, NavLink } from 'react-router-dom' -import { showError, Progressing, sortCallback, Reload, SearchBar } from '@devtron-labs/devtron-fe-common-lib' +import { + showError, + Progressing, + sortCallback, + Reload, + SearchBar, + getEnvironmentListMinPublic, +} from '@devtron-labs/devtron-fe-common-lib' import { SecurityPolicyEdit } from './SecurityPolicyEdit' -import { getEnvironmentListMinPublic } from '../../services/service' import { ViewType } from '../../config' import { SecurityPolicyEnvironmentState } from './security.types' diff --git a/src/services/service.ts b/src/services/service.ts index 1471d3f1e8..fe332489ca 100644 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -219,15 +219,6 @@ export const getAppFilters = (): Promise> => }, })) -/** - * @deprecated Use getEnvironmentListMinPublic form common lib instead - */ -export function getEnvironmentListMinPublic(includeAllowedDeploymentTypes?: boolean) { - return get( - `${Routes.ENVIRONMENT_LIST_MIN}?auth=false${includeAllowedDeploymentTypes ? '&showDeploymentOptions=true' : ''}`, - ) -} - export function getDockerRegistryStatus(isStorageActionPush?: boolean): Promise { const URL = `${Routes.DOCKER_REGISTRY_CONFIG}/configure/status${isStorageActionPush ? '?storageType=CHART&storageAction=PUSH' : ''}` return get(URL) From 34a1afc594b7ff1beb80299181973faf08dd4c62 Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:27:11 +0530 Subject: [PATCH 8/9] fix: check for branch names in policy enforcement --- .../ApplicationGroup/Details/TriggerView/BulkCITrigger.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/ApplicationGroup/Details/TriggerView/BulkCITrigger.tsx b/src/components/ApplicationGroup/Details/TriggerView/BulkCITrigger.tsx index af74c1953e..03e63a5116 100644 --- a/src/components/ApplicationGroup/Details/TriggerView/BulkCITrigger.tsx +++ b/src/components/ApplicationGroup/Details/TriggerView/BulkCITrigger.tsx @@ -249,7 +249,9 @@ const BulkCITrigger = ({ } } - return () => getCIBlockState(appDetails.ciPipelineId, appDetails.appId, branchNames, appDetails.name) + return !branchNames + ? () => null + : () => getCIBlockState(appDetails.ciPipelineId, appDetails.appId, branchNames, appDetails.name) }) if (policyPromiseFunctionList?.length) { From 24e7e304225087b7dd6a14ea229a6c5200d8f0b4 Mon Sep 17 00:00:00 2001 From: Eshank Vaish <48060426+eshankvaish@users.noreply.github.com> Date: Tue, 12 Nov 2024 17:34:16 +0530 Subject: [PATCH 9/9] fix: redirection issue in cd material --- src/components/app/details/triggerView/cdMaterial.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/app/details/triggerView/cdMaterial.tsx b/src/components/app/details/triggerView/cdMaterial.tsx index 8fa41f5082..4b50cbdfb5 100644 --- a/src/components/app/details/triggerView/cdMaterial.tsx +++ b/src/components/app/details/triggerView/cdMaterial.tsx @@ -348,7 +348,9 @@ const CDMaterial = ({ abortDeployRef.current = new AbortController() return () => { abortDeployRef.current.abort() - history.replace(pathname.split(URLS.APP_DIFF_VIEW)[0]) + if (history.location.pathname.includes(URLS.APP_DIFF_VIEW)) { + history.replace(history.location.pathname.split(URLS.APP_DIFF_VIEW)[0]) + } } }, [])