Skip to content

Commit

Permalink
Fixes git-resolver configuration for serverUrl and scmType
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
PuneetPunamiya authored and tekton-robot committed Dec 3, 2024
1 parent 4e8eec7 commit acb6211
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 3 additions & 3 deletions pkg/remoteresolution/resolver/git/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,9 @@ func TestResolve(t *testing.T) {
gitresolution.APISecretKeyKey: "token",
gitresolution.APISecretNamespaceKey: system.Namespace(),
},
apiToken: "some-token",
expectedStatus: resolution.CreateResolutionRequestFailureStatus(),
expectedErr: createError("missing or empty scm-type value in configmap"),
apiToken: "some-token",
expectedCommitSHA: commitSHAsInSCMRepo[0],
expectedStatus: resolution.CreateResolutionRequestStatusWithData(mainPipelineYAML),
}}

for _, tc := range testCases {
Expand Down
6 changes: 0 additions & 6 deletions pkg/resolution/resolver/git/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,18 +530,12 @@ func getSCMTypeAndServerURL(ctx context.Context, params map[string]string) (stri
}
if scmType == "" {
scmType = conf.SCMType
if scmType == "" {
return "", "", fmt.Errorf("missing or empty %s value in configmap", SCMTypeKey)
}
}
if key, ok := params[ServerURLParam]; ok {
serverURL = key
}
if serverURL == "" {
serverURL = conf.ServerURL
if serverURL == "" {
return "", "", fmt.Errorf("missing or empty %s value in configmap", ServerURLKey)
}
}
return scmType, serverURL, nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/resolution/resolver/git/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,9 @@ func TestResolve(t *testing.T) {
APISecretKeyKey: "token",
APISecretNamespaceKey: system.Namespace(),
},
apiToken: "some-token",
expectedStatus: resolution.CreateResolutionRequestFailureStatus(),
expectedErr: createError("missing or empty scm-type value in configmap"),
apiToken: "some-token",
expectedCommitSHA: commitSHAsInSCMRepo[0],
expectedStatus: resolution.CreateResolutionRequestStatusWithData(mainPipelineYAML),
}}

for _, tc := range testCases {
Expand Down

0 comments on commit acb6211

Please sign in to comment.