-
Notifications
You must be signed in to change notification settings - Fork 56
feat: trivy Image scanning module Integration #982
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
Conversation
| getModuleConfigured(ModuleNameMap.BLOB_STORAGE), | ||
| ]).then(([ciConfig, securityInfo, moduleConfig]) => { | ||
| getModuleInfo(ModuleNameMap.SECURITY_TRIVY), | ||
| ]).then(([ciConfig, securityInfo, moduleConfig,trivysecurityInfo]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivySecurityInfo fix camel casing
| return { | ||
| pipelineList: ciConfig.result, | ||
| securityModuleInstalled: securityInfo?.result?.status === ModuleStatus.INSTALLED, | ||
| securityModuleInstalled: (securityInfo?.result?.status === ModuleStatus.INSTALLED || trivysecurityInfo?.result?.status === ModuleStatus.INSTALLED), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a const above
| try { | ||
| const { result } = await getModuleInfo(ModuleNameMap.SECURITY) | ||
| if (result?.status === ModuleStatus.INSTALLED) { | ||
| const { result:result2 } =await getModuleInfo(ModuleNameMap.SECURITY_TRIVY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need both calls data use Promise.all
| isSecurityModuleInstalled={ | ||
| initDataResults[1]?.['value']?.['result']?.status === | ||
| ModuleStatus.INSTALLED || false | ||
| (initDataResults[1]?.['value']?.['result']?.status === |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it to top
| scanned: false, | ||
| isLoading: !!artifactId, | ||
| isError: false, | ||
| ScanToolId:0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 can be an Id use null instead if you want intial state & format the code
| <button | ||
| type="button" | ||
| className="cta" | ||
| onClick={() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove inline
| setSelectedModule({ | ||
| ...currentModule, | ||
| installationStatus: result.status, | ||
| moduleType:result.moduleType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
|
|
||
| } | ||
| export interface ModuleEnableCallType{ | ||
| moduleName:string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is all the params are optional
| isModuleConfigurable?: boolean | ||
| isModuleConfigured?: boolean | ||
| moduleResourcesStatus?: ModuleResourceStatus[] | ||
| enabled?:boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
| className?: string | ||
| handleModuleCardClick?: (moduleDetails: ModuleDetails, fromDiscoverModules: boolean) => void | ||
| fromDiscoverModules?: boolean | ||
| datatestid?:string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use camel casing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format all file
| setSecurityModuleInstalled(true) | ||
| } | ||
| } catch (error) {} | ||
| Promise.all([getModuleInfo(ModuleNameMap.SECURITY),getModuleInfo(ModuleNameMap.SECURITY_TRIVY)]).then(([clairResponse,trivyResponse])=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format this code
| title={EMPTY_STATE_STATUS.CI_DEATILS_NO_VULNERABILITY_FOUND} | ||
| children={ | ||
| <span className="flex workflow__header dc__border-radius-24 bcn-0"> | ||
| Scanned By {securityData.ScanToolId === SCAN_TOOL_ID_TRIVY ? 'Trivy ' : 'Clair '}{' '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove {' '}
| <div className="flexbox dc__content-space"> | ||
| <span className="flex left security-tab__last-scanned ">Scanned on {mat.lastExecution} </span> | ||
| <span className="flex right"> | ||
| Scanned By{' '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove {' '}
| <div className="modal-body--scan-details"> | ||
| {this.renderHeader()} | ||
| <div className="trigger-modal__body trigger-modal__body--security-scan"> | ||
| <EmptyState> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use generic empty state
| const isTrivy =(scanToolId === SCAN_TOOL_ID_TRIVY) | ||
| return ( | ||
| <> | ||
| <span className="dc__italic-font-style fw-4 dc__devtron-breadcrumb">Scanned by <span className="fw-6">{isTrivy ? IMAGE_SCAN_TOOL.Trivy : IMAGE_SCAN_TOOL.Clair}</span></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format this file
| export const getSecurityModulesInfoInstalledStatus = async (): Promise<ModuleInfoResponse> => { | ||
| // getting Security Module Installation status | ||
| const [clairResponse, trivyResponse] = await Promise.all([ | ||
| getModuleInfo(ModuleNameMap.SECURITY), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap this into try catch to handle error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible move some constants to constants.tsx
|
SonarCloud Quality Gate failed.
|
Coverage report❌ An unexpected error occurred. For more details, check console
Test suite run failedFailed tests: 17/103. Failed suites: 3/23.Report generated by 🧪jest coverage report action from 4d85725 |









Description
Following Changes have been done to support Image scanning tool trivy for vulnerabilities where state has been showcased when both clair and trivy are installed.
Fixes # (#AB2842)
PR- BE
Tech Doc -Tech Doc
Central-APi PR- PR
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: