Skip to content

Commit b5134cd

Browse files
authored
Merge branch 'main' into add-github-step-summary
2 parents b15e627 + 4c43e22 commit b5134cd

23 files changed

+319
-137
lines changed

.github/workflows/e2e.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ jobs:
110110
TEST_BITBUCKET_CLOUD_TOKEN: ${{ secrets.BITBUCKET_CLOUD_TOKEN }}
111111
TEST_BITBUCKET_CLOUD_USER: cboudjna
112112

113-
# Bitbucket Server
114-
TEST_BITBUCKET_SERVER_API_URL: ${{ secrets.BITBUCKET_SERVER_API_URL }}
115-
TEST_BITBUCKET_SERVER_E2E_REPOSITORY: PAC/pac-e2e-tests
116-
TEST_BITBUCKET_SERVER_TOKEN: ${{ secrets.BITBUCKET_SERVER_TOKEN }}
117-
TEST_BITBUCKET_SERVER_USER: pipelines
118-
TEST_BITBUCKET_SERVER_WEBHOOK_SECRET: ${{ secrets.BITBUCKET_SERVER_WEBHOOK_SECRET }}
113+
# Bitbucket Data Center
114+
TEST_BITBUCKET_DATA_CENTER_API_URL: ${{ secrets.BITBUCKET_DATA_CENTER_API_URL }}
115+
TEST_BITBUCKET_DATA_CENTER_E2E_REPOSITORY: PAC/pac-e2e-tests
116+
TEST_BITBUCKET_DATA_CENTER_TOKEN: ${{ secrets.BITBUCKET_DATA_CENTER_TOKEN }}
117+
TEST_BITBUCKET_DATA_CENTER_USER: pipelines
118+
TEST_BITBUCKET_DATA_CENTER_WEBHOOK_SECRET: ${{ secrets.BITBUCKET_DATA_CENTER_WEBHOOK_SECRET }}
119119
TESTRR_URL: https://testrr.pipelinesascode.com
120120
TESTRR_PROJECT: pipelinesascode
121121
TESTRR_USERNAME: pac
@@ -296,12 +296,12 @@ jobs:
296296
TEST_BITBUCKET_CLOUD_TOKEN: ${{ secrets.BITBUCKET_CLOUD_TOKEN }}
297297
TEST_BITBUCKET_CLOUD_USER: cboudjna
298298

299-
# Bitbucket Server
300-
TEST_BITBUCKET_SERVER_API_URL: ${{ secrets.BITBUCKET_SERVER_API_URL }}
301-
TEST_BITBUCKET_SERVER_E2E_REPOSITORY: PAC/pac-e2e-tests
302-
TEST_BITBUCKET_SERVER_TOKEN: ${{ secrets.BITBUCKET_SERVER_TOKEN }}
303-
TEST_BITBUCKET_SERVER_USER: pipelines
304-
TEST_BITBUCKET_SERVER_WEBHOOK_SECRET: ${{ secrets.BITBUCKET_SERVER_WEBHOOK_SECRET }}
299+
# Bitbucket Data Center
300+
TEST_BITBUCKET_DATA_CENTER_API_URL: ${{ secrets.BITBUCKET_DATA_CENTER_API_URL }}
301+
TEST_BITBUCKET_DATA_CENTER_E2E_REPOSITORY: PAC/pac-e2e-tests
302+
TEST_BITBUCKET_DATA_CENTER_TOKEN: ${{ secrets.BITBUCKET_DATA_CENTER_TOKEN }}
303+
TEST_BITBUCKET_DATA_CENTER_USER: pipelines
304+
TEST_BITBUCKET_DATA_CENTER_WEBHOOK_SECRET: ${{ secrets.BITBUCKET_DATA_CENTER_WEBHOOK_SECRET }}
305305
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
306306
with:
307307
detached: true
@@ -377,9 +377,9 @@ jobs:
377377
TEST_GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
378378
TEST_GITLAB_SECOND_TOKEN: ${{ secrets.TEST_GITLAB_SECOND_TOKEN }}
379379
TEST_GITLAB_SECOND_GROUP: ${{ vars.TEST_GITLAB_SECOND_GROUP }}
380-
TEST_BITBUCKET_SERVER_TOKEN: ${{ secrets.BITBUCKET_SERVER_TOKEN }}
381-
TEST_BITBUCKET_SERVER_API_URL: ${{ secrets.BITBUCKET_SERVER_API_URL }}
382-
TEST_BITBUCKET_SERVER_WEBHOOK_SECRET: ${{ secrets.BITBUCKET_SERVER_WEBHOOK_SECRET }}
380+
TEST_BITBUCKET_DATA_CENTER_TOKEN: ${{ secrets.BITBUCKET_DATA_CENTER_TOKEN }}
381+
TEST_BITBUCKET_DATA_CENTER_API_URL: ${{ secrets.BITBUCKET_DATA_CENTER_API_URL }}
382+
TEST_BITBUCKET_DATA_CENTER_WEBHOOK_SECRET: ${{ secrets.BITBUCKET_DATA_CENTER_WEBHOOK_SECRET }}
383383
TEST_GITEA_SMEEURL: ${{ steps.gosmee-url.outputs.url }}
384384
TEST_GITLAB_SMEEURL: ${{ steps.gosmee-gitlab-url.outputs.url }}
385385
TEST_GITHUB_SECOND_WEBHOOK_SMEE_URL: ${{ steps.gosmee-ghe-webhook-url.outputs.url }}

