Skip to content

Commit 58ed503

Browse files
authored
Merge branch 'main' into feat/add-repo-informer-cache
2 parents e1bac9f + 658e9d4 commit 58ed503

File tree

25 files changed

+621
-69
lines changed

25 files changed

+621
-69
lines changed

.github/workflows/e2e.yaml

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

113-
# Bitbucket Server
113+
# Bitbucket Data Center
114114
TEST_BITBUCKET_DATA_CENTER_API_URL: ${{ secrets.BITBUCKET_DATA_CENTER_API_URL }}
115115
TEST_BITBUCKET_DATA_CENTER_E2E_REPOSITORY: PAC/pac-e2e-tests
116116
TEST_BITBUCKET_DATA_CENTER_TOKEN: ${{ secrets.BITBUCKET_DATA_CENTER_TOKEN }}
@@ -296,7 +296,7 @@ jobs:
296296
TEST_BITBUCKET_CLOUD_TOKEN: ${{ secrets.BITBUCKET_CLOUD_TOKEN }}
297297
TEST_BITBUCKET_CLOUD_USER: cboudjna
298298

299-
# Bitbucket Server
299+
# Bitbucket Data Center
300300
TEST_BITBUCKET_DATA_CENTER_API_URL: ${{ secrets.BITBUCKET_DATA_CENTER_API_URL }}
301301
TEST_BITBUCKET_DATA_CENTER_E2E_REPOSITORY: PAC/pac-e2e-tests
302302
TEST_BITBUCKET_DATA_CENTER_TOKEN: ${{ secrets.BITBUCKET_DATA_CENTER_TOKEN }}

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ GOLANGCI_LINT=golangci-lint
55
GOFUMPT=gofumpt
66
TKN_BINARY_NAME := tkn
77
TKN_BINARY_URL := https://tekton.dev/docs/cli/\#installation
8+
DEFAULT_GOTESTSUM_FORMAT ?= testdox
89
LDFLAGS=
910
OUTPUT_DIR=bin
1011
GO = go
@@ -68,7 +69,7 @@ test-unit: ## Run unit tests
6869
@mkdir -p tmp/
6970
@echo "Running unit tests..."
7071
@if command -v gotestsum >/dev/null 2>&1; then \
71-
gotestsum --format testdox -- $(DEFAULT_GO_TEST_FLAGS) $(GO_TEST_FLAGS) -timeout $(TIMEOUT_UNIT) ./pkg/...; \
72+
gotestsum --format ${DEFAULT_GOTESTSUM_FORMAT} -- $(DEFAULT_GO_TEST_FLAGS) $(GO_TEST_FLAGS) -timeout $(TIMEOUT_UNIT) ./pkg/...; \
7273
else \
7374
$(GO) test $(DEFAULT_GO_TEST_FLAGS) $(GO_TEST_FLAGS) -timeout $(TIMEOUT_UNIT) ./pkg/...; \
7475
fi

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/adapter/sinker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (s *sinker) setupClient(ctx context.Context, repo *v1alpha1.Repository) err
159159
func (s *sinker) createSkipCIStatus(ctx context.Context) error {
160160
statusOpts := status.StatusOpts{
161161
Status: "completed",
162-
Conclusion: status.ConclusionNeutral,
162+
Conclusion: status.ConclusionSkipped,
163163
Title: "CI Skipped",
164164
Summary: fmt.Sprintf("%s - CI has been skipped", s.pacInfo.ApplicationName),
165165
Text: "Commit contains a skip CI command. Use /test or /retest to manually trigger CI if needed.",

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/gitea/gitea.go

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,36 @@ func (v *Provider) createStatusCommit(ctx context.Context, event *info.Event, pa
369369
return nil
370370
}
371371

372-
func (v *Provider) GetCommitStatuses(_ context.Context, _ *info.Event) ([]provider.CommitStatusInfo, error) {
373-
return nil, nil
372+
func (v *Provider) GetCommitStatuses(_ context.Context, event *info.Event) ([]provider.CommitStatusInfo, error) {
373+
if v.giteaClient == nil {
374+
return nil, fmt.Errorf("no gitea client has been initialized")
375+
}
376+
377+
statuses, _, err := v.Client().ListStatuses(
378+
event.Organization, event.Repository, event.SHA,
379+
forgejo.ListStatusesOption{},
380+
)
381+
if err != nil {
382+
return nil, err
383+
}
384+
385+
var (
386+
result []provider.CommitStatusInfo
387+
seen = map[string]struct{}{}
388+
)
389+
for _, s := range statuses {
390+
key := fmt.Sprintf("%s\x00%s", s.Context, string(s.State))
391+
if _, ok := seen[key]; ok {
392+
continue
393+
}
394+
seen[key] = struct{}{}
395+
result = append(result, provider.CommitStatusInfo{
396+
Name: s.Context,
397+
Status: string(s.State),
398+
})
399+
}
400+
401+
return result, nil
374402
}
375403

376404
func (v *Provider) GetTektonDir(_ context.Context, event *info.Event, path, provenance string) (string, error) {

0 commit comments

Comments
 (0)