Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cb65b13
feat: add flag for cd mandatory plugin
AbhishekA1509 Oct 8, 2024
77d7ebc
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 10, 2024
bbc63db
feat: update DefinitionSourceType for v2
AbhishekA1509 Oct 14, 2024
64d65f8
feat: Add ProcessPluginDataParamsType for CI and CD pipelines
AbhishekA1509 Oct 14, 2024
2994ec0
chore: Remove isMandatory property from StepType interface
AbhishekA1509 Oct 15, 2024
c6eb6c0
feat: Add TaskActionModalType and TaskActionModalStateType interfaces
AbhishekA1509 Oct 15, 2024
d2ac10c
feat: add types related to mandatory plugin consequences
AbhishekA1509 Oct 16, 2024
47c151f
chore: remove dead code
AbhishekA1509 Oct 16, 2024
f0e0aa4
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 17, 2024
5e37188
fix: remove duplicated enums
AbhishekA1509 Oct 17, 2024
723a29e
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 18, 2024
6d23d75
Update package version to 0.5.2-beta-6
AbhishekA1509 Oct 18, 2024
176073f
chore: rename mandatory plugin types
AbhishekA1509 Oct 20, 2024
592f0c8
refactor: Update import statements in Policy.Types.ts
AbhishekA1509 Oct 20, 2024
d3bd35f
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 21, 2024
2e4ccc5
Update version in package-lock.json and package.json
AbhishekA1509 Oct 21, 2024
869458c
Merge branch 'feat/plugin-policy' into feat/ci-pipeline-mandatory-plu…
AbhishekA1509 Oct 22, 2024
64f026b
Update version in package-lock.json and package.json
AbhishekA1509 Oct 22, 2024
89dc9f9
chore: add a comment for CDPipeline build stage
AbhishekA1509 Oct 23, 2024
840efff
fix: remove isLatest from plugin info due to volatile nature
AbhishekA1509 Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
"version": "0.5.8-beta-1",
"version": "0.5.8-beta-2",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
1 change: 0 additions & 1 deletion src/Common/CIPipeline.Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ export interface StepType {
inlineStepDetail?: InlineStepDetailType
pluginRefStepDetail?: PluginRefStepDetailType
triggerIfParentStageFail: boolean
isMandatory?: boolean
}

