Commit graph

62 commits

Author SHA1 Message Date
qwerty287 7838f84b69
Fix SCM visibility if user visibility is private (#1217)
Closes https://codeberg.org/Codeberg-CI/feedback/issues/74
2022-09-27 21:24:33 +02:00
Martin Herren 1d47da647b
[Bitbucket] Use workspaces instead of deprecated/removed teams path (#1166)
Crude fix to allow to correctly list workspaces for bitbucket cloud
(https://bitbucket.org) and so run a pipeline.
Last year they removed a bunch of deprecated APIs and replaced them with
new ones.

Signed-off-by: Martin Herren <martin.herren@gmail.com>
Co-authored-by: Martin Herren <martin.herren@ecorobotix.com>
Co-authored-by: 6543 <6543@obermui.de>
2022-09-18 09:26:13 +02:00
qwerty287 6433dfea23
Use package's structs and fix missing clone (#1172)
Closes #1169

Replaces structs that were added inline in hook structs with structs of
the corresponding SDKs. This makes it more readable and error-proof.
2022-09-07 18:16:40 +01:00
qwerty287 52d3652f2e
Fetch repositories with remote ID if possible (#1078)
Use IDs of the forge to fetch repositories instead of their names and owner names. This improves handling of renamed and transferred repos.

TODO

- [ ] try to support as many forges as possible
    - [x] Gogs (no API)
    - [ ] Bitbucket Server
    - [x] Coding (no API?)
- [x] update repo every time it is fetched or received from the forge
- [x] if repo remote IDs are not available, use owner / name to get it
- [x] handle redirections (redirect a renamed repo to its new path)
- [x] ~~pull all repos once during migration to update ID (?)~~ issue fixed by on-demand loading of remote IDs
- [x] handle redirections in web UI
- [ ] improve handling of hooks after a repo was renamed (currently it checks for a redirection to the repo)
- [x] tests
- [x] `UNIQUE` constraint for remote IDs after migration shouldn't work (all repos have an empty string as remote ID)

close #854
close #648 partial
close https://codeberg.org/Codeberg-CI/feedback/issues/46

Possible follow-up PRs
- apply the same scheme on everything fetched from the remote (currently only users)

Co-authored-by: 6543 <6543@obermui.de>
2022-09-05 17:08:51 +02:00
6543 4afddc2821
Extract commit message from branch creation (#1150)
if commit already exist

close https://codeberg.org/Codeberg-CI/feedback/issues/52
2022-09-02 16:41:51 +02:00
6543 3f2af06bbc
Respect WOODPECKER_GITEA_SKIP_VERIFY (#1152) 2022-09-01 22:48:33 +02:00
6543 383f273392
Add cron feature (#934)
https://woodpecker-ci.org/docs/usage/cron

Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2022-09-01 00:36:32 +02:00
6543 08a99152d6
Dedup code and migrate away from deprecated funcs (#1141)
Co-authored-by: Anbraten <anton@ju60.de>
2022-08-30 01:14:07 +02:00
6543 f15b27aadf
Remove own copy of oauth2 implementation (#1127)
at some point (~7years ago) the oauth2 implementation was copied into the code-base and never touched.
We only use it for gitlab the rest is already back using std.

This migrates to the std oauth2 implementation
2022-08-26 21:42:41 +02:00
6543 a4453dc5af
Implement Refresher for GitLab and refactor nits (#1031)
* refactor & update gitea remote

* refactor & update gitlab remote

* gitlab remote: add Refresh()

* change as suggested by @dsanader
2022-08-24 15:46:11 +02:00
Dejan SANADER 7a4827bbf6
Fix duplicate pipeline status in GitLab (#1095) 2022-08-12 17:49:40 +02:00
Lauris BH 19dfc331f4
Add method to check organization membership (#1037)
* Add remote method to check organization membership
* Use named return parameters in interface
* Add membership check service
* Update Gitea SDK
2022-07-25 03:09:35 +02:00
qwerty287 42c745362b
Show forge icons in UI (#987) 2022-06-17 20:14:01 +02:00
6543 d06dfc86b4
Allow gitea dev version (#914)
* update gitea sdk to latest
* As before try to autodetect gitea version, if this does not work, assume it's latest version (v1.17.0 atm)
2022-05-14 17:34:40 +02:00
qwerty287 be0dfb280c
Add branches support for BitBucket (#907) 2022-05-12 19:31:01 +02:00
qwerty287 6568751320
Allow to change forge status messages (#900)
Allow to change the status message via template option

Closes https://github.com/woodpecker-ci/woodpecker/issues/855
2022-05-12 19:07:33 +02:00
qwerty287 ecc25395aa
Branch list enhancements (#808)
* Allow users not logged in to access branches page
  (fixes a nil pointer derefernce)

* Add Gogs support for branches
2022-02-26 17:36:00 +01:00
Anbraten 52d8097290
Get Netrc machine from clone url (#800)
We previously got the machine hostname for Netrc from the url of the remote, but in cases where the clone-url does not match the api url this can lead to errors.
2022-02-26 02:54:15 +01:00
6543 8ae124d5e6
Remove unused code (#797)
* delete empty code files

* delete outdated readme

* delete unused code

* dedup license
2022-02-25 21:42:45 +01:00
qwerty287 28e96a3851
View better error if repo was deleted/renamed (#780)
If the repo was renamed, there's an issue with Gitea: it redirects the /api/v1/repos/<owner>/<repo>/hooks POST request to a GET request at the same URL.
This URL returns the list of all hooks, thus the Gitea SDK can't parse the response into a single gitea.Hook type.

A better error is also visisble if the repo was deleted.
2022-02-24 14:54:05 +01:00
Anbraten 6af94d79e3
Remove unused flags / options (#693)
Some flags where unused and / or unnecessary as they are covered by alternatives implemented in PRs of milestone 0.15.0 and just complicated the setup.

closes #681
2022-01-31 15:38:00 +01:00
6543 071bd7418a
Fix tests and pipeline (#732)
* fix pipeline

* use EqualStringSlice to compare slices in tests

* full test coverage

* tests: wait for mysql/postgres to sync ...
2022-01-31 14:39:53 +01:00
6543 edbf6a3ba9
Allow to change status context again (#674)
* use flag value

* fix test

* sed -i 's/STATUS_CONTEXT/WOODPECKER_STATUS_CONTEXT/g'

* docs

* Update docs/docs/91-migrations.md

Co-authored-by: Anbraten <anton@ju60.de>
2022-01-29 20:37:36 +01:00
Anbraten 401072abb1
Support ChangedFiles for Github & Gitlab PRs and Gitlab pushes (#697) 2022-01-17 23:46:59 +01:00
Anbraten 2f780193b1
github tag build should not have changed files (#698) 2022-01-16 18:44:44 +01:00
6543 5a120db69d
remove "panic()" as much as posible from code (#682) 2022-01-09 23:27:30 +01:00
6543 8489b5bd37
Gitea: push webhook notice changed files of all related commits (#675)
* getChangedFilesFromPushHook: use all commits

* add test
2022-01-08 22:16:07 +01:00
6543 1588495b1a
Build ref link point to commit not compare if only one commit was pushed (#673)
close #401
2022-01-08 22:06:00 +01:00
6543 2f91bdd4a0
gofumpt -w -l -extra . (#661) 2022-01-05 21:50:23 +01:00
jdoubleu 132d3567f4
skip nested GitLab repositories during sync (#656)
Implements https://github.com/woodpecker-ci/woodpecker/pull/651#issuecomment-1003794674, partly fixes #648
2022-01-03 16:35:46 +01:00
Anbraten 7e6765ce95
hotfix gitlab sub repo listing (#652) 2022-01-03 16:35:17 +01:00
Anbraten f7d1451ca3
pass repo to remote perm func (#653)
* pass repo to remote perm func

* go:generate mockery

Co-authored-by: 6543 <6543@obermui.de>
2022-01-03 15:33:36 +01:00
Anbraten 8e8f8967c3
Improve status updates (#561)
- link to specific proc (only general build before)
- set status for all procs (before: only for the whole build on some SCMs)
- set status after restart
- set status to pending after waiting for approval
- make status of gitlab, gitea & github equal
- dedupe status update code
- dedupe `PostBuild` code

close #410, close #297, close #459, close #521
2021-12-28 17:02:49 +01:00
Anbraten ed0a9fd756
Use gitlab generic webhooks instead of drone-ci-service (#620)
Benefits:
- the webhook delivery history of the drone-ci-service is broken (no way to check if a webhook was successfully delivered by Gitlab)
- drone-ci-service has limited events support (for example no comment or branch deleted event)
- independent from drone integration in general
2021-12-19 01:12:09 +01:00
Anbraten 3bee9044f1
Add flag to set oauth redirect host in dev mode (#586) 2021-12-13 20:22:09 +01:00
6543 0e89923854
rm workaround for gitlab webhook parsing (#601)
upstream got merged: https://github.com/xanzy/go-gitlab/pull/1282
possible because of #599
2021-12-12 21:40:36 +01:00
Anbraten cb97b39c82
Fix pr secret event names (#592)
* Fix pr secret event names
* Add validation for secret events
2021-12-11 02:37:40 +01:00
Lukas 680d003a29
Add linter revive (#554)
* Add linter revive

* Add underscore to variable name to prevent shadowing

* Remove unnecessary leading underscore

* Revert changes to vendor file

* export ConfigFetcher as interface

* no 'yoda conditions'

* rename envsubst

Co-authored-by: 6543 <6543@obermui.de>
2021-12-01 14:22:06 +01:00
Lukas 2c75a299e2
Add linter unused (#551) 2021-11-27 15:29:37 +01:00
6543 5e6b38e0e7
Server obtain remote from glob config not from context (#540) 2021-11-26 13:01:54 +01:00
Lukas fac0e16996
Add linter staticcheck (#535)
* Add linter staticcheck

Co-authored-by: 6543 <6543@obermui.de>
2021-11-25 17:15:36 +01:00
Lukas 25bf91bd37
Add linter whitespace (#531) 2021-11-24 01:31:11 +01:00
6543 fe31fb1e06
Drop error only on purpose or else report back or log (#514)
- Remove Deadcode
- Simplify Code
- Drop error only on purpose
2021-11-23 15:36:52 +01:00
6543 51617e7f86
Rename struct field and add new types into server/model's (#523)
Resolve some todos in server/model:
 * Move persistent queue into its own package
 * Create Types: StatusValue, SCMKind, RepoVisibly
 * Rename struct Repo fields: SCMKind, IsSCMPrivate
2021-11-22 12:55:13 +01:00
6543 aca5fddcf3
Use Goblin Assert as intended (#501)
this allow for better debugging if an error occur
2021-11-04 14:42:25 +01:00
6543 473a05d5b5
Update gogs client (#487)
* update github.com/gogits/go-gogs-client

* migrate

* fix test & use DefaultBranch
2021-10-28 10:09:27 +02:00
Anbraten d35f5158bc
Add repo branches endpoint (#481)
* add repo branches endpoint

* add branches func to remotes
2021-10-27 02:47:55 +02:00
Anbraten 63a93087a1
Gitea use default branch (#480)
instead of hard-coded default branch use what gitea tell us
2021-10-27 00:37:01 +02:00
6543 5990d32fd3
More logging and refactor (#457)
* only use "context"
* enable 'h2' support at server
* trace log  remote and database config
* log loglevel on start
2021-10-19 11:44:49 +02:00
John Olheiser 4276a04f0c
Move entirely to zerolog (#426)
Completely switch to zerolog

(Remove usage of logrus and std logger)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2021-10-12 09:25:13 +02:00