From 6a76752781649024283ebdc7958f72910e61847c Mon Sep 17 00:00:00 2001 From: Nan Yu Date: Thu, 2 Nov 2023 22:46:51 +0000 Subject: [PATCH] Fixes the bitbucket API failures (#993) Bitbucket now has three types of access tokens, repository access token, project access token and workspace access token: https://developer.atlassian.com/cloud/bitbucket/rest/intro/#access-tokens. The config-sync-ci-bot account only has access to the repository access token. The other two requires upgrading to premium plan. The repository access token only allows listing repositories with the project filter. Hence this commit as a query to the list call. b/308221985 b/308219656 --- e2e/nomostest/gitproviders/bitbucket.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/nomostest/gitproviders/bitbucket.go b/e2e/nomostest/gitproviders/bitbucket.go index 078779c797..463431e5dd 100644 --- a/e2e/nomostest/gitproviders/bitbucket.go +++ b/e2e/nomostest/gitproviders/bitbucket.go @@ -212,8 +212,8 @@ func FetchCloudSecret(name string) (string, error) { func (b *BitbucketClient) deleteObsoleteReposByPage(accessToken string, page int) (int, error) { out, err := exec.Command("curl", "-sX", "GET", "-H", fmt.Sprintf("Authorization:Bearer %s", accessToken), - fmt.Sprintf("https://api.bitbucket.org/2.0/repositories/%s?page=%d", - GitUser, page)).CombinedOutput() + fmt.Sprintf(`https://api.bitbucket.org/2.0/repositories/%s?q=project.key="%s"&page=%d`, + GitUser, bitbucketProject, page)).CombinedOutput() if err != nil { return -1, errors.Wrap(err, string(out)) }