Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add target platform information at artifact and logs level #2377

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
34 changes: 14 additions & 20 deletions src/components/app/details/cIDetails/CIDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
TRIGGER_STATUS_PROGRESSING,
ErrorScreenManager,
SecurityDetailsCards,
sanitizeTargetPlatforms,

Check failure on line 46 in src/components/app/details/cIDetails/CIDetails.tsx

View workflow job for this annotation

GitHub Actions / ci

Module '"@devtron-labs/devtron-fe-common-lib"' has no exported member 'sanitizeTargetPlatforms'.
} from '@devtron-labs/devtron-fe-common-lib'
import { Switch, Route, Redirect, useRouteMatch, useParams, useHistory, generatePath } from 'react-router-dom'
import {
Expand Down Expand Up @@ -535,12 +536,15 @@
const [ciJobArtifact, setciJobArtifact] = useState<string[]>([])
const [loading, setLoading] = useState<boolean>(false)
const downloadArtifactUrl = `${Routes.CI_CONFIG_GET}/${pipelineId}/artifacts/${buildId}`
const targetPlatforms = sanitizeTargetPlatforms(triggerDetails.targetPlatforms)

Check failure on line 539 in src/components/app/details/cIDetails/CIDetails.tsx

View workflow job for this annotation

GitHub Actions / ci

Property 'targetPlatforms' does not exist on type 'History'.

useEffect(() => {
if (isJobCI) {
setLoading(true)
getArtifactsForCiJobRes()
}
}, [triggerDetails])

const getArtifactsForCiJobRes = async () => {
try {
const { result } = await getArtifactForJobCi(pipelineId, buildId)
Expand All @@ -555,6 +559,7 @@
}

const CiArtifactsArrayCards = Array.from({ length: ciJobArtifact?.length }, (_, index) => {
// TargetPlatforms are not supported for Artifacts in case of JobCI
return (
<Artifacts
status={triggerDetails.status}
Expand All @@ -572,6 +577,7 @@
hideImageTaggingHardDelete={hideImageTaggingHardDelete}
Copy link
Member Author

@AbhishekA1509 AbhishekA1509 Jan 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Job CI I believe the logic for image tag seems to be flawed, since for multiple artifacts do we have same image tags?

rootClassName="pb-0-imp"
renderCIListHeader={renderCIListHeader}
targetPlatforms={[]}

Check failure on line 580 in src/components/app/details/cIDetails/CIDetails.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ status: string; artifact: string; blobStorageEnabled: boolean; downloadArtifactUrl: string; isArtifactUploaded: boolean; isJobCI: boolean; imageComment: ImageComment; imageReleaseTags: ReleaseTag[]; ... 7 more ...; targetPlatforms: undefined[]; }' is not assignable to type 'IntrinsicAttributes & ArtifactType'.
/>
)
})
Expand All @@ -593,11 +599,7 @@
)}
</Route>
<Route path={`${path}/source-code`}>
<GitChanges
gitTriggers={triggerDetails.gitTriggers}
ciMaterials={triggerDetails.ciMaterials}
renderCIListHeader={renderCIListHeader}
/>
<GitChanges gitTriggers={triggerDetails.gitTriggers} ciMaterials={triggerDetails.ciMaterials} />

Check failure on line 602 in src/components/app/details/cIDetails/CIDetails.tsx

View workflow job for this annotation

GitHub Actions / ci

Property 'renderCIListHeader' is missing in type '{ gitTriggers: Map<number, GitTriggers>; ciMaterials: CiMaterial[]; }' but required in type 'GitChangesType'.
</Route>
<Route path={`${path}/artifacts`}>
{loading && <Progressing pageLoader />}
Expand All @@ -619,14 +621,14 @@
appReleaseTagNames={appReleaseTags}
hideImageTaggingHardDelete={hideImageTaggingHardDelete}
renderCIListHeader={renderCIListHeader}
targetPlatforms={targetPlatforms}

