mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
[cherry-pick] fix http client to push sbom accessory (#20528)
fix http client to push sbom accessory Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
parent
99440599ea
commit
eeec10387b
@ -16,7 +16,6 @@ package scan
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/google/go-containerregistry/pkg/authn"
|
"github.com/google/go-containerregistry/pkg/authn"
|
||||||
"github.com/google/go-containerregistry/pkg/name"
|
"github.com/google/go-containerregistry/pkg/name"
|
||||||
@ -29,22 +28,14 @@ import (
|
|||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
|
||||||
commonhttp "github.com/goharbor/harbor/src/common/http"
|
http_common "github.com/goharbor/harbor/src/common/http"
|
||||||
"github.com/goharbor/harbor/src/lib/log"
|
|
||||||
"github.com/goharbor/harbor/src/pkg/robot/model"
|
"github.com/goharbor/harbor/src/pkg/robot/model"
|
||||||
v1sq "github.com/goharbor/harbor/src/pkg/scan/rest/v1"
|
v1sq "github.com/goharbor/harbor/src/pkg/scan/rest/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RemoteOptions ...
|
// RemoteOptions ...
|
||||||
func RemoteOptions() []remote.Option {
|
func RemoteOptions() []remote.Option {
|
||||||
tr := http.DefaultTransport.(*http.Transport).Clone()
|
tr := http_common.GetHTTPTransport(http_common.WithInsecure(true))
|
||||||
if commonhttp.InternalEnableVerifyClientCert() {
|
|
||||||
tlsConfig, err := commonhttp.GetInternalTLSConfig()
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("SBOM client load cert file with err: %v", err)
|
|
||||||
}
|
|
||||||
tr.TLSClientConfig = tlsConfig
|
|
||||||
}
|
|
||||||
return []remote.Option{remote.WithTransport(tr)}
|
return []remote.Option{remote.WithTransport(tr)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user