From 5fa0206a0c6e38f6fc38e4666c128afc2d547c1d Mon Sep 17 00:00:00 2001 From: Evgeniya Vashkevich Date: Wed, 30 Oct 2024 08:20:48 -0700 Subject: [PATCH] Removed repo format validation --- shell/assets/translations/en-us.yaml | 1 - shell/edit/fleet.cattle.io.gitrepo.vue | 2 +- .../formRules/__tests__/index.test.ts | 23 ------------------- shell/utils/validators/formRules/index.ts | 5 +--- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index 0e0a607263f..b950a4f1489 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -6067,7 +6067,6 @@ validation: localhost: If the Server URL is internal to the Rancher server (e.g. localhost) the downstream clusters may not be able to communicate with Rancher. trailingForwardSlash: Server URL should not have a trailing forward slash. url: Server URL must be an URL. - repo: Repository URL must be a valid HTTPS or SSH URL to a git repository. stringLength: between: '"{key}" should be between {min} and {max} {max, plural, =1 {character} other {characters}}' exactly: '"{key}" should be {count, plural, =1 {# character} other {# characters}}' diff --git a/shell/edit/fleet.cattle.io.gitrepo.vue b/shell/edit/fleet.cattle.io.gitrepo.vue index 421ebe3ca62..4ad4a1533c5 100644 --- a/shell/edit/fleet.cattle.io.gitrepo.vue +++ b/shell/edit/fleet.cattle.io.gitrepo.vue @@ -155,7 +155,7 @@ export default { stepTargetInfo, addRepositorySteps, displayHelmRepoURLRegex: false, - fvFormRuleSets: [{ path: 'spec.repo', rules: ['required', 'repo'] }] + fvFormRuleSets: [{ path: 'spec.repo', rules: ['required'] }] }; }, diff --git a/shell/utils/validators/formRules/__tests__/index.test.ts b/shell/utils/validators/formRules/__tests__/index.test.ts index 54e5f95e4e8..d021a36091a 100644 --- a/shell/utils/validators/formRules/__tests__/index.test.ts +++ b/shell/utils/validators/formRules/__tests__/index.test.ts @@ -1112,29 +1112,6 @@ describe('formRules', () => { expect(formRuleResult).toStrictEqual(expectedResult); }); - describe('repo', () => { - const message = JSON.stringify({ message: 'validation.setting.repo' }); - const testCases = [ - ['', undefined], - ['https://github.com/rancher/fleet-examples.git', undefined], - ['git@github.com:rancher/fleet-examples.git', undefined], - ['http://100.100.100.127', undefined], - ['aaaAAAA111//', message], - ['/', message], - ['+1', message], - [undefined, undefined] - ]; - - it.each(testCases)( - 'should return undefined or correct message based on the provided url', - (val, expected) => { - const formRuleResult = formRules.repo(val); - - expect(formRuleResult).toStrictEqual(expected); - } - ); - }); - describe.each([ ['minValue', 2, [3], [1]], ['maxValue', 256, [1], [300]], diff --git a/shell/utils/validators/formRules/index.ts b/shell/utils/validators/formRules/index.ts index fd1c84182e2..ef935741b6e 100644 --- a/shell/utils/validators/formRules/index.ts +++ b/shell/utils/validators/formRules/index.ts @@ -458,8 +458,6 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): { return runValidators(val, [startHyphen('label'), endHyphen('label'), startDot('label'), endDot('label'), required]); }; - const repo: Validator = (val) => val && !/((git|ssh|http(s)?)|(git@[\w\.]+))(\:(\/\/)?)([\w\.@\:/\-~]+)(\.git)?(\/)?/.test(val) ? t('validation.setting.repo') : undefined; - return { absolutePath, alphanumeric, @@ -501,7 +499,6 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): { servicePort, subDomain, testRule, - wildcardHostname, - repo + wildcardHostname }; }