Skip to content

Commit e62cdc2

Browse files
committed
feat/cert_based_git_auth
Signed-off-by: Abhishek Dhiman <abhi2002dhiman@gmail.com>
1 parent 623d467 commit e62cdc2

File tree

1 file changed

+3
-6
lines changed
  • cmd/testworkflow-toolkit/commands

1 file changed

+3
-6
lines changed

cmd/testworkflow-toolkit/commands/clone.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,25 +247,22 @@ func setupCertAuth(opts *CloneOptions) ([]string, []func(), error) {
247247
if opts.CaCert != "" {
248248
cleanupCaCertFile, caCertFilePath, err := CreateTempFile(opts.CaCert, "ca-cert-*")
249249
if err != nil {
250-
RunCleanupFuncs(cleanupFuncs)
251-
return nil, nil, fmt.Errorf("creating temp file for CA Certificate: %w", err)
250+
return nil, cleanupFuncs, fmt.Errorf("creating temp file for CA Certificate: %w", err)
252251
}
253252
certAuthArgs = append(certAuthArgs, "-c", fmt.Sprintf("http.sslCAInfo=%s", caCertFilePath))
254253
cleanupFuncs = append(cleanupFuncs, cleanupCaCertFile)
255254
}
256255
if opts.ClientCert != "" && opts.ClientKey != "" {
257256
cleanupclientCertFile, clientCertFilePath, err := CreateTempFile(opts.ClientCert, "client-cert-*")
258257
if err != nil {
259-
RunCleanupFuncs(cleanupFuncs)
260-
return nil, nil, fmt.Errorf("creating temp file for Client Certificate: %w", err)
258+
return nil, cleanupFuncs, fmt.Errorf("creating temp file for Client Certificate: %w", err)
261259
}
262260
certAuthArgs = append(certAuthArgs, "-c", fmt.Sprintf("http.sslCert=%s", clientCertFilePath))
263261
cleanupFuncs = append(cleanupFuncs, cleanupclientCertFile)
264262

265263
cleanupclientKeyFile, clientKeyFilePath, err := CreateTempFile(opts.ClientKey, "client-key-*")
266264
if err != nil {
267-
RunCleanupFuncs(cleanupFuncs)
268-
return nil, nil, fmt.Errorf("creating temp file for Client Key: %w", err)
265+
return nil, cleanupFuncs, fmt.Errorf("creating temp file for Client Key: %w", err)
269266
}
270267
certAuthArgs = append(certAuthArgs, "-c", fmt.Sprintf("http.sslKey=%s", clientKeyFilePath))
271268
cleanupFuncs = append(cleanupFuncs, cleanupclientKeyFile)

0 commit comments

Comments
 (0)