THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

fix(stack): Skip SSL Verification (#3064)

* fix(stack): Skip SSL Verification

* fix(stack): Skip SSL Verification

* fix(stack): move httpsCli into service

* fix(stack): clean-up

* fix(stack): move httpsCli back into the function

* fix(stack): move httpsCli and InstallProtocol back into service

* fix(stack): clean-up debugging

* fix(stack): parameter cleanup

Co-Authored-By: Anthony Lapenna <anthony.lapenna@portainer.io>
tags/1.22.1^2
Steven Kang Anthony Lapenna 5 months ago
parent
commit
ec19faaa24
2 changed files with 22 additions and 6 deletions
  1. +1
    -1
      api/cmd/portainer/main.go
  2. +21
    -5
      api/git/git.go

+ 1
- 1
api/cmd/portainer/main.go View File

@@ -102,7 +102,7 @@ func initLDAPService() portainer.LDAPService {
}

func initGitService() portainer.GitService {
return &git.Service{}
return git.NewService()
}

func initClientFactory(signatureService portainer.DigitalSignatureService, reverseTunnelService portainer.ReverseTunnelService) *docker.ClientFactory {


+ 21
- 5
api/git/git.go View File

@@ -1,21 +1,37 @@
package git

import (
"crypto/tls"
"net/http"
"net/url"
"strings"
"time"

"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/transport/client"
githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
)

// Service represents a service for managing Git.
type Service struct{}
type Service struct {
httpsCli *http.Client
}

// NewService initializes a new service.
func NewService(dataStorePath string) (*Service, error) {
service := &Service{}
func NewService() *Service {
httpsCli := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
Timeout: 300 * time.Second,
}

return service, nil
client.InstallProtocol("https", githttp.NewClient(httpsCli))

return &Service{
httpsCli: httpsCli,
}
}

// ClonePublicRepository clones a public git repository using the specified URL in the specified
@@ -32,7 +48,7 @@ func (service *Service) ClonePrivateRepositoryWithBasicAuth(repositoryURL, refer
return cloneRepository(repositoryURL, referenceName, destination)
}

func cloneRepository(repositoryURL, referenceName string, destination string) error {
func cloneRepository(repositoryURL, referenceName, destination string) error {
options := &git.CloneOptions{
URL: repositoryURL,
}


Loading…
Cancel
Save