Skip to content

Commit 0f2d9f1

Browse files
PuneetPunamiyatekton-robot
authored andcommitted
Fixes git-resolver configuration for serverUrl and scmType
With the latest support for multiple git providers in git-resolvers, it was having a regression issue where if value serverUrl was not given then it used to return an error Hence this patch fixes the issue to avoid regression Signed-off-by: PuneetPunamiya <[email protected]>
1 parent cfc5c7b commit 0f2d9f1

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

pkg/remoteresolution/resolver/git/resolver_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -645,9 +645,9 @@ func TestResolve(t *testing.T) {
645645
gitresolution.APISecretKeyKey: "token",
646646
gitresolution.APISecretNamespaceKey: system.Namespace(),
647647
},
648-
apiToken: "some-token",
649-
expectedStatus: resolution.CreateResolutionRequestFailureStatus(),
650-
expectedErr: createError("missing or empty scm-type value in configmap"),
648+
apiToken: "some-token",
649+
expectedCommitSHA: commitSHAsInSCMRepo[0],
650+
expectedStatus: resolution.CreateResolutionRequestStatusWithData(mainPipelineYAML),
651651
}}
652652

653653
for _, tc := range testCases {

pkg/resolution/resolver/git/resolver.go

-6
Original file line numberDiff line numberDiff line change
@@ -530,18 +530,12 @@ func getSCMTypeAndServerURL(ctx context.Context, params map[string]string) (stri
530530
}
531531
if scmType == "" {
532532
scmType = conf.SCMType
533-
if scmType == "" {
534-
return "", "", fmt.Errorf("missing or empty %s value in configmap", SCMTypeKey)
535-
}
536533
}
537534
if key, ok := params[ServerURLParam]; ok {
538535
serverURL = key
539536
}
540537
if serverURL == "" {
541538
serverURL = conf.ServerURL
542-
if serverURL == "" {
543-
return "", "", fmt.Errorf("missing or empty %s value in configmap", ServerURLKey)
544-
}
545539
}
546540
return scmType, serverURL, nil
547541
}

pkg/resolution/resolver/git/resolver_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,9 @@ func TestResolve(t *testing.T) {
642642
APISecretKeyKey: "token",
643643
APISecretNamespaceKey: system.Namespace(),
644644
},
645-
apiToken: "some-token",
646-
expectedStatus: resolution.CreateResolutionRequestFailureStatus(),
647-
expectedErr: createError("missing or empty scm-type value in configmap"),
645+
apiToken: "some-token",
646+
expectedCommitSHA: commitSHAsInSCMRepo[0],
647+
expectedStatus: resolution.CreateResolutionRequestStatusWithData(mainPipelineYAML),
648648
}}
649649

650650
for _, tc := range testCases {

0 commit comments

Comments
 (0)