-
Notifications
You must be signed in to change notification settings - Fork 109
Bitbucket cloud integration tests #1421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ebf4786
f66cdff
816d275
62cce65
7b0febe
bc4d850
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -432,6 +432,89 @@ jobs: | |||||||||
| JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} | ||||||||||
| FROGBOT_V3_TESTS_GITLAB_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_GITLAB_TOKEN }} | ||||||||||
|
|
||||||||||
| bitbucket-cloud-integration: | ||||||||||
| name: Bitbucket Cloud Integration Tests | ||||||||||
| needs: Pretest | ||||||||||
| runs-on: ${{ matrix.os }}-latest | ||||||||||
| strategy: | ||||||||||
| fail-fast: false | ||||||||||
| max-parallel: 1 | ||||||||||
| matrix: | ||||||||||
| os: [ ubuntu, windows, macos ] | ||||||||||
| concurrency: | ||||||||||
| group: bitbucket-cloud-integration-fixture | ||||||||||
| cancel-in-progress: false | ||||||||||
| env: | ||||||||||
| JFROG_CLI_LOG_LEVEL: "DEBUG" | ||||||||||
| steps: | ||||||||||
| - uses: actions/checkout@v7 | ||||||||||
| with: | ||||||||||
| ref: ${{ github.event.pull_request.head.sha }} | ||||||||||
| allow-unsafe-pr-checkout: true | ||||||||||
| persist-credentials: false | ||||||||||
|
|
||||||||||
| - uses: jfrog/boost@v0 | ||||||||||
| with: | ||||||||||
| accept_terms: yes | ||||||||||
|
|
||||||||||
| - name: Setup Go | ||||||||||
| uses: actions/setup-go@v5 | ||||||||||
| with: | ||||||||||
| go-version-file: 'go.mod' | ||||||||||
| cache: false | ||||||||||
| - name: Go Cache Build & Tests | ||||||||||
| uses: actions/cache@v4 | ||||||||||
| with: | ||||||||||
| path: | | ||||||||||
| ~/.cache/go-build | ||||||||||
| ~\AppData\Local\go-build | ||||||||||
| ~/Library/Caches/go-build | ||||||||||
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/*.go') }} | ||||||||||
| restore-keys: | | ||||||||||
| ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}- | ||||||||||
| ${{ runner.os }}-go- | ||||||||||
|
|
||||||||||
| - name: Run Tests | ||||||||||
| run: go test -tags integration -run 'TestBitbucketCloud_' bitbucket_cloud_test.go integrationutils.go commands.go -v -race -timeout 30m -cover | ||||||||||
| env: | ||||||||||
| JF_URL: ${{ secrets.PLATFORM_URL }} | ||||||||||
| JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} | ||||||||||
| FROGBOT_V3_TESTS_BITBUCKET_CLOUD_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_BITBUCKET_CLOUD_TOKEN }} | ||||||||||
|
Comment on lines
+435
to
+482
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔌 Services VulnerabilityFull descriptionVulnerability Details
A GitHub workflow that runs on An attacker may exploit the workflow to access sensitive data available in the workflow's environment, such as API keys or other secrets. Additionally, if the workflow has write permissions to the repository, the attacker may be able to modify the project by pushing malicious code. If possible, avoid using workflows triggered by
Comment on lines
+435
to
+482
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔌 Services VulnerabilityFull descriptionVulnerability Details
A GitHub workflow that runs on An attacker may exploit the workflow to access sensitive data available in the workflow's environment, such as API keys or other secrets. Additionally, if the workflow has write permissions to the repository, the attacker may be able to modify the project by pushing malicious code. If possible, avoid using workflows triggered by |
||||||||||
|
|
||||||||||
| bitbucket-cloud-integration-cleanup: | ||||||||||
| name: Cleanup Bitbucket Cloud Integration Test Artifacts | ||||||||||
| needs: [ Pretest, bitbucket-cloud-integration ] | ||||||||||
| if: ${{ always() && !cancelled() && needs.Pretest.result != 'skipped' && needs.bitbucket-cloud-integration.result != 'skipped' }} | ||||||||||
| runs-on: ubuntu-latest | ||||||||||
| concurrency: | ||||||||||
| group: bitbucket-cloud-integration-fixture | ||||||||||
| cancel-in-progress: false | ||||||||||
| env: | ||||||||||
| JFROG_CLI_LOG_LEVEL: "DEBUG" | ||||||||||
| steps: | ||||||||||
| - uses: actions/checkout@v7 | ||||||||||
| with: | ||||||||||
| ref: ${{ github.event.pull_request.head.sha }} | ||||||||||
| allow-unsafe-pr-checkout: true | ||||||||||
| persist-credentials: false | ||||||||||
|
|
||||||||||
| - uses: jfrog/boost@v0 | ||||||||||
| with: | ||||||||||
| accept_terms: yes | ||||||||||
|
|
||||||||||
| - name: Setup Go | ||||||||||
| uses: actions/setup-go@v5 | ||||||||||
| with: | ||||||||||
| go-version-file: 'go.mod' | ||||||||||
| cache: false | ||||||||||
|
|
||||||||||
| - name: Run Cleanup | ||||||||||
| run: go test -tags integration -run TestHelper_CleanupIntegrationTestsArtifactsBitbucketCloud bitbucket_cloud_test.go integrationutils.go commands.go -v | ||||||||||
| env: | ||||||||||
| JF_URL: ${{ secrets.PLATFORM_URL }} | ||||||||||
| JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} | ||||||||||
| FROGBOT_V3_TESTS_BITBUCKET_CLOUD_TOKEN: ${{ secrets.FROGBOT_V3_TESTS_BITBUCKET_CLOUD_TOKEN }} | ||||||||||
|
Comment on lines
+484
to
+516
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔌 Services VulnerabilityFull descriptionVulnerability Details
A GitHub workflow that runs on An attacker may exploit the workflow to access sensitive data available in the workflow's environment, such as API keys or other secrets. Additionally, if the workflow has write permissions to the repository, the attacker may be able to modify the project by pushing malicious code. If possible, avoid using workflows triggered by
Comment on lines
+484
to
+516
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔌 Services VulnerabilityFull descriptionVulnerability Details
A GitHub workflow that runs on An attacker may exploit the workflow to access sensitive data available in the workflow's environment, such as API keys or other secrets. Additionally, if the workflow has write permissions to the repository, the attacker may be able to modify the project by pushing malicious code. If possible, avoid using workflows triggered by |
||||||||||
|
|
||||||||||
| bitbucket-server-integration: | ||||||||||
| name: Bitbucket Server Integration Tests | ||||||||||
| needs: Pretest | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| //go:build integration | ||
|
|
||
| package main | ||
|
|
||
| import ( | ||
| "github.com/jfrog/frogbot/v3/utils" | ||
| "github.com/jfrog/froggit-go/vcsclient" | ||
| "github.com/jfrog/froggit-go/vcsutils" | ||
| "github.com/stretchr/testify/assert" | ||
| "testing" | ||
| ) | ||
|
|
||
| const ( | ||
| //#nosec G101 -- False positive - no hardcoded credentials. | ||
| bitbucketCloudIntegrationTokenEnv = "FROGBOT_V3_TESTS_BITBUCKET_CLOUD_TOKEN" | ||
| bitbucketCloudGitCloneUrl = "https://bitbucket.org/frogbot-e2e-test/frogbot-test.git" | ||
| bitbucketCloudRepoOwner = "frogbot-e2e-test" | ||
| // Matches utils.toBasicAuth's own default for git operations. Bitbucket Cloud's REST API rejects | ||
| // this username though, hence GitPushUsername being kept separate from the (empty) REST username. | ||
| bitbucketCloudGitPushUsername = "x-token-auth" | ||
| ) | ||
|
|
||
| func buildBitbucketCloudClient(t *testing.T, bitbucketCloudToken string) vcsclient.VcsClient { | ||
| bbClient, err := vcsclient.NewClientBuilder(vcsutils.BitbucketCloud).Token(bitbucketCloudToken).Build() | ||
| assert.NoError(t, err) | ||
| return bbClient | ||
| } | ||
|
|
||
| func buildBitbucketCloudIntegrationTestDetails(t *testing.T) *IntegrationTestDetails { | ||
| integrationRepoToken := getIntegrationToken(t, bitbucketCloudIntegrationTokenEnv) | ||
| testDetails := NewIntegrationTestDetails(integrationRepoToken, string(utils.BitbucketCloud), bitbucketCloudGitCloneUrl, bitbucketCloudRepoOwner) | ||
| testDetails.GitUsername = "" | ||
| testDetails.GitPushUsername = bitbucketCloudGitPushUsername | ||
|
eranturgeman marked this conversation as resolved.
|
||
| return testDetails | ||
| } | ||
|
|
||
| func bitbucketCloudTestsInit(t *testing.T) (vcsclient.VcsClient, *IntegrationTestDetails) { | ||
| testDetails := buildBitbucketCloudIntegrationTestDetails(t) | ||
| bbClient := buildBitbucketCloudClient(t, testDetails.GitToken) | ||
| return bbClient, testDetails | ||
| } | ||
|
|
||
| func TestBitbucketCloud_ScanPullRequestIntegration(t *testing.T) { | ||
| bbClient, testDetails := bitbucketCloudTestsInit(t) | ||
| runScanPullRequestCmd(t, bbClient, testDetails) | ||
| } | ||
|
|
||
| func TestBitbucketCloud_ScanRepositoryIntegration(t *testing.T) { | ||
| bbClient, testDetails := bitbucketCloudTestsInit(t) | ||
| runScanRepositoryCmd(t, bbClient, testDetails) | ||
| } | ||
|
|
||
| func TestHelper_CleanupIntegrationTestsArtifactsBitbucketCloud(t *testing.T) { | ||
| bbClient, testDetails := bitbucketCloudTestsInit(t) | ||
| cleanupIntegrationArtifacts(t, bbClient, testDetails) | ||
| } | ||

Uh oh!
There was an error while loading. Please reload this page.