export interface BuildStageType {
Expand Down
65 changes: 44 additions & 21 deletions src/Common/Policy.Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,35 @@
* limitations under the License.
*/

import { PluginDataStoreType } from '../Shared'
import { PipelineFormType } from '@Pages/Applications'
import { PluginDataStoreType, PluginDetailPayloadType, ResourceKindType } from '../Shared'
import { VariableType } from './CIPipeline.Types'
import { ServerErrors } from './ServerError'
import { ResponseType } from './Types'

export enum ApplyPolicyToStage {
PRE_CI = 'PRE_CI',
POST_CI = 'POST_CI',
PRE_CD = 'PRE_CD',
POST_CD = 'POST_CD',
/**
* @deprecated in mandatory plugin policy v2
*/
PRE_OR_POST_CI = 'PRE_OR_POST_CI',
PRE_CD = 'PRE_CD',
POST_CD = 'POST_CD',
}

// FIXME: The name build is getting is used in CDPipeline.
// This enum is mapping values from BuildStageVariable
export enum PluginRequiredStage {
PRE_CI = 'preBuildStage',
POST_CI = 'postBuildStage',
PRE_OR_POST_CI = 'PRE_OR_POST_CI',
PRE_STAGE = 'preBuildStage',
POST_STAGE = 'postBuildStage',
PRE_OR_POST_STAGE = 'PRE_OR_POST_CI',
}

export interface DefinitionSourceType {
projectName: string
isDueToProductionEnvironment: boolean
isDueToLinkedPipeline: boolean
policyName: string
appName?: string
clusterName?: string
environmentName?: string
branchNames?: string[]
ciPipelineName?: string
policyNames: string[]
linkedCIPipelineNames?: string[]
}

export interface MandatoryPluginDetailType {
id: number
parentPluginId: number
Expand All @@ -57,7 +53,7 @@ export interface MandatoryPluginDetailType {
applied?: boolean
inputVariables?: VariableType[]
outputVariables?: VariableType[]
definitionSources?: DefinitionSourceType[]
definitionSources?: DefinitionSourceType
}
export interface MandatoryPluginDataType {
pluginData: MandatoryPluginDetailType[]
Expand All @@ -71,6 +67,37 @@ export interface ProcessPluginDataReturnType {
mandatoryPluginsError?: ServerErrors
}

export type ProcessPluginDataCIParamsType = {
resourceKind: ResourceKindType.ciPipeline
ciPipelineId: number
/**
* Comma separated branch names used for v1 api
* For v2 format is [branchName1],[branchName2]
*/
branchName?: string

envName?: never
}

export type ProcessPluginDataCDParamsType = {
resourceKind: ResourceKindType.cdPipeline
envName?: string

ciPipelineId?: never
branchName?: never
}

export type ProcessPluginDataParamsType = {
formData: PipelineFormType
pluginDataStoreState: PluginDataStoreType
appId: number
appName: string
/**
* Would be sent in case we have to get data for steps
*/
requiredPluginIds?: PluginDetailPayloadType['pluginId']
} & (ProcessPluginDataCIParamsType | ProcessPluginDataCDParamsType)

export enum ConsequenceAction {
/**
* This is used if the policy is enforced immediately.
Expand Down Expand Up @@ -104,7 +131,3 @@ export interface BlockedStateData {
isCITriggerBlocked: boolean
ciBlockState: ConsequenceType
}

export interface GetBlockedStateResponse extends ResponseType {
result?: BlockedStateData
}
33 changes: 20 additions & 13 deletions src/Common/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ import React, { ReactNode, CSSProperties, ReactElement } from 'react'
import { Placement } from 'tippy.js'
import { UserGroupDTO } from '@Pages/GlobalConfigurations'
import { ImageComment, ReleaseTag } from './ImageTags.Types'
import { ACTION_STATE, ConsequenceType, DEPLOYMENT_WINDOW_TYPE, DockerConfigOverrideType, SortingOrder, TaskErrorObj } from '.'
import { RegistryType, RuntimeParamsListItemType, Severity } from '../Shared'
import { MandatoryPluginBaseStateType, RegistryType, RuntimeParamsListItemType, Severity } from '../Shared'
import {
ACTION_STATE,
ConsequenceType,
DEPLOYMENT_WINDOW_TYPE,
DockerConfigOverrideType,
SortingOrder,
TaskErrorObj,
} from '.'

/**
* Generic response type object with support for overriding the result type
Expand Down Expand Up @@ -450,12 +457,12 @@ export interface ArtifactReleaseMappingType {
}

export interface CDMaterialListModalServiceUtilProps {
artifacts: any[],
offset: number,
artifactId?: number,
artifactStatus?: string,
disableDefaultSelection?: boolean,
userApprovalConfig?: UserApprovalConfigType,
artifacts: any[]
offset: number
artifactId?: number
artifactStatus?: string
disableDefaultSelection?: boolean
userApprovalConfig?: UserApprovalConfigType
}

export interface CDMaterialType {
Expand Down Expand Up @@ -552,7 +559,7 @@ export interface DownstreamNodesEnvironmentsType {
environmentName: string
}

export interface CommonNodeAttr {
export interface CommonNodeAttr extends Pick<MandatoryPluginBaseStateType, 'isTriggerBlocked' | 'pluginBlockState'> {
connectingCiPipelineId?: number
parents: string | number[] | string[]
x: number
Expand Down Expand Up @@ -602,12 +609,10 @@ export interface CommonNodeAttr {
approvalUsers?: string[]
userApprovalConfig?: UserApprovalConfigType
requestedUserId?: number
showPluginWarning?: boolean
showPluginWarning: boolean
helmPackageName?: string
isVirtualEnvironment?: boolean
deploymentAppType?: DeploymentAppTypes
isCITriggerBlocked?: boolean
ciBlockState?: ConsequenceType
appReleaseTagNames?: string[]
tagsEditable?: boolean
isGitOpsRepoNotConfigured?: boolean
Expand Down Expand Up @@ -790,7 +795,7 @@ export interface CDStageConfigMapSecretNames {
secrets: any[]
}

export interface PrePostDeployStageType {
export interface PrePostDeployStageType extends MandatoryPluginBaseStateType {
isValid: boolean
steps: TaskErrorObj[]
triggerType: string
Expand Down Expand Up @@ -828,6 +833,8 @@ export interface CdPipeline {
preDeployStage?: PrePostDeployStageType
postDeployStage?: PrePostDeployStageType
isProdEnv?: boolean
isGitOpsRepoNotConfigured?: boolean
isDeploymentBlocked?: boolean
}

export interface ExternalCiConfig {
Expand Down
2 changes: 2 additions & 0 deletions src/Shared/Components/InfoIconTippy/InfoIconTippy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ const InfoIconTippy = ({
placement = 'bottom',
dataTestid = 'info-tippy-button',
children,
headingInfo,
}: InfoIconTippyProps) => (
<TippyCustomized
theme={TippyTheme.white}
headingInfo={headingInfo}
className="w-300 h-100 dc__no-text-transform"
placement={placement}
Icon={HelpIcon}
Expand Down
26 changes: 20 additions & 6 deletions src/Shared/Components/Plugin/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { MutableRefObject } from 'react'
import { VariableType } from '../../../Common'
import { ConsequenceType, VariableType } from '../../../Common'
import { BaseFilterQueryParams } from '../../types'
import { ImageWithFallbackProps } from '../ImageWithFallback'
import { getPluginStoreData } from './service'
Expand Down Expand Up @@ -104,18 +104,15 @@ export interface PluginListFiltersType extends Pick<BaseFilterQueryParams<unknow
selectedTags: string[]
}

interface ParentPluginType
export interface ParentPluginType
extends Pick<ParentPluginDTO, 'id' | 'name' | 'description' | 'type' | 'icon' | 'pluginIdentifier'> {
latestVersionId: MinimalPluginVersionDataDTO['id']
pluginVersions: MinimalPluginVersionDataDTO[]
}

interface DetailedPluginVersionType
extends Pick<MinimalPluginVersionDataDTO, 'id' | 'description' | 'name' | 'pluginVersion'>,
Pick<
DetailedPluginVersionDTO,
'tags' | 'isLatest' | 'inputVariables' | 'outputVariables' | 'updatedBy' | 'docLink'
>,
Pick<DetailedPluginVersionDTO, 'tags' | 'inputVariables' | 'outputVariables' | 'updatedBy' | 'docLink'>,
Pick<ParentPluginType, 'icon' | 'type' | 'pluginIdentifier'> {
parentPluginId: ParentPluginType['id']
}
Expand Down Expand Up @@ -253,3 +250,20 @@ export interface PluginTagsContainerProps {
export interface PluginImageContainerProps extends Pick<ImageWithFallbackProps, 'imageProps'> {
fallbackImageClassName?: string
}

export enum PipelineStageTaskActionModalType {
DELETE = 'DELETE',
MOVE_PLUGIN = 'MOVE_PLUGIN',
}

export interface PipelineStageTaskActionModalStateType {
type: PipelineStageTaskActionModalType
pluginId: PluginDetailType['id']
taskIndex: number
}

export interface MandatoryPluginBaseStateType {
isOffendingMandatoryPlugin: boolean
isTriggerBlocked: boolean
pluginBlockState: ConsequenceType
}
1 change: 0 additions & 1 deletion src/Shared/Components/Plugin/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export const parsePluginDetailsDTOIntoPluginStore = (pluginData: ParentPluginDTO
plugin.type === PluginCreationType.SHARED ? pluginVersionData.updatedBy : DEFAULT_PLUGIN_CREATED_BY,
outputVariables: pluginVersionData.outputVariables || [],
inputVariables: pluginVersionData.inputVariables || [],
isLatest: pluginVersionData.isLatest || false,
tags: sortedUniqueTags,
parentPluginId: plugin.id,
icon: plugin.icon || '',
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ export enum ResourceKindType {
tenant = 'tenant',
installation = 'installation',
environment = 'environment',
ciPipeline = 'ci-pipeline',
cdPipeline = 'cd-pipeline',
ciPipeline = 'ci-pipeline',
project = 'project',
}

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export interface customEnv {
SYSTEM_CONTROLLER_LISTING_TIMEOUT?: number
FEATURE_STEP_WISE_LOGS_ENABLE?: boolean
FEATURE_IMAGE_PROMOTION_ENABLE?: boolean
FEATURE_CD_MANDATORY_PLUGINS_ENABLE?: boolean
FEATURE_CONFIG_DRIFT_ENABLE: boolean
}
declare global {
Expand Down