Commit graph

855 commits

Author SHA1 Message Date
Josh Soref
12cbe15de0
Fix spelling: gitlab (#1411)
This is most of the GitLab changes that I dropped from #1405. 

As before, I'm happy to adjust things...

<details><summary>Problematic Changes</summary>

Fwiw, this is the part that causes the tests to break (I don't
understand why, but I'm leaving this change out):

```patch
commit 703cbe3ed398bf32535120ead733b80aa145c8db
Author: Josh Soref <2119212+jsoref@users.noreply.github.com>
Date:   Tue Nov 8 17:09:06 2022 -0500

    event?! -- this seems broken

diff --git a/server/forge/gitlab/testdata/hooks.go b/server/forge/gitlab/testdata/hooks.go
index 7d39306..e394afc 100644
--- a/server/forge/gitlab/testdata/hooks.go
+++ b/server/forge/gitlab/testdata/hooks.go
@@ -27,7 +27,7 @@ var (
 	ServiceHookHeaders = http.Header{
 		"Content-Type":   []string{"application/json"},
 		"User-Agent":     []string{"GitLab/14.3.0"},
-		"X-Gitlab-Event": []string{"Service Hook"},
+		"X-GitLab-Event": []string{"Service Hook"},
 	}
 )
 
diff --git a/shared/token/token.go b/shared/token/token.go
index 3f15537..191e5ee 100644
--- a/shared/token/token.go
+++ b/shared/token/token.go
@@ -64,7 +64,7 @@ func ParseRequest(r *http.Request, fn SecretFunc) (*Token, error) {
 		return parse(bearer, fn)
 	}
 
-	token = r.Header.Get("X-Gitlab-Token")
+	token = r.Header.Get("X-GitLab-Token")
 	if len(token) != 0 {
 		return parse(token, fn)
 	}

```
</details>

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2022-11-09 17:16:17 +01:00
Josh Soref
023d03dd61
Spelling (#1405)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-11-09 08:12:17 +01:00
6543
18311d4360
Split and refactor (#1394)
Closes #974
2022-11-06 12:44:04 +01:00
qwerty287
3372d1a87c
Rename remote to forge (#1357)
As of #745

Co-authored-by: Anbraten <anton@ju60.de>
2022-11-05 00:35:06 +01:00
Michael
2477d2e57f
Support .yaml as file-ending for workflow config too (#1388)
This implements #1073, adds .yaml to the accepted endings for woodpecker configs.

This currently adds some more lines to the duplication (tried to compensate by fixing the other duplication in the configFetcher) as the CLI and Server are still separate.
2022-11-03 19:12:40 +01:00
Joonhyeok Ahn (Joon)
aed3a80287
Migrate sql querys to xorm query builder (#1356)
Co-authored-by: 6543 <6543@obermui.de>
2022-10-31 16:08:57 +01:00
Divya Jain
280d27d723
Fix pipeline cancel API endpoint and update Web and CLI clients (#1372)
Fixes #1369 

Co-authored-by: Anbraten <anton@ju60.de>
2022-10-30 14:39:01 +01:00
qwerty287
8f183c82a8
Support changed files for Gitea PRs (#1342)
- add tests to fetch changed files
- ignore error if gitea version is to low
- adjust docs accordingly

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
2022-10-28 19:17:30 +02:00
Harikesh00
36e42914fa
Renamed procs/jobs to steps in code (#1331)
Renamed `procs` to `steps` in code for the issue #1288

Co-authored-by: Harikesh Prajapati <harikesh.prajapati@druva.com>
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2022-10-28 17:38:53 +02:00
qwerty287
e568c42e84
Support plugin-only secrets (#1344)
Closes #1071
2022-10-27 04:21:07 +02:00
qwerty287
de4e62cfcf
Allow to run cron manually (#1338)
Closes #1154
2022-10-26 01:23:28 +02:00
qwerty287
f88c70b55e
Rename to pipeline in DB and JSONs (#1296)
Closes #1282 

Follow-up to #1224, addresses #745

- changes JSON fields
- adds migration to rename columns
- fixes some comments
2022-10-22 15:54:43 +02:00
Joonhyeok Ahn (Joon)
186aee61cf
Check if repo exists before creating pipeline (#1297)
Close #1257

make sure the repo exists first before triggering the pipeline
2022-10-22 01:34:11 +02:00
6543
0bad73860f
Remove old build api routes (#1283) 2022-10-18 07:51:12 +02:00
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
Avinil Bedarkar
493ec45be6
Return return 404 if registry to delete do not exist (#1278)
Closes #524

Co-authored-by: 6543 <6543@obermui.de>
2022-10-18 01:48:04 +02:00
Avinil Bedarkar
11f37f4649
Converting all inputs which are coming as secret to lowercase (#1276)
Closes #926

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2022-10-16 14:58:13 +02:00
Lauris BH
86bc8b46ed
Change build message column type to text (#1252)
Fixes #1115
Fixes #1194
2022-10-13 00:47:11 +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
Anbraten
287800ac62
Add when evaluate filter (#1213)
closes #312 
closes #224
closes #963

Have a look for

https://github.com/antonmedv/expr/blob/master/docs/Language-Definition.md
2022-10-06 01:49:23 +02:00
Anbraten
f1339412eb
Fix invalid service names for Kubernetes (#1234)
closes #1232
2022-10-05 13:39:48 +02:00
6543
612eee8269
Sort secret lists and events (#1223)
close  #1176
2022-09-29 22:46:20 +02:00
6543
5d7fdbc71c
fix: create secret for manual build (#1222) 2022-09-29 07:30:05 +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
[X]
b4d89a1cce
Add ability to trigger manual builds (#1156)
closes #83 
closes #240 

Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2022-09-27 11:05:00 +02:00
Zav Shotan
ec9b0a62a7
Add support for pipeline root.when conditions (#770)
Co-authored-by: Zav Shotan <zshotan@bloomberg.net>
Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: 6543 <6543@obermui.de>
2022-09-26 09:27:20 +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
想出网名啦
eaf05dbae8
On Repo update, keep old "Clone" if update would empty it (#1170)
fixed #1169 

after debugging, I found that:
if `Clone` in database is empty, before
https://github.com/woodpecker-ci/woodpecker/blob/master/server/api/hook.go#L128,
the `repo.Clone` be always unset, so clone is failed.

This PR makes the empty `Clone` can't overwrite the value in database.
2022-09-07 17:34:08 +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
Anbraten
d8f598c2ad
Only enable debug endpoints if log level is debug or below (#1160) 2022-09-03 20:48:53 +02:00
Anbraten
5ca7ede9e4
Improve logging (#1158)
* switch default log level to info add start message and cleanup server start
* refactor code
* fix agent debug / trace logging
2022-09-03 20:41:23 +02:00
Anbraten
7db7e97f3f
fix (auto) cancel of blocked pipelines (#1157) 2022-09-02 22:14:38 +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
18c1807f4f
Create mock for store and add unit tests for cron (#1146)
* pass remote on init as argument like store

* mock store

* TestCreateBuild
2022-09-01 01:19:49 +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
ca84f703e3
Add default event filter (#1140)
breakout from #934

when new events are added you don't have to worry that pipeline will behave different as it does now with this

Co-authored-by: Anbraten <anton@ju60.de>
2022-08-30 00:36:37 +02:00
6543
ae771a9931
Fix migration number (#1134) 2022-08-27 23:58:52 +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
f21d854114
Move away from deprecated go funcs (#1123) 2022-08-25 08:39:19 +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
5a945c10e9
Fix to show build pipeline parse error (#1066) 2022-08-15 14:37:46 +02:00
Lauris BH
1ac2c42652
Add global and organization secrets (#1027)
* Implement database changes and store methods for global and organization secrets

* Add tests for new store methods
* Add organization secret API and UI
* Add global secrets API and UI

* Add suggestions

* Update warning style

* Apply suggestions from code review

Co-authored-by: Anbraten <anton@ju60.de>

* Fix lint warning

Co-authored-by: Anbraten <anton@ju60.de>
2022-08-14 13:48:53 +02:00
qwerty287
bed3ef104c
Support Docker credential helpers (#1075)
* support docker credential and add docker-credential-ecr-login into alpine image

* Remove ecr from docker and add docs

* Update docs/docs/30-administration/22-backends/10-docker.md

Co-authored-by: WeStone <xuecanlong@qq.com>
Co-authored-by: Anbraten <anton@ju60.de>
2022-08-14 10:46:18 +02:00
Dejan SANADER
7a4827bbf6
Fix duplicate pipeline status in GitLab (#1095) 2022-08-12 17:49:40 +02:00
Lauris BH
550aefead4
Make returned proc list to be returned always in correct order (#1060) 2022-08-02 18:34:16 +02:00