chore(deps): bump github.com/ktrysmt/go-bitbucket from 0.9.87 to 0.9.88 (#25544)

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: reggie-k <regina.voloshin@codefresh.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: reggie-k <regina.voloshin@codefresh.io>
This commit is contained in:
dependabot[bot]
2025-12-08 13:40:57 +02:00
committed by GitHub
parent acde9ff4fc
commit cc57831808
6 changed files with 34 additions and 16 deletions

View File

@@ -81,7 +81,10 @@ func NewBitbucketCloudServiceBasicAuth(baseURL, username, password, owner, repos
return nil, fmt.Errorf("error parsing base url of %s for %s/%s: %w", baseURL, owner, repositorySlug, err)
}
bitbucketClient := bitbucket.NewBasicAuth(username, password)
bitbucketClient, err := bitbucket.NewBasicAuth(username, password)
if err != nil {
return nil, fmt.Errorf("error creating BitBucket Cloud client with basic auth: %w", err)
}
bitbucketClient.SetApiBaseURL(*url)
return &BitbucketCloudService{
@@ -97,14 +100,13 @@ func NewBitbucketCloudServiceBearerToken(baseURL, bearerToken, owner, repository
return nil, fmt.Errorf("error parsing base url of %s for %s/%s: %w", baseURL, owner, repositorySlug, err)
}
bitbucketClient := bitbucket.NewOAuthbearerToken(bearerToken)
bitbucketClient, err := bitbucket.NewOAuthbearerToken(bearerToken)
if err != nil {
return nil, fmt.Errorf("error creating BitBucket Cloud client with oauth bearer token: %w", err)
}
bitbucketClient.SetApiBaseURL(*url)
return &BitbucketCloudService{
client: bitbucketClient,
owner: owner,
repositorySlug: repositorySlug,
}, nil
return &BitbucketCloudService{client: bitbucketClient, owner: owner, repositorySlug: repositorySlug}, nil
}
func NewBitbucketCloudServiceNoAuth(baseURL, owner, repositorySlug string) (PullRequestService, error) {

View File

@@ -53,8 +53,12 @@ func (c *ExtendedClient) GetContents(repo *Repository, path string) (bool, error
var _ SCMProviderService = &BitBucketCloudProvider{}
func NewBitBucketCloudProvider(owner string, user string, password string, allBranches bool) (*BitBucketCloudProvider, error) {
bitbucketClient, err := bitbucket.NewBasicAuth(user, password)
if err != nil {
return nil, fmt.Errorf("error creating BitBucket Cloud client with basic auth: %w", err)
}
client := &ExtendedClient{
bitbucket.NewBasicAuth(user, password),
bitbucketClient,
user,
password,
owner,

2
go.mod
View File

@@ -65,7 +65,7 @@ require (
github.com/jarcoal/httpmock v1.4.1
github.com/jeremywohl/flatten v1.0.2-0.20211013061545-07e4a09fb8e4
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/ktrysmt/go-bitbucket v0.9.87
github.com/ktrysmt/go-bitbucket v0.9.88
github.com/mattn/go-isatty v0.0.20
github.com/mattn/go-zglob v0.0.6
github.com/microsoft/azure-devops-go-api/azuredevops/v7 v7.1.1-0.20241014080628-3045bdf43455

4
go.sum
View File

@@ -624,8 +624,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/ktrysmt/go-bitbucket v0.9.87 h1:eR7E4ndyKpO2+HdBwUlsC5K/40nEDpjMLEWsPLY97oQ=
github.com/ktrysmt/go-bitbucket v0.9.87/go.mod h1:slSdGm9Vh3L2ZOU1r7Fu2B9rPJvsflYgneRCoPA83eY=
github.com/ktrysmt/go-bitbucket v0.9.88 h1:XBjYui83tW2puG7f2GvYSAMMKIPfhpeoLCVfEJx3KVM=
github.com/ktrysmt/go-bitbucket v0.9.88/go.mod h1:fx6zdyKEyiNfR9VW0npWD6ugoSUsp8JLXGyqna8bHkc=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs=

View File

@@ -551,12 +551,19 @@ func sourceUsesURL(source v1alpha1.ApplicationSource, webURL string, repoRegexp
// is provided, then oauth based client is created.
func newBitbucketClient(_ context.Context, repository *v1alpha1.Repository, apiBaseURL string) (*bb.Client, error) {
var bbClient *bb.Client
var err error
if repository.Username != "" && repository.Password != "" {
log.Debugf("fetched user/password for repository URL '%s', initializing basic auth client", repository.Repo)
if repository.Username == "x-token-auth" {
bbClient = bb.NewOAuthbearerToken(repository.Password)
bbClient, err = bb.NewOAuthbearerToken(repository.Password)
if err != nil {
return nil, fmt.Errorf("error creating BitBucket Cloud client with oauth bearer token: %w", err)
}
} else {
bbClient = bb.NewBasicAuth(repository.Username, repository.Password)
bbClient, err = bb.NewBasicAuth(repository.Username, repository.Password)
if err != nil {
return nil, fmt.Errorf("error creating BitBucket Cloud client with basic auth: %w", err)
}
}
} else {
if repository.BearerToken != "" {
@@ -564,7 +571,10 @@ func newBitbucketClient(_ context.Context, repository *v1alpha1.Repository, apiB
} else {
log.Debugf("no credentials available for repository URL '%s', initializing no auth client", repository.Repo)
}
bbClient = bb.NewOAuthbearerToken(repository.BearerToken)
bbClient, err = bb.NewOAuthbearerToken(repository.BearerToken)
if err != nil {
return nil, fmt.Errorf("error creating BitBucket Cloud client with oauth bearer token: %w", err)
}
}
// parse and set the target URL of the Bitbucket server in the client
repoBaseURL, err := url.Parse(apiBaseURL)

View File

@@ -1084,7 +1084,8 @@ func TestFetchDiffStatBitbucketClient(t *testing.T) {
httpmock.RegisterResponder("GET",
"https://api.bitbucket.org/2.0/repositories/test-owner/test-repo/diffstat/abcdef..ghijkl",
getDiffstatResponderFn())
client := bb.NewOAuthbearerToken("")
client, err := bb.NewOAuthbearerToken("")
require.NoError(t, err)
tt := []struct {
name string
owner string
@@ -1133,7 +1134,8 @@ func TestIsHeadTouched(t *testing.T) {
httpmock.RegisterResponder("GET",
"https://api.bitbucket.org/2.0/repositories/test-owner/test-repo",
getRepositoryResponderFn())
client := bb.NewOAuthbearerToken("")
client, err := bb.NewOAuthbearerToken("")
require.NoError(t, err)
tt := []struct {
name string
owner string