docs/content/docs/guides/gitops-commands/push-commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ weight: 1
55

66
This page explains how to trigger GitOps commands on pushed commits. Use these commands when you want to retest or cancel PipelineRuns triggered by push events rather than pull requests.
77

8-
{{< support_matrix github_app="true" github_webhook="true" forgejo="false" gitlab="true" bitbucket_cloud="false" bitbucket_server="false" >}}
8+
{{< support_matrix github_app="true" github_webhook="true" forgejo="false" gitlab="true" bitbucket_cloud="false" bitbucket_datacenter="false" >}}
99

1010
You can trigger GitOps commands on a pushed commit by including them in your commit messages. Pipelines-as-Code supports two scopes:
1111

@@ -80,7 +80,7 @@ The following sections show how to add a GitOps comment on a pushed commit in ea
8080

8181
## Triggering PipelineRuns on Git Tags
8282

83-
{{< support_matrix github_app="true" github_webhook="true" forgejo="false" gitlab="true" bitbucket_cloud="false" bitbucket_server="false" >}}
83+
{{< support_matrix github_app="true" github_webhook="true" forgejo="false" gitlab="true" bitbucket_cloud="false" bitbucket_datacenter="false" >}}
8484

8585
**What it does:** You can retrigger a PipelineRun against a specific Git tag by commenting on the tagged commit. Pipelines-as-Code resolves the tag to its commit SHA and runs the matching PipelineRun against that commit.
8686

docs/content/docs/guides/running-pipelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ the pull request describing the error. Pipelines-as-Code also logs the error in
123123
Despite validation errors, Pipelines-as-Code continues to run other correctly parsed and matched PipelineRuns.
124124
However, a YAML syntax error in any PipelineRun halts the execution of all PipelineRuns, even those that are syntactically correct.
125125

126-
{{< support_matrix github_app="true" github_webhook="true" forgejo="true" gitlab="true" bitbucket_cloud="false" bitbucket_server="false" >}}
126+
{{< support_matrix github_app="true" github_webhook="true" forgejo="true" gitlab="true" bitbucket_cloud="false" bitbucket_datacenter="false" >}}
127127

128128
When an event triggers from a pull request, Pipelines-as-Code creates a new comment on
129129
the pull request detailing the error.

docs/content/docs/providers/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ Configure Pipelines-as-Code with your Git provider: GitHub, GitLab, Bitbucket, o
1212
{{< card link="github-webhook" title="GitHub Webhook" subtitle="Webhook-based GitHub setup" >}}
1313
{{< card link="gitlab" title="GitLab" subtitle="GitLab.com and self-hosted" >}}
1414
{{< card link="bitbucket-cloud" title="Bitbucket Cloud" subtitle="Bitbucket.org" >}}
15-
{{< card link="bitbucket-datacenter" title="Bitbucket Data Center" subtitle="Self-hosted Bitbucket Server" >}}
15+
{{< card link="bitbucket-datacenter" title="Bitbucket Data Center" subtitle="Self-hosted Bitbucket Data Center" >}}
1616
{{< card link="forgejo" title="Forgejo" subtitle="Forgejo and Gitea" >}}
1717
{{< /cards >}}

docs/content/docs/providers/bitbucket-datacenter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bitbucket Data Center
33
weight: 5
44
---
55

