diff --git a/src/components/CIPipelineN/CIPipeline.tsx b/src/components/CIPipelineN/CIPipeline.tsx
index afe4615281..b3c0b6af18 100644
--- a/src/components/CIPipelineN/CIPipeline.tsx
+++ b/src/components/CIPipelineN/CIPipeline.tsx
@@ -790,6 +790,7 @@ export default function CIPipeline({
sharedPlugins={sharedPlugins}
isJobView={isJobCard}
mandatoryPluginsMap={mandatoryPluginsMap}
+ isSecurityModuleInstalled={isSecurityModuleInstalled}
/>
)}
@@ -799,6 +800,7 @@ export default function CIPipeline({
presetPlugins={presetPlugins}
sharedPlugins={sharedPlugins}
mandatoryPluginsMap={mandatoryPluginsMap}
+ isSecurityModuleInstalled={isSecurityModuleInstalled}
/>
)}
diff --git a/src/components/CIPipelineN/PluginCardListContainer.tsx b/src/components/CIPipelineN/PluginCardListContainer.tsx
index da74462e21..9177c2601e 100644
--- a/src/components/CIPipelineN/PluginCardListContainer.tsx
+++ b/src/components/CIPipelineN/PluginCardListContainer.tsx
@@ -1,11 +1,13 @@
import React from 'react'
import { PluginType, PluginDetailType, VariableType } from '@devtron-labs/devtron-fe-common-lib'
import { PluginCard } from './PluginCard'
+import { VulnerabilityScanning } from './ciPipeline.utils'
export function PluginCardListContainer({
pluginListTitle,
pluginList,
setPluginType,
+ isSecurityModuleInstalled
}: {
pluginListTitle: string
pluginList: PluginDetailType[]
@@ -17,6 +19,7 @@ export function PluginCardListContainer({
inputVariables: VariableType[],
outputVariables: VariableType[],
) => void
+ isSecurityModuleInstalled: boolean
}) {
return (
pluginList.length > 0 && (
@@ -24,29 +27,32 @@ export function PluginCardListContainer({
{pluginListTitle}
- {pluginList.map((pluginDetails) => (
-
- setPluginType(
- PluginType.PLUGIN_REF,
- pluginDetails.id,
- pluginDetails.name,
- pluginDetails.description,
- pluginDetails.inputVariables ?? [],
- pluginDetails.outputVariables ?? [],
- )
- }
- >
-
-
- ))}
+ {pluginList.map(
+ (pluginDetails) =>
+ (pluginDetails.name !== VulnerabilityScanning || isSecurityModuleInstalled) && (
+
+ setPluginType(
+ PluginType.PLUGIN_REF,
+ pluginDetails.id,
+ pluginDetails.name,
+ pluginDetails.description,
+ pluginDetails.inputVariables ?? [],
+ pluginDetails.outputVariables ?? [],
+ )
+ }
+ >
+
+
+ ),
+ )}
)
)
diff --git a/src/components/CIPipelineN/PreBuild.tsx b/src/components/CIPipelineN/PreBuild.tsx
index 26b762a996..e0be89251f 100644
--- a/src/components/CIPipelineN/PreBuild.tsx
+++ b/src/components/CIPipelineN/PreBuild.tsx
@@ -25,7 +25,7 @@ import { importComponentFromFELibrary } from '../common'
import { pipelineContext } from '../workflowEditor/workflowEditor'
const isRequired = importComponentFromFELibrary('isRequired', null, 'function')
-export function PreBuild({ presetPlugins, sharedPlugins, mandatoryPluginsMap, isJobView }: PreBuildType) {
+export function PreBuild({ presetPlugins, sharedPlugins, mandatoryPluginsMap, isJobView, isSecurityModuleInstalled}: PreBuildType) {
const {
formData,
isCdPipeline,
@@ -151,11 +151,13 @@ export function PreBuild({ presetPlugins, sharedPlugins, mandatoryPluginsMap, is
setPluginType={setPluginType}
pluginListTitle="PRESET PLUGINS"
pluginList={presetPlugins}
+ isSecurityModuleInstalled={isSecurityModuleInstalled}
/>
>
)
diff --git a/src/components/CIPipelineN/ciPipeline.utils.ts b/src/components/CIPipelineN/ciPipeline.utils.ts
index b35f0bd8a9..63706ab1ba 100644
--- a/src/components/CIPipelineN/ciPipeline.utils.ts
+++ b/src/components/CIPipelineN/ciPipeline.utils.ts
@@ -261,3 +261,5 @@ export const reactSelectStyles = {
}
},
}
+
+export const VulnerabilityScanning = 'Vulnerability Scanning'
\ No newline at end of file
diff --git a/src/components/cdPipeline/NewCDPipeline.tsx b/src/components/cdPipeline/NewCDPipeline.tsx
index 9084b68108..b1c12af067 100644
--- a/src/components/cdPipeline/NewCDPipeline.tsx
+++ b/src/components/cdPipeline/NewCDPipeline.tsx
@@ -16,7 +16,7 @@ import {
import React, { useEffect, useMemo, useRef, useState } from 'react'
import { ReactComponent as Close } from '../../assets/icons/ic-close.svg'
import { NavLink, Redirect, Route, Switch, useParams, useRouteMatch } from 'react-router-dom'
-import { CDDeploymentTabText, DELETE_ACTION, SourceTypeMap, TriggerType, ViewType } from '../../config'
+import { CDDeploymentTabText, DELETE_ACTION, ModuleNameMap, SourceTypeMap, TriggerType, ViewType } from '../../config'
import { ButtonWithLoader, FloatingVariablesSuggestions, sortObjectArrayAlphabetically } from '../common'
import BuildCD from './BuildCD'
import { CD_PATCH_ACTION, Environment, GeneratedHelmPush } from './cdPipeline.types'
@@ -52,6 +52,8 @@ import { calculateLastStepDetailsLogic, checkUniqueness, validateTask } from './
import { pipelineContext } from '../workflowEditor/workflowEditor'
import { PipelineFormDataErrorType, PipelineFormType } from '../workflowEditor/types'
import { getDockerRegistryMinAuth } from '../ciConfig/service'
+import { getModuleInfo } from '../v2/devtronStackManager/DevtronStackManager.service'
+import { ModuleStatus } from '../v2/devtronStackManager/DevtronStackManager.type'
export enum deleteDialogType {
showForceDeleteDialog = 'showForceDeleteDialog',
@@ -176,6 +178,8 @@ export default function NewCDPipeline({
preBuildStage: Map[]
postBuildStage: Map[]
}>({ preBuildStage: [], postBuildStage: [] })
+ const [isSecurityModuleInstalled, setSecurityModuleInstalled] = useState(false)
+
useEffect(() => {
getInit()
@@ -195,6 +199,7 @@ export default function NewCDPipeline({
}
const getInit = () => {
+ getSecurityModuleStatus()
Promise.all([
getDeploymentStrategyList(appId),
getGlobalVariable(Number(appId), true),
@@ -276,6 +281,15 @@ export default function NewCDPipeline({
})
}
+ const getSecurityModuleStatus = async (): Promise => {
+ try {
+ const { result } = await getModuleInfo(ModuleNameMap.SECURITY)
+ if (result?.status === ModuleStatus.INSTALLED) {
+ setSecurityModuleInstalled(true)
+ }
+ } catch (error) {}
+ }
+
const calculateLastStepDetail = (
isFromAddNewTask: boolean,
_formData: PipelineFormType,
@@ -1028,12 +1042,12 @@ export default function NewCDPipeline({
{isAdvanced && (
-
+
)}
{isAdvanced && (
-
+
)}
diff --git a/src/components/ciPipeline/types.ts b/src/components/ciPipeline/types.ts
index 66ce93fef0..b7608c64a5 100644
--- a/src/components/ciPipeline/types.ts
+++ b/src/components/ciPipeline/types.ts
@@ -397,6 +397,7 @@ export interface PreBuildType {
sharedPlugins: PluginDetailType[]
mandatoryPluginsMap?: Record
isJobView?: boolean
+ isSecurityModuleInstalled?: boolean
}
export enum CIPipelineBuildType {