Check failure on line 624 in src/components/app/details/cIDetails/CIDetails.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ status: string; artifact: string; blobStorageEnabled: boolean; downloadArtifactUrl: string; isArtifactUploaded: boolean; isJobCI: boolean; imageComment: ImageComment; imageReleaseTags: ReleaseTag[]; ... 6 more ...; targetPlatforms: any; }' is not assignable to type 'IntrinsicAttributes & ArtifactType'.
/>
</div>
)}
</Route>
{
<Route path={`${path}/security`}>
<SecurityTab
ciPipelineId={triggerDetails.ciPipelineId}
artifactId={triggerDetails.artifactId}
status={triggerDetails.status}
appIdFromParent={appIdFromParent}
Expand All @@ -645,9 +647,8 @@
)
}

const SecurityTab = ({ ciPipelineId, artifactId, status, appIdFromParent }: SecurityTabType) => {
const SecurityTab = ({ artifactId, status, appIdFromParent }: SecurityTabType) => {
const { appId } = useParams<{ appId: string }>()
const { push } = useHistory()

const computedAppId = appId ?? appIdFromParent

Expand All @@ -656,17 +657,6 @@
artifactId,
})

const redirectToCreate = () => {
if (!ciPipelineId) {
return
}
push(
`${URLS.APP}/${computedAppId}/${URLS.APP_CONFIG}/${URLS.APP_WORKFLOW_CONFIG}/${ciPipelineId}/${
URLS.APP_CI_CONFIG
}/${ciPipelineId}/build`,
)
}

if (['starting', 'running'].includes(status.toLowerCase())) {
return <CIRunningView isSecurityTab />
}
Expand All @@ -681,7 +671,11 @@
}

if (scanResultLoading) {
return <div className='bg__primary flex-grow-1'><Progressing pageLoader /></div>
return (
<div className="bg__primary flex-grow-1">
<Progressing pageLoader />
</div>
)
}
if (scanResultError) {
return <ErrorScreenManager code={scanResultError.code} reload={reloadScanResult} />
Expand Down
3 changes: 0 additions & 3 deletions src/components/app/details/cIDetails/ciDetails.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
display: flex;

.ci-artifact {
.add-image-button {
margin-left: 52px;
}
&.ci-artifact--report {
svg path {
fill: currentColor;
Expand Down
1 change: 0 additions & 1 deletion src/components/app/details/cIDetails/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export interface HistoryLogsType
}

export interface SecurityTabType {
ciPipelineId: number
artifactId: number
status: string
appIdFromParent?: string
Expand Down
1 change: 1 addition & 0 deletions src/components/app/details/triggerView/cdMaterial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1390,10 +1390,11 @@
stageType,
showLatestTag: +mat.index === 0 && materialType !== MATERIAL_TYPE.rollbackMaterialList && !searchImageTag,
isVirtualEnvironment,
targetPlatforms: mat.targetPlatforms,
additionalInfo:
ImagePromotionInfoChip && promotionApprovalMetadata?.promotedFromType ? (
<ImagePromotionInfoChip
promotedTo={envName}

Check failure on line 1397 in src/components/app/details/triggerView/cdMaterial.tsx

View workflow job for this annotation

GitHub Actions / ci

Object literal may only specify known properties, and 'targetPlatforms' does not exist in type 'SequentialCDCardTitleProps'.

Check failure on line 1397 in src/components/app/details/triggerView/cdMaterial.tsx

View workflow job for this annotation

GitHub Actions / ci

Property 'targetPlatforms' does not exist on type 'CDMaterialType'.
promotedFromType={promotionApprovalMetadata?.promotedFromType}
promotedFrom={promotionApprovalMetadata?.promotedFrom}
promotedBy={promotionApprovalMetadata?.requestedUserData?.userEmail}
Expand Down
4 changes: 4 additions & 0 deletions src/css/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,10 @@ button.anchor {
background: var(--N700);
border-radius: 50%;

&--white {
background: var(--white);
}

&.dc__bullet--d2 {
width: 2px;
height: 2px;
Expand Down
Loading