Skip to content

feat: modification on chart registry && git provider icon method #853

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

Merged
merged 35 commits into from
Aug 21, 2025

Conversation

shivani170
Copy link
Contributor

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@AbhishekA1509 AbhishekA1509 requested a review from Copilot August 12, 2025 06:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the RegistryIcon component to support determining icons based on registry URLs in addition to registry types, and updates related CI/CD history components to use the new functionality with artifact URLs.

  • Modified RegistryIconProps to make registryType optional and added registryUrl prop
  • Implemented URL-based registry icon detection logic in RegistryIcon component
  • Updated CI/CD history types and components to pass artifact URLs for icon determination

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Shared/Components/RegistryIcon/types.ts Made registryType optional and added registryUrl prop
src/Shared/Components/RegistryIcon/RegistryIcon.tsx Added URL-based icon detection logic and updated component
src/Shared/Components/CICDHistory/types.tsx Added artifact string property to CI list item type
src/Shared/Components/CICDHistory/History.components.tsx Passed artifact prop to CIListItem component
src/Shared/Components/CICDHistory/Artifacts.tsx Updated to use RegistryIcon with artifact URL instead of static docker icon
src/Common/CIPipeline.Types.ts Added url property to MaterialType interface

@@ -18,6 +18,9 @@

import { IconName } from '../Icon'

export const isAWSCodeCommitURL = (url: string = ''): boolean =>
url.includes('git-codecommit.') && url.includes('.amazonaws.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
.amazonaws.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix

AI about 24 hours ago

To fix the problem, we should parse the input URL and check the host component to ensure it matches the expected AWS CodeCommit host pattern. Specifically, AWS CodeCommit URLs have hosts like git-codecommit.<region>.amazonaws.com. We should use the standard URL class to parse the URL and then use a regular expression or string checks to verify that the host matches the expected pattern. This change should be made in the isAWSCodeCommitURL function in src/Shared/Components/GitProviderIcon/utils.ts. No external dependencies are needed, as the URL class is available in modern JavaScript/TypeScript environments.

Suggested changeset 1
src/Shared/Components/GitProviderIcon/utils.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/Shared/Components/GitProviderIcon/utils.ts b/src/Shared/Components/GitProviderIcon/utils.ts
--- a/src/Shared/Components/GitProviderIcon/utils.ts
+++ b/src/Shared/Components/GitProviderIcon/utils.ts
@@ -18,8 +18,16 @@
 
 import { IconName } from '../Icon'
 
-export const isAWSCodeCommitURL = (url: string = ''): boolean =>
-    url.includes('git-codecommit.') && url.includes('.amazonaws.com')
+export const isAWSCodeCommitURL = (url: string = ''): boolean => {
+    try {
+        const { host } = new URL(url);
+        // AWS CodeCommit hosts are like: git-codecommit.<region>.amazonaws.com
+        // This regex matches hosts starting with git-codecommit., followed by region, ending with .amazonaws.com
+        return /^git-codecommit\.[a-z0-9-]+\.amazonaws\.com$/i.test(host);
+    } catch {
+        return false;
+    }
+}
 
 export const getGitIconName = (repoUrl: string): IconName => {
     if (repoUrl.includes(GitProviderType.GITHUB)) {
EOF
@@ -18,8 +18,16 @@

import { IconName } from '../Icon'

export const isAWSCodeCommitURL = (url: string = ''): boolean =>
url.includes('git-codecommit.') && url.includes('.amazonaws.com')
export const isAWSCodeCommitURL = (url: string = ''): boolean => {
try {
const { host } = new URL(url);
// AWS CodeCommit hosts are like: git-codecommit.<region>.amazonaws.com
// This regex matches hosts starting with git-codecommit., followed by region, ending with .amazonaws.com
return /^git-codecommit\.[a-z0-9-]+\.amazonaws\.com$/i.test(host);
} catch {
return false;
}
}

export const getGitIconName = (repoUrl: string): IconName => {
if (repoUrl.includes(GitProviderType.GITHUB)) {
Copilot is powered by AI and may make mistakes. Always verify output.
AbhishekA1509
AbhishekA1509 previously approved these changes Aug 21, 2025
vivek-devtron
vivek-devtron previously approved these changes Aug 21, 2025
@shivani170 shivani170 dismissed stale reviews from vivek-devtron and AbhishekA1509 via 7f44c95 August 21, 2025 09:12
vivek-devtron
vivek-devtron previously approved these changes Aug 21, 2025
@shivani170 shivani170 merged commit 0a040a0 into develop Aug 21, 2025
5 of 6 checks passed
@shivani170 shivani170 deleted the feat/git-icon-replacement branch August 21, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants