qwerty287
849e05bb8b
Rename build
to pipeline
in code ( #1224 )
...
Ref: #745
Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: 6543 <6543@obermui.de>
2022-10-18 03:24:12 +02:00
Lukas
12ff74c4cb
Fix branch loading ( #1249 )
...
Fixes a panic I got while viewing the branches in the UI.
```
runtime error: index out of range [0] with length 0
/home/gitpod/go/src/runtime/panic.go:113 (0x44053e)
goPanicIndex: panic(boundsError{x: int64(x), signed: true, y: y, code: boundsIndex})
/workspace/woodpecker/server/remote/gitea/gitea.go:444 (0xd36764)
(*Gitea).Branches.func1: result[i] = branches[i].Name
/workspace/woodpecker/server/remote/common/utils.go:34 (0xd3942a)
Paginate[...]: batch, err := get(page)
/workspace/woodpecker/server/remote/gitea/gitea.go:439 (0xd36665)
(*Gitea).Branches: branches, err := common.Paginate(func(page int) ([]string, error) {
/workspace/woodpecker/server/api/repo.go:202 (0xc823a1)
GetRepoBranches: branches, err := r.Branches(c, user, repo)
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xc71d44)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/session/repo.go:148 (0xc71bba)
MustPull: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xc71aee)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/session/repo.go:139 (0xc71aaa)
SetPerm.func1: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xc71251)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/session/repo.go:53 (0xc710ec)
SetRepo.func1: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xccb50f)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/token/token.go:50 (0xccb248)
Refresh: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xc721fc)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/session/user.go:72 (0xc721e3)
SetUser.func1: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xcd069e)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/store.go:29 (0xcd0685)
Store.func1: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xccff47)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/logger.go:23 (0xccff2a)
Logger.func1: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xccaf99)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/header/header.go:38 (0xccaec4)
Options: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xccae21)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/middleware/header/header.go:30 (0xccae06)
NoCache: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xccf32a)
(*Context).Next: c.handlers[c.index](c)
/workspace/woodpecker/server/router/router.go:39 (0xccf310)
Load.func1: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xa2e0c1)
(*Context).Next: c.handlers[c.index](c)
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/recovery.go:101 (0xa2e0ac)
CustomRecoveryWithWriter.func1: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/context.go:173 (0xa2cf30)
(*Context).Next: c.handlers[c.index](c)
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/gin.go:616 (0xa2cb98)
(*Engine).handleHTTPRequest: c.Next()
/workspace/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/gin.go:572 (0xa2c6dc)
(*Engine).ServeHTTP: engine.handleHTTPRequest(c)
/home/gitpod/go/src/net/http/server.go:2947 (0x79cc4b)
serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/home/gitpod/go/src/net/http/server.go:1991 (0x797e66)
(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/home/gitpod/go/src/runtime/asm_amd64.s:1594 (0x476d80)
goexit: BYTE $0x90 // NOP
```
Co-authored-by: Anbraten <anton@ju60.de>
2022-10-09 21:10:36 +02:00
6543
c7fd1eb9d4
Introduce and use Pagination helper func ( #1236 )
2022-10-08 18:25:32 +02:00
[X]
3130a1c523
Fetch all branches from gitea ( #1231 )
...
Both repo branch view and manual branch selector were limited to the
stock pageSize of gitea client.
this add a loop to fetch all branches from gitea
2022-10-06 19:52:12 +02:00
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
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
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
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
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
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
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
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
3bee9044f1
Add flag to set oauth redirect host in dev mode ( #586 )
2021-12-13 20:22:09 +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
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
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
Anbraten
bb37836600
Replace drone strings with woodpecker ( #391 )
...
Co-authored-by: 6543 <6543@obermui.de>
2021-10-02 10:59:34 +02:00
6543
e3499f610d
Pass down context.Context ( #371 )
...
* pass context down to remote clients
* make tests work
* add ctx to Refresh() and use it
* bitbucketserver
* code format
* plugin interface: add todo context
* solve todo
* RM TODO by using context.WithTimeout
* refactor & fix
* Apply suggestions from code review
Co-authored-by: Anbraten <anton@ju60.de>
* go fmt
* Update server/remote/coding/coding.go
Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: Anbraten <anton@ju60.de>
2021-09-28 12:56:59 +02:00
6543
a94807efeb
Refactor: move model/ to server/model/ ( #366 )
2021-09-27 19:51:55 +02:00
6543
06d83c7b0e
Remote Gitea drop basic auth support ( #365 )
...
you now have to set **gitea-client** and **gitea-secret**.
2021-09-27 08:11:11 +02:00
6543
0bd10fa507
Cleanup Code ( #348 )
...
* Fix "Empty slice declaration using a literal"
* Fix "collides with imported package name"
* Remove unused code in pipeline
* Remove unused oauth2.providerAuthHeaderWorks()
* Add TODOs
* Format Code
* Cleanup doublestar import
* Migrate deprecated functions
Co-authored-by: Anbraten <anton@ju60.de>
2021-09-24 16:29:26 +02:00
Jacob Floyd
780c902a6b
Refactor: move remote/ to server/remote/ ( #344 )
2021-09-23 18:25:51 +02:00