Commit graph

159 commits

Author SHA1 Message Date
renovate[bot]
254310556a
fix(deps): update module github.com/google/go-github/v65 to v66 (#4205)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-07 07:56:59 +03:00
renovate[bot]
bc74af507e
fix(deps): update module github.com/google/go-github/v64 to v65 (#4185)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-05 15:46:36 +03:00
renovate[bot]
8e0af15e85
fix(deps): update module github.com/google/go-github/v63 to v64 (#4073)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-01 17:41:02 +02:00
qwerty287
eeec084293
Set refspec for gitlab MR (#4021) 2024-08-10 21:43:50 +03:00
Jener Rasmussen
f20327eb03
[Bitbucket Datacenter] Return empty list instead of null (#4010) 2024-08-06 18:31:50 +02:00
Patrick Schratz
106b6e01c0
Overhaul README (#3995) 2024-08-05 01:27:25 +02:00
Joan Flotats
2d6e1ea015
Fix BB PR pipeline ref (#3985) 2024-08-02 21:42:04 +02:00
Joan Flotats
ec02379b04
Use Bitbucket PR title for pipeline message (#3984) 2024-07-30 20:37:33 +02:00
Joan Flotats
047eb19d42
Change Bitbucket PR hook to point the source branch, commit & ref (#3965)
## Description

This is the first fix for: https://github.com/woodpecker-ci/woodpecker/issues/3932

Change the Pull Request hook parser to return the source commit, branch, and ref instead of the destination. Right now, the workflow pulls the destination configuration and code. It should pull the source configuration and code to verify that the configuration and code work as expected before merging the changes.

In case of the close event, the hook parser returns the destination branch, ref and merge commit. Usually, the contributor automatically deletes the source branch after merging the changes to the destination branch. Using the source values will cause the workflow to fail.

After the changes, Woodpecker will correctly download the workflow from the source branch (Pull Request commit), but it will fail to clone the repository. This issue is related to the commit format returned by the Bitbucket webhook. This inconsistency has already been reported: https://jira.atlassian.com/browse/BCLOUD-21201. The webhook returns a short SHA. The problem is that the `git fetch` command requires the full SHA. 

A workaround for this issue is to use the ref to fetch the code:

```yaml
clone:
  git:
    image: woodpeckerci/plugin-git
    settings:
      ref: ${CI_COMMIT_REF}
```

This is not ideal, because the Pull Request head won't always match the workflow commit, but it solves 80% of the event use cases (e.g. trigger a pull request workflow on change). This workaround won't work when re-running a previous workflow pointing to another commit, it will pull the last commit, not the previous one.

## Solutions

The solution proposed by the community is to retrieve the full SHA from the Bitbucket API using the short one. This solution has drawbacks:
- The Bitbucket API rate limit is 1000 req/h. This solution will reduce the maximum number of workflow runs per hour.
- It requires a braking change in the forges interface because the ´Hook(...)´ method does not have an instance of the HTTP Client. 

We propose to allow the git plugin to fetch the source code from a URL. The Bitbucket returns a link pointing to the commit. 

This proposal only requires a small change to the git plugin:
- Add a new optional parameter (e.g. CommitLink)
- Add a clause to the following conditional: 7ac9615f40/plugin.go (L79C1-L88C3)
```go
if p.Pipeline.CommitLink != "" {...}
```
Git commands:
```shell
$ git fetch --no-tags --depth=1 --filter=tree:0 https://bitbucket.org/workspace/repo/commits/692972aabfec
$ git reset --hard -q 692972aabfec # It works with the short SHA
```
Woodpecker will set CommitLink to a blank string for the other forges, but Bitbuckket will use the one returned by the webhook.
2024-07-23 16:58:38 +02:00
Joan Flotats
3a4ffe951e
Add updated, merged and declined events to bb webhook activation (#3963)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-07-23 14:17:58 +02:00
Harri Avellan
1274de2b2d
Handle empty repositories in gitea when listing PRs (#3925) 2024-07-18 04:30:45 -07:00
renovate[bot]
8aef8d2af9
fix(deps): update module github.com/google/go-github/v62 to v63 (#3910)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-14 07:58:35 +02:00
Anbraten
ceb14cadc5
Fix deploy task env (#3878) 2024-07-07 13:43:07 +02:00
6543
402938e216
Exclude mocks from release build (#3831) 2024-06-25 12:23:07 +02:00
Anbraten
1a39d57f71
Enhance authentication UX (#3807) 2024-06-21 09:55:30 +02:00
qwerty287
760a903a30
Add release event to webhooks (#3784) 2024-06-13 19:04:15 +02:00
qwerty287
d28e150534
Use http constants (#3766) 2024-06-06 11:16:45 +02:00
6543
4ec046e415
Spellcheck "server/*" (#3753)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-06-04 08:30:54 +02:00
qwerty287
91b122e1ce
Native forgejo support (#3684)
Co-authored-by: Robert Kaussow <xoxys@rknet.org>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2024-06-01 11:23:19 +02:00
renovate[bot]
bf4061b72d
fix(deps): update module github.com/google/go-github/v61 to v62 (#3730)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-26 18:18:34 +02:00
renovate[bot]
37ea906958
fix(deps): update golang-packages (#3713)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: qwerty287 <qwerty287@posteo.de>
2024-05-23 17:37:21 +02:00
Anbraten
5527d9bf86
Cleanup server env settings (#3670)
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
Co-authored-by: Robert Kaussow <xoxys@rknet.org>
2024-05-15 15:45:08 +02:00
Robert Kaussow
89e100cfd1
Add godot linter to harmonitze toplevel comments (#3650) 2024-05-13 22:58:21 +02:00
ianlv
6004e9907d
Correct function names (#3681)
Signed-off-by: ianlv <sunlvyun@outlook.com>
2024-05-04 14:13:43 +02:00
Fernando Barbosa
e6bda2c2b3
Support github deploy task (#3512)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-05-02 18:56:19 +02:00
qwerty287
fa4b1f76bd
Fix bitbucket dir fetching (#3668) 2024-05-01 12:22:07 +02:00
Robert Kaussow
7f776ebf18
Sanitize tag ref for gitea/forgejo (#3664) 2024-04-30 09:59:03 +02:00
Anbraten
d494b6a959
Use forge from db (#1417)
This is the first step towards support for multiple forges (#138). It
inserts a forge using the currently existing env varaibles into db and
uses this forge from db later on in all places of the code.

closes #621

addresses #138 

# TODO
- [x] add forges table
- [x] add id of forge to repo
- [x] use forge of repo
- [x] add forge from env vars to db if not exists
- [x] migrate repo.ForgeID to the newly generated forge
- [x] support cache with forge from repo
- [x] maybe add forge loading cache? (use LRU cache for forges, I expect
users to have less than 10 forges normally)

---------

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-04-16 08:04:55 +02:00
Robert Kaussow
781628816d
Fix make in_docker generate (#3616) 2024-04-15 17:46:44 +02:00
qwerty287
00f0fcd416
Rework addons (use rpc) (#3268)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-04-15 10:04:21 +02:00
qwerty287
b0c9dfd2cf
Fix bitbucket file fetching (#3604)
closes https://github.com/woodpecker-ci/woodpecker/issues/3600
2024-04-09 11:30:04 +02:00
qwerty287
c9a3bfb321
Fix spellcheck and enable more dirs (#3603) 2024-04-09 09:04:53 +02:00
renovate[bot]
50ddc61576
Update module github.com/google/go-github/v60 to v61 (#3595)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/google/go-github/v60](https://togithub.com/google/go-github)
| `v60.0.0` -> `v61.0.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgoogle%2fgo-github%2fv60/v61.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgoogle%2fgo-github%2fv60/v61.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgoogle%2fgo-github%2fv60/v60.0.0/v61.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgoogle%2fgo-github%2fv60/v60.0.0/v61.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>google/go-github (github.com/google/go-github/v60)</summary>

###
[`v61.0.0`](https://togithub.com/google/go-github/releases/tag/v61.0.0)

[Compare
Source](https://togithub.com/google/go-github/compare/v60.0.0...v61.0.0)

This release contains the following breaking API changes:

- feat!: Update deprecated endpoints in github/action_variables.go
([#&#8203;3104](https://togithub.com/google/go-github/issues/3104))

...and the following additional changes:

- Bump go-github from v59 to v60 in /scrape
([#&#8203;3087](https://togithub.com/google/go-github/issues/3087))
- Allow querying rule set information by ID with information returned
from GetRulesFromBranch
([#&#8203;3089](https://togithub.com/google/go-github/issues/3089))
- Bump codecov/codecov-action from 4.0.2 to 4.1.0
([#&#8203;3091](https://togithub.com/google/go-github/issues/3091))
- Bump github.com/PuerkitoBio/goquery from 1.9.0 to 1.9.1 in /scrape
([#&#8203;3092](https://togithub.com/google/go-github/issues/3092))
- Add Protection to Branch struct
([#&#8203;3095](https://togithub.com/google/go-github/issues/3095))
- Bump github.com/alecthomas/kong from 0.8.1 to 0.9.0 in /tools
([#&#8203;3097](https://togithub.com/google/go-github/issues/3097))
- Bump golang.org/x/net from 0.21.0 to 0.22.0 in /scrape
([#&#8203;3096](https://togithub.com/google/go-github/issues/3096))
- Bump google.golang.org/protobuf from 1.28.0 to 1.33.0 in /example
([#&#8203;3099](https://togithub.com/google/go-github/issues/3099))
- Add audit log rate limit category and make rate limit category getter
public
([#&#8203;3088](https://togithub.com/google/go-github/issues/3088))
- Update README.md
([#&#8203;3110](https://togithub.com/google/go-github/issues/3110))
- Allow Installation of Custom Properties Permissions
([#&#8203;3108](https://togithub.com/google/go-github/issues/3108))
- Add NotificationSetting to NewTeam
([#&#8203;3111](https://togithub.com/google/go-github/issues/3111))
- Fix pagination for ListCopilotSeats
([#&#8203;3112](https://togithub.com/google/go-github/issues/3112))
- Add .\*.local to .gitignore
([#&#8203;3115](https://togithub.com/google/go-github/issues/3115))
- Add CreateOrUpdateRepoCustomPropertyValues
([#&#8203;3109](https://togithub.com/google/go-github/issues/3109))
- Bump version of go-github to v61.0.0
([#&#8203;3118](https://togithub.com/google/go-github/issues/3118))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" (UTC), Automerge -
"before 4am" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/woodpecker-ci/woodpecker).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-06 08:00:59 +02:00
Aumetra Weisman
20b84a1aee
Add flag to only access public repositories on GitHub (#3566) 2024-03-29 14:36:48 +01:00
qwerty287
6abc112262
Fix gitea login (#3533)
Closes #3531
2024-03-21 19:18:22 +01:00
qwerty287
fbdfa14a00
Allow separate gitea oauth URL (#3513)
closes https://github.com/woodpecker-ci/woodpecker/issues/3470

---------

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
2024-03-21 11:37:02 +01:00
6543
e57a09a404
Update pipeline state on server as a whole on approval (#3504)
We can not just update some records for steps, as we want the pipeline
engine as single source of truth but not manage the state.
And the server should only manage the state but not how pipelines work.

We can match the pipeline but neither workflows or steps 1:1, so we
"update" them as a whole by deleting existing workflow and step data and
insert the new info from engine.

close   #3494
close  #3472

---------
*Sponsored by Kithara Software GmbH*

---------

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
2024-03-18 20:07:45 +01:00
renovate[bot]
5d98a717ac
fix(deps): update module github.com/google/go-github/v59 to v60 (#3493) 2024-03-16 09:37:08 +01:00
Robert Kaussow
a779eed3df
Enable golangci linter gomnd (#3171) 2024-03-15 18:00:25 +01:00
Thor Anker Kvisgård Lange
632c946511
feat: Remove user part of http clone url (#3462)
Some configuration of Bitbucket Datacenter seems to return username as
part of the clone URL. This needs to be removed for `.netrc` to work
properly.

Closes #3443

---------

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
2024-03-07 18:06:05 +01:00
Thor Anker Kvisgård Lange
ce51d65829
fix: Make sure to refresh access token when reading commit information (#3447)
When receiving notification by webhook the forge tries to read
information on the latest commit when constructing the pipeline. This
requires a call to the Bitbucket API which again requires the access
token to be up-to-date.

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
2024-02-27 17:15:11 +01:00
6543
10e4bac936
Parse email from Gitea webhook (#3420)
The CI_COMMIT_AUTHOR_EMAIL was empty for gitea/forgejo,
now the webhook is parsed correctly.
2024-02-22 09:02:19 +02:00
Thor Anker Kvisgård Lange
364d708923
Add bitbucket datacenter (server) support (#2503)
This pull-requests re-introduces the Bitbucket Server support with a
more or less complete rewrite of the forge implementation. We have a lot
of on-premises git repositories hosted in Bitbucket Server and need a CI
solution for running that and Woodpecker looks promising.

The implementation is based on external Bitbucket Server REST client
library which we are maintaining and have created in another context.
Besides the original support for Bitbucket the re-implementation also
adds support for handling Bitbucket pull-request events.
2024-02-20 15:58:02 +01:00
renovate[bot]
4e44dd0e76
fix(deps): update module github.com/google/go-github/v58 to v59 (#3398) 2024-02-17 09:04:33 +01:00
qwerty287
451af535d3
Replace http types on forge interface (#3374) 2024-02-13 16:19:02 +01:00
Anbraten
82e1ce937c
Refactor internal services (#915) 2024-02-11 18:42:33 +01:00
qwerty287
e1521ef460
Set correct link for commit (#3368)
Closes https://github.com/woodpecker-ci/woodpecker/issues/2657
Closes https://github.com/woodpecker-ci/woodpecker/issues/906
2024-02-11 10:44:50 +01:00
Anbraten
9e96c9c25e
Fix correctly handle gitlab pr closed events (#3362)
closes #3355
2024-02-09 16:49:04 +01:00
Lukas
5cedc956e9
Ignore gitlab merge request events without code changes (#3338)
Closes #3320 

From the gitlab docs at:
https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#merge-request-events

> The field object_attributes.oldrev is only available when there are
actual code changes
2024-02-07 01:45:00 +01:00
Lukas
baf2e645bc
Ignore gitlab push events without commits (#3339)
Example of the resulting buggy pipeline:


![image](https://github.com/woodpecker-ci/woodpecker/assets/32853499/1e4bedc6-465b-466e-8d89-a7348e374c7f)
2024-02-07 02:24:08 +02:00