6-
This page covers how to configure Pipelines-as-Code with [Bitbucket Data Center](https://www.atlassian.com/software/bitbucket/enterprise). Use this method when your organization runs a self-hosted Bitbucket Server or Data Center instance.
6+
This page covers how to configure Pipelines-as-Code with [Bitbucket Data Center](https://www.atlassian.com/software/bitbucket/enterprise). Use this method when your organization runs a self-hosted Bitbucket Data Center instance.
77

88
## Prerequisites
99

pkg/pipelineascode/client_setup_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,16 +605,16 @@ func TestSetupAuthenticatedClientProviderSpecificEvents(t *testing.T) {
605605
description: "Bitbucket Cloud PR events should work",
606606
},
607607
{
608-
name: "Bitbucket Server PR opened",
608+
name: "Bitbucket Data Center PR opened",
609609
eventType: "pr:opened",
610610
wantErr: false,
611-
description: "Bitbucket Server PR opened events should work",
611+
description: "Bitbucket Data Center PR opened events should work",
612612
},
613613
{
614-
name: "Bitbucket Server push",
614+
name: "Bitbucket Data Center push",
615615
eventType: "repo:refs_changed",
616616
wantErr: false,
617-
description: "Bitbucket Server push events should work",
617+
description: "Bitbucket Data Center push events should work",
618618
},
619619
}
620620

pkg/pipelineascode/match.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (p *PacRun) verifyRepoAndUser(ctx context.Context) (*v1alpha1.Repository, e
123123
}
124124
// When /ok-to-test is approved, update the parent "Pipelines as Code CI" status to success
125125
// to indicate the approval was successful before pipelines start running.
126-
if p.event.EventType == opscomments.OkToTestCommentEventType.String() && p.vcx.GetConfig().Name == "gitea" {
126+
if p.event.EventType == opscomments.OkToTestCommentEventType.String() && !strings.Contains(p.vcx.GetConfig().Name, "github") {
127127
approvalStatus := providerstatus.StatusOpts{
128128
Status: CompletedStatus,
129129
Title: "Approved",

pkg/provider/github/acl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (v *Provider) CheckPolicyAllowing(ctx context.Context, event *info.Event, a
2525
members, resp, err := wrapAPI(v, "list_team_members_by_slug", func() ([]*github.User, *github.Response, error) {
2626
return v.Client().Teams.ListTeamMembersBySlug(ctx, event.Organization, team, &github.TeamListTeamMembersOptions{ListOptions: opt})
2727
})
28-
if resp.StatusCode == http.StatusNotFound {
28+
if resp != nil && resp.StatusCode == http.StatusNotFound {
2929
// we explicitly disallow the policy when the team is not found
3030
// maybe we should ignore it instead? i'd rather keep this explicit
3131
// and conservative since being security related.
@@ -321,7 +321,7 @@ func (v *Provider) GetStringPullRequestComment(ctx context.Context, runevent *in
321321

322322
gitOpsCommentPrefix := provider.GetGitOpsCommentPrefix(v.repo)
323323

324-
for {
324+
for page := 0; page < maxCommentPages; page++ {
325325
comments, resp, err := wrapAPI(v, "list_issue_comments", func() ([]*github.IssueComment, *github.Response, error) {
326326
return v.Client().Issues.ListComments(ctx, runevent.Organization, runevent.Repository,
327327
prNumber, opt)

pkg/provider/github/github.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ const (
4141
publicRawURLHost = "raw.githubusercontent.com"
4242

4343
defaultPaginedNumber = 100
44+
// maxCommentPages caps the number of pages fetched when scanning PR
45+
// comments (e.g. for /ok-to-test). With defaultPaginedNumber=100 this
46+
// allows up to 1000 comments, which is generous for legitimate use while
47+
// preventing rate-limit exhaustion from comment flooding.
48+
maxCommentPages = 10
4449
)
4550

4651
var _ provider.Interface = (*Provider)(nil)

test/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ this repo should differ from the one which is configured as part of `TEST_GITHUB
5555
- `TEST_GITEA_PASSWORD` - set password as **pac**
5656
- `TEST_GITEA_USERNAME` - set username as **pac**
5757
- `TEST_GITEA_REPO_OWNER` - set repo owner as **pac/pac**
58-
- `TEST_BITBUCKET_SERVER_USER` - Bitbucket Data Center Username
59-
- `TEST_BITBUCKET_SERVER_TOKEN` - Bitbucket Data Center token
60-
- `TEST_BITBUCKET_SERVER_E2E_REPOSITORY` - Bitbucket Data Center repository (i.e. `project/repo`)
61-
- `TEST_BITBUCKET_SERVER_API_URL` - URL where your Bitbucket Data Center instance is running.
62-
- `TEST_BITBUCKET_SERVER_WEBHOOK_SECRET` - Webhook secret
58+
- `TEST_BITBUCKET_DATA_CENTER_USER` - Bitbucket Data Center Username
59+
- `TEST_BITBUCKET_DATA_CENTER_TOKEN` - Bitbucket Data Center token
60+
- `TEST_BITBUCKET_DATA_CENTER_E2E_REPOSITORY` - Bitbucket Data Center repository (i.e. `project/repo`)
61+
- `TEST_BITBUCKET_DATA_CENTER_API_URL` - URL where your Bitbucket Data Center instance is running.
62+
- `TEST_BITBUCKET_DATA_CENTER_WEBHOOK_SECRET` - Webhook secret
6363

6464
- `PAC_API_INSTRUMENTATION_DIR` - Optional. When set, E2E tests write per-test JSON reports of GitHub API calls parsed from controller logs to this directory. Useful for analyzing API usage and rate limits. Example: `export PAC_API_INSTRUMENTATION_DIR=/tmp/api-instrumentation`.
6565

@@ -83,7 +83,7 @@ cp test/e2e-config.yaml.example test/e2e-config.yaml
8383

8484
The YAML file groups settings by provider section (`common`, `github`,
8585
`github_enterprise`, `gitlab`, `gitea`, `bitbucket_cloud`,
86-
`bitbucket_server`). See `test/e2e-config.yaml.example` for the full list of
86+
`bitbucket_datacenter`). See `test/e2e-config.yaml.example` for the full list of
8787
fields.
8888

8989
Environment variables always take precedence over YAML values, so you can use

0 commit comments

Comments
 (0)