Commit graph

1214 commits

Author SHA1 Message Date
hg
df5287bb65
Set CI_PREV_COMMIT_{SOURCE,TARGET}_BRANCH as mentioned in the documentation (#4001) 2024-08-08 19:01:59 +02:00
qwerty287
0d9e57d3da
Drop repo name fallback for hooks (#4013) 2024-08-08 07:50:38 +02:00
qwerty287
2081ca85db
Refactor JSON and SDK fields (#3968) 2024-08-07 10:49:03 +02:00
qwerty287
2d1bc9f15c
Move manual popup to own page (#3981) 2024-08-07 09:31:17 +02:00
qwerty287
c864f24ae4
Migrate to maintained cron lib and remove seconds (#3785)
Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
2024-08-06 19:22:28 +02: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
qwerty287
b330c19bf4
Migrate to maintained httpsign library (#3839)
Co-authored-by: 6543 <6543@obermui.de>
2024-07-23 20:41:37 +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
6543
1c7c87b8f0
Remove deprecated pipeline settings (#3916) 2024-07-23 13:06:47 +02:00
6543
d2b5e203b0
server: remove old unused routes (#3845) 2024-07-22 01:05:05 +02:00
qwerty287
8a277e7bd9
Improve cron list (#3947) 2024-07-20 18:15:38 +02:00
qwerty287
8e2ff338d8
Fix panic if forge is unreachable (#3944) 2024-07-20 11:46:51 +02:00
6543
764329ed1d
Make sure plugins only mount the workspace base in a predefinde location (#3933) 2024-07-18 22:52:22 +02:00
Harri Avellan
1274de2b2d
Handle empty repositories in gitea when listing PRs (#3925) 2024-07-18 04:30:45 -07:00
6543
cd5f6f71a2
Migrate to github.com/urfave/cli/v3 (#2951) 2024-07-18 01:26:35 +02: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
6543
757f5a58e2
Gracefully shutdown server (#3896) 2024-07-14 01:46:01 +02:00
Anbraten
43b82ba047
Convert to openapi 3.0 (#3897)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2024-07-13 15:55:13 +02:00
Anbraten
b12d676546
Allow login using multiple forges (#3822) 2024-07-13 01:41:35 -07:00
6543
bc02d376b2
Sort users by login (#3891) 2024-07-12 20:27:37 +02:00
Lauris BH
40b496f13b
Fix helper functions for MySQL syntax (#3874) 2024-07-12 18:18:55 +02:00
Anbraten
ceb14cadc5
Fix deploy task env (#3878) 2024-07-07 13:43:07 +02:00
Anbraten
b23fdaa6dc
Fix registry migration (#3871) 2024-07-04 01:29:56 -07:00
Lauris BH
28e982fffb
Global and organization registries (#1672)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-07-03 06:33:11 -07:00
Anbraten
918985c508
Add timestamp for last work done by agent (#3844) 2024-07-01 10:34:47 -07:00
Anbraten
2fa9432ef8
Cleanup state reporting (#3850) 2024-07-01 11:20:55 +02:00
Anbraten
2bda19024e
Use proper oauth state (#3847) 2024-06-27 16:52:09 +02:00
qwerty287
92cd0d04a3
Unify DB tables/columns (#3806)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-06-27 09:32:06 +02:00
Anbraten
b8b6efb352
Enhance token checking (#3842) 2024-06-27 00:08:59 +02:00
6543
4dcdebd786
Let webhook pass on pipeline parsion error (#3829) 2024-06-26 15:07:19 +02:00
6543
402938e216
Exclude mocks from release build (#3831) 2024-06-25 12:23:07 +02:00
Anbraten
b0f3883bd5
Cleanup of the login flow and tests (#3810) 2024-06-21 16:25:27 +02:00
Anbraten
1a39d57f71
Enhance authentication UX (#3807) 2024-06-21 09:55:30 +02:00
Anbraten
fbb96ff8f5
Add api for forges (#3733) 2024-06-20 13:08:54 +02:00
qwerty287
760a903a30
Add release event to webhooks (#3784) 2024-06-13 19:04:15 +02:00
Anbraten
8b387e73ee
Improve step logging (#3722) 2024-06-13 17:18:32 +02:00
Anbraten
1953a0ec5a
Fix repo creation (#3756) 2024-06-10 12:28:54 +02:00
qwerty287
c72468478d
Allow to store logs in files (#3568)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-06-06 14:34:57 +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
linghuying
f47f482985
chore: fix some comments (#3740)
Signed-off-by: linghuying <1599935829@qq.com>
2024-05-31 15:57:57 +02:00
Anbraten
fd57e4ad05
Use IDs for tokens (#3695) 2024-05-27 11:52:43 +02:00
Dan
6132136d55
Fix oauth file envvars (#3726)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-05-27 11:22:31 +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
6543
42f2734308
cspell lint go code (#3706) 2024-05-24 22:35:04 +02:00