Commit graph

1139 commits

Author SHA1 Message Date
renovate[bot] 57dd88f94a
fix(deps): update module github.com/google/go-github/v57 to v58 (#3187) 2024-01-13 08:13:22 +01:00
Robert Kaussow 9bbba4441d
Enable golangci linter forcetypeassert (#3168)
Split out from https://github.com/woodpecker-ci/woodpecker/pull/2960
2024-01-12 02:01:02 +01:00
Robert Kaussow f813badcf9
Enable golangci linter contextcheck (#3170)
Split out from https://github.com/woodpecker-ci/woodpecker/pull/2960
2024-01-11 22:15:15 +01:00
qwerty287 d0380e31b5
Remove panic recovering (#3162) 2024-01-11 19:37:47 +01:00
qwerty287 b0a2b1cf2d
Lowercase all log strings (#3173)
from #3161

---------

Co-authored-by: 6543 <6543@obermui.de>
2024-01-11 19:17:07 +01:00
Robert Kaussow 7756c60a33
Enable golangci linter stylecheck (#3167)
This PR only fixes error string formatting, log message strings are
still mixed upper/lowercase (see
https://github.com/woodpecker-ci/woodpecker/pull/3161#issuecomment-1885140649)
and I'm not aware of a linter to enforce it.
2024-01-10 22:56:42 +01:00
qwerty287 00df53e941
Clean up logging (#3161)
- use `Err` method instead of format strings
- use `Msg` if no format string is used
2024-01-10 20:57:12 +01:00
qwerty287 12c40eb957
Enable gocritic and don't ignore globally (#3159)
Use `nolint` directives instead.

From #2960
2024-01-10 15:34:44 +01:00
qwerty287 1b380ff4b4
Enable nolintlint (#3158) 2024-01-10 12:11:18 +01:00
qwerty287 768fd71841
Enable some linters (#3129)
Mostly those that did not require much work.

From #2960

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-09 21:35:37 +01:00
6543 a63135363b
Step status update dont set to running again once it got stoped (#3151)
Because of the check `if step.Stopped == 0`

without the check there are edgecases where could be the case a stoped
steped can be markt as running again, witch is wrong.

I do remember we have "running" steps indefinetly in cancled pipelines.
This could be the fix, i just did not test that specific.

Anyway the func hat a good testcoverage ... so just look at the tests

_Source:
https://github.com/woodpecker-ci/woodpecker/pull/3143#discussion_r1446138088_
2024-01-09 18:34:55 +01:00
6543 aab2f0e675
Use step uuid instead of name in GRPC status calls (#3143)
close #3109

~~also fix start time of steps to be set correctly~~ edgecase do not hit
anymore as we have a clear sepperation between workflows and steps now
:)

---------

Co-authored-by: Anbraten <anton@ju60.de>
2024-01-09 15:39:09 +01:00
6543 cd59a85230
Use name in backend types instead of alias (#3142) 2024-01-09 15:22:59 +01:00
qwerty287 106508a094
Make config linking non-unique (#3128)
closes https://github.com/woodpecker-ci/woodpecker/issues/3093
2024-01-07 16:12:27 +01:00
qwerty287 ef1d286596
Allow PR secrets to be used on close (#3084)
closes https://github.com/woodpecker-ci/woodpecker/issues/3071

1. If a secret can be used on PRs, it can also be used on PR close.
2. If no events are set, disallow access to secret. This was different
before, secrets without any event set were allowed for all events.
3. Compare strings instead of patterns.

---------

Co-authored-by: 6543 <6543@obermui.de>
2023-12-31 21:43:24 +01:00
qwerty287 72ae8828ca
Load changed files for closed PR (#3067) 2023-12-29 22:50:31 +01:00
qwerty287 a37af3eeac
Add imports checks to linter (#3056)
supersedes https://github.com/woodpecker-ci/woodpecker/pull/874

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-29 21:19:42 +01:00
6543 74f6824d03
Add option to disable version check in admin web UI (#3040)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-12-27 22:16:15 +01:00
qwerty287 05f26bab00
Add another testcase (#3035)
Actually wanted to add this to #3030 but @6543 was too fast…
2023-12-27 10:51:39 +01:00
qwerty287 e575ffe72d
Add some tests (#3030) 2023-12-27 10:36:49 +01:00
Anbraten f01ac3f0a3
Add pull request closed event (#2684)
- [x] updates docs
- [x] adjust UI
  - [x] show correct icon
  - [x] show correct link (to pr)
  - [x] add as option in secret edit
- [x] parse webhook
- [x] update tests
  - [x] github merged
  - [x] github closed
  - [x] gitea merged
  - [x] gitea closed
  - [x] bitbucket merged
  - [x] bitbucket closed
  - [x] gitlab merged
  - [x] gitlab closed

closes #286
2023-12-26 19:22:52 +01:00
devlux 5671956a31
Correct http cache headers for firefox (#3017)
Co-authored-by: Luca Marinucci <luca.marinucci@devlux.ch>
Co-authored-by: Anbraten <anton@ju60.de>
2023-12-26 08:37:13 +01:00
6543 3f1f563180
fix and lint swagger file (#3007)
Co-authored-by: qwerty287 <ndev@web.de>
2023-12-24 15:50:01 +01:00
qwerty287 04d1f9ff5f
Support more addon types (#2984)
Actually support all types that can be possible.

Closes https://github.com/woodpecker-ci/woodpecker/discussions/2520
2023-12-24 13:26:23 +01:00
Anbraten 2b1e5f35de
Add depends_on support for steps (#2771)
Co-authored-by: 6543 <6543@obermui.de>
2023-12-24 12:14:30 +01:00
qwerty287 9d9bcbf363
Hide PR tab if PRs are disabled (#3004)
Closes https://github.com/woodpecker-ci/woodpecker/issues/2988
2023-12-24 11:04:18 +02:00
Anbraten e5dbbd92c7
Fix gitlab project fetching (#3000) 2023-12-23 09:48:16 +01:00
Anbraten 619858e0e9
Ignore pipelines without config (#2949)
Co-authored-by: 6543 <6543@obermui.de>
2023-12-21 11:13:25 +01:00
6543 65c62e987f
gitlab: support nested repos (#2981)
close  #2311
2023-12-21 00:55:16 +01:00
Lauris BH 6432109daf
Fix static file caching (#2975)
Replaces #2972

Fixes #2483

Removed etag header as etag is used incorrectly, it should be based on
content not startup time and we don't handle it from request headers
anyway.
2023-12-20 10:31:52 +02:00
runephilosof-karnovgroup a28e2e1920
Register Agent with hostname (#2936)
Transfer the agent hostname to the server's model.agent.Name field.

Previously the autoscaler had to create the agent with the server and
get a unique token to pass to the agent at boot up. This allows to get
the right name for the agent while using the shared master agent token
at agent boot up.
Both ways are still supported.
2023-12-19 14:17:36 +01:00
6543 2e7610379e
Update slogan & logo (#2962)
- Update woodpecker slogan to repo too
  we are not just a simple fork anymore 🎉
- use https://github.com/woodpecker-ci/design/blob/main/logo/non-square.svg
2023-12-19 14:12:18 +01:00
6543 1ca549190b
Gitea driver: ignore GetOrg error if we get a valid user. (#2967)
`[POST] /api/repos?forge_remote_id=12345`

```json
{"level":"error","error":"GetOrgByName","time":"2023-12-19T01:03:36Z","caller":"/woodpecker/src/github.com/woodpecker-ci/woodpecker/server/api/repo.go:143","message":"Could not fetch organization from forge."}
```

because `https://codeberg.org/api/v1/orgs/6543` returns an error.
`https://codeberg.org/api/v1/users/6543` do not.

close  #2714
2023-12-19 09:13:39 +01:00
6543 257a76c5ea
Improve error handling when activating a repository (#2965)
Activate Repo:
- Don't drop errors and also always log them on the server.
- Show users only meaningful error messages.
2023-12-19 06:25:59 +01:00
6543 ebbac258a2
Add check for storage where repo/org name is empty (#2968)
I just discovered that there is an organization created with name being empty.

we should at least catch it for now in the storage - and later trace
down why we get it in the first place
2023-12-19 06:03:56 +01:00
Robert Kaussow 23f58fc07a
Fix broken gated repos (#2959)
Fixes a bug introduced in
https://github.com/woodpecker-ci/woodpecker/pull/2923. I'll also try to
add a test case.
2023-12-17 18:44:48 +02:00
Anbraten 16803d6217
Show secrets from org and global level (#2873)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-12-16 10:29:13 +01:00
6543 1f8b3b5e1b
Only update pipelineStatus in one place (#2952) 2023-12-15 10:03:05 +01:00
qwerty287 360b41f961
Remove separate root path config (#2943) 2023-12-13 15:51:18 +01:00
6543 4974d4cffe
ignore some errors on repairAllRepos (#2792)
close  #2791

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-12-13 14:53:38 +01:00
Lauris BH c6ce23e933
Allow to restart pipelines that has warnings (#2939) 2023-12-13 14:11:05 +01:00
Robert Kaussow 6de5922408
Fix skipped pipelines model (#2923)
Fixes: https://github.com/woodpecker-ci/woodpecker/issues/2901

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
2023-12-12 22:30:52 +02:00
runephilosof-karnovgroup adb2c82790
Update go module path for major version 2 (#2905)
https://go.dev/doc/modules/release-workflow#breaking

Fixes https://github.com/woodpecker-ci/woodpecker/issues/2913 fixes
#2654
```
runephilosof@fedora:~/code/platform-woodpecker/woodpecker-repo-configurator (master)$ go get go.woodpecker-ci.org/woodpecker@v2.0.0
go: go.woodpecker-ci.org/woodpecker@v2.0.0: invalid version: module contains a go.mod file, so module path must match major version ("go.woodpecker-ci.org/woodpecker/v2")
```

---------

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-12-08 08:15:08 +01:00
renovate[bot] 621eed6205
Update module github.com/google/go-github/v56 to v57 (#2899) 2023-12-02 15:19:39 +01:00
qwerty287 237b2257f5
Fix bitbucket org fetching (#2874)
closes #2793
2023-12-01 20:45:42 +01:00
qwerty287 2f963d70e7
Add linting for any (#2893)
Add gofmt rules to make sure `interface{}` is not used but only `any`.
2023-11-29 20:21:18 +01:00
qwerty287 7bacbd5699
Migrate to Xormigrate (#2711)
Co-authored-by: Anbraten <anton@ju60.de>
2023-11-28 10:31:54 +01:00
qwerty287 849b02a433
Fix pipeline-related environment (#2876)
closes https://github.com/woodpecker-ci/woodpecker/issues/2672

pipeline model must be persisted first to have some fields like `Number`
and `ID`
2023-11-26 19:59:36 +01:00
Michalis Zampetakis 981384b79a
Change PullRequest Index to ForgeRemoteID / string type (#2823)
Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: Anbraten <anton@ju60.de>
2023-11-26 00:52:52 +01:00
qwerty287 111a0b4ea5
Fix unregistering agents used with agent tokens (#2870)
from discussion on matrix

I'm not sure if this is the best way to fix this, but I don't really see
a different way.
2023-11-24 18:19:38 +01:00
qwerty287 f2071e3999
Add repo owner test (#2857)
from #2855
2023-11-23 00:57:29 +01:00
qwerty287 c9e587753e
Fix repo listing (#2855)
closes #2854
2023-11-22 09:42:20 +01:00
renovate[bot] f0f57ec961
Update golang (packages) (#2839)
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/antonmedv/expr](https://togithub.com/antonmedv/expr) |
require | patch | `v1.15.3` -> `v1.15.4` |
| [github.com/xanzy/go-gitlab](https://togithub.com/xanzy/go-gitlab) |
require | minor | `v0.93.2` -> `v0.94.0` |
| [k8s.io/api](https://togithub.com/kubernetes/api) | require | patch |
`v0.28.3` -> `v0.28.4` |
| [k8s.io/apimachinery](https://togithub.com/kubernetes/apimachinery) |
require | patch | `v0.28.3` -> `v0.28.4` |
| [k8s.io/client-go](https://togithub.com/kubernetes/client-go) |
require | patch | `v0.28.3` -> `v0.28.4` |

---

### Release Notes

<details>
<summary>antonmedv/expr (github.com/antonmedv/expr)</summary>

###
[`v1.15.4`](https://togithub.com/antonmedv/expr/releases/tag/v1.15.4)

[Compare
Source](https://togithub.com/antonmedv/expr/compare/v1.15.3...v1.15.4)

-   Improved type checking for `$env`
-   Added support for floats in `sort()` built-in
-   Fixed: AST printing for `??` operator
-   Fixed: only emit `OpEqual{Int,String}` for simple types
- Fixed: fetch without `OpDeref`
([#&#8203;467](https://togithub.com/antonmedv/expr/issues/467))
- Docs: categorize Language Definition functions
([#&#8203;452](https://togithub.com/antonmedv/expr/issues/452))
-   Changed: `ast.Node` type now is not copied with `ast.Patch`

</details>

<details>
<summary>xanzy/go-gitlab (github.com/xanzy/go-gitlab)</summary>

###
[`v0.94.0`](https://togithub.com/xanzy/go-gitlab/compare/v0.93.2...v0.94.0)

[Compare
Source](https://togithub.com/xanzy/go-gitlab/compare/v0.93.2...v0.94.0)

</details>

<details>
<summary>kubernetes/api (k8s.io/api)</summary>

###
[`v0.28.4`](https://togithub.com/kubernetes/api/compare/v0.28.3...v0.28.4)

[Compare
Source](https://togithub.com/kubernetes/api/compare/v0.28.3...v0.28.4)

</details>

<details>
<summary>kubernetes/apimachinery (k8s.io/apimachinery)</summary>

###
[`v0.28.4`](https://togithub.com/kubernetes/apimachinery/compare/v0.28.3...v0.28.4)

[Compare
Source](https://togithub.com/kubernetes/apimachinery/compare/v0.28.3...v0.28.4)

</details>

<details>
<summary>kubernetes/client-go (k8s.io/client-go)</summary>

###
[`v0.28.4`](https://togithub.com/kubernetes/client-go/compare/v0.28.3...v0.28.4)

[Compare
Source](https://togithub.com/kubernetes/client-go/compare/v0.28.3...v0.28.4)

</details>

---

### Configuration

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

🚦 **Automerge**: Enabled.

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

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: qwerty287 <ndev@web.de>
2023-11-20 08:23:01 +01:00
6543 8a3a2303a2
Signal to clients the hook and event routes where removed (#2826)
Signal to clients the hook and event routes where removed at #2639

close #2824
2023-11-19 20:32:35 +01:00
qwerty287 342b25826c
Rename link to url (#2812)
As of https://woodpecker-ci.org/docs/next/usage/terminiology#conventions
2023-11-14 17:12:12 +01:00
qwerty287 70711ed9db
Replace interface{} with any (#2807)
like golang:
2580d0e08d
2023-11-12 18:23:48 +01:00
qwerty287 fd77b2e9d7
Fix repo owner filter (#2808)
and move to server config instead of middleware

cc @xoxys 

closes #2784
2023-11-12 14:39:41 +01:00
Thomas Anderson 08f47afbd1
Sort agents list by ID (#2795) 2023-11-10 01:11:11 +01:00
Patrick Schratz 9d5ef117a2
Fix listing Gitea repos (#2768) 2023-11-07 20:18:42 +01:00
6543 5a7b689e30
Switch to go vanity urls (#2706)
Co-authored-by: Anbraten <anton@ju60.de>
2023-11-07 08:04:33 +01:00
Anbraten 731d4713c0
Fix pipeline error migration (#2735)
Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
2023-11-06 13:20:28 +01:00
qwerty287 45a5a2dde5
Fix panic on logger (#2745) 2023-11-05 09:31:06 +01:00
Anbraten b949c190de
Some UI fixes (#2698)
- fix first log line being dropped if channel was opened
- link org and repo on repo logs view
- fix decline pipeline status does not update
2023-11-04 06:51:26 +01:00
qwerty287 d284aeb545
Fix default status (#2715)
Regression #2695

probably closes #2716
2023-11-03 13:00:34 +01:00
Anbraten 5ff006614f
Enhance linter and errors (#1572)
Co-authored-by: 6543 <m.huber@kithara.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-11-03 11:44:03 +01:00
Thomas Anderson 3620c84da4
Unregister stateless agents from server on termination (#2606)
Closes #2027

---------

Co-authored-by: 6543 <6543@obermui.de>
2023-11-02 01:53:47 +02:00
qwerty287 abb2f280eb
Unique status for matrix (#2695)
implement this fix but with an additional field on workflows to not
change the workflow name

closes #1840 
closes #713

---------

Co-authored-by: 6543 <6543@obermui.de>
2023-11-01 17:28:02 +01:00
Jannik Heuer 0fbf8cfc85
Fix secret image filter regex (#2674) 2023-10-31 13:15:13 +01:00
qwerty287 9c07b15c99
Fix where syntax (#2676) 2023-10-31 12:43:06 +01:00
qwerty287 e74115027b
Add some tests (#2652)
and some cleanups
2023-10-28 13:37:54 +02:00
qwerty287 aeb7bcb26a
Remove WOODPECKER_DOCS config (#2647) 2023-10-25 15:05:19 +02:00
Anbraten f44aa8a6fd
Remove plugin-only option from secrets (#2213) 2023-10-24 20:38:47 +02:00
qwerty287 387637bb4e
Use repo user to repair (#2645)
Solve
https://github.com/woodpecker-ci/woodpecker/pull/2642#pullrequestreview-1694731501
2023-10-24 15:54:43 +02:00
qwerty287 5045f1e431
Remove deprecated API paths (#2639) 2023-10-24 15:21:05 +02:00
qwerty287 69917c1a0d
Add "Repair all" button (#2642)
to the admin repo list

ref #2639
2023-10-24 14:12:55 +02:00
qwerty287 a1a35eb7be
Fix error when closing logs (#2637)
Previously, *all* log streams of the pipeline were closed everytime when
a workflow is done, if you have multiple workflows, streams will be
closed multiple times.

Closes https://github.com/woodpecker-ci/woodpecker/issues/2036
2023-10-24 10:44:36 +02:00
qwerty287 9232db06dd
Use pagination utils (#2633)
1. replace custom pagination code with pagination util
2. add pagination if it could be necessary (hook deactivation)
2023-10-23 18:44:25 +02:00
qwerty287 ce85a60e32
Dynamic forge request size (#2622)
and remove checks for gitea 1.18 which is quite old already and
shouldn't be used anymore

closes https://github.com/woodpecker-ci/woodpecker/issues/1038
2023-10-23 09:22:00 +02:00
renovate[bot] 121457b76e
fix(deps): update golang (packages) (#2614) 2023-10-23 08:45:34 +02:00
Anbraten 7d7ba755cc
Fix secret priority (#2599) 2023-10-16 23:39:55 +02:00
Oskars afef609f3c
Adjust github scopes and clarify documentation. (#2578)
Add scopes needed when creating Github application.
Removed "repo:status" scope, because it is included in already requested
"repo" scope.

Fixes: #1081
2023-10-14 13:26:25 +02:00
qwerty287 0e5defa807
Refactor/simplify pubsub (#2554) 2023-10-13 07:34:33 +02:00
renovate[bot] b1cedecc42
fix(deps): update module github.com/google/go-github/v55 to v56 (#2573) 2023-10-12 15:28:00 +02:00
Anbraten 62d6a6bc34
Move skip-ci back in front of config fetching (#2555) 2023-10-09 18:15:53 +02:00
qwerty287 53b79eabcd
Add test for handling pipeline error (#2547)
Credits: @langecode

Taken from #2504
2023-10-08 14:58:13 +02:00
Michalis Zampetakis 259ff78a62
Fix PR event trigger and list for bitbucket repos (#2539)
Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-10-08 14:18:49 +02:00
qwerty287 22dfd2ef62
Refactor pipeline parsing and forge refreshing (#2527)
- refactor pipeline parsing
- do not parse the pipeline multiple times to perform filter checks, do
this once and perform checks on the result directly
    - code deduplication
- refactor forge token refreshing
    - move refreshing to a helper func to reduce code

---------

Co-authored-by: Anbraten <anton@ju60.de>
2023-10-08 14:05:06 +02:00
qwerty287 6699577aba
Fix ccmenu endpoint (#2543) 2023-10-07 18:59:59 +02:00
qwerty287 3bd53b379e
Fix gitlab hooks and simplify config extension (#2537)
- closes #2534 
- remove `IsConfigured` func from config extension.
  If `server.Config.Services.ConfigService != nil` it is always configured
2023-10-07 16:41:25 +02:00
renovate[bot] 14fb564629
fix(deps): update golang deps non-major (#2533) 2023-10-06 17:33:06 +02:00
Martin W. Kirst 570141eae7
Use correct mime type when no content is sent (#2515)
closes #2514 

The fix is simple, just providing a file name, so
`http.ServeContent(...)` can set the correct mimeype in case the content
is zero bytes.

The test was just extended.

PS: I would appreciate a `hacktoberfest-accepted` label ;)

---------

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-10-03 12:28:20 +02:00
renovate[bot] 64951d6a9e
fix(deps): update golang deps non-major (#2500) 2023-09-30 09:23:11 +02:00
Michalis Zampetakis 57b7b1788d
Fix bitbucket branches pagination. (#2509) 2023-09-29 18:01:29 +02:00
qwerty287 ecdc729cdc
Some cleanups about host config (#2490) 2023-09-23 07:54:23 +02:00
Tom Kneiphof baaf8b97e1
Fix usage of WOODPECKER_ROOT_PATH (#2485)
I had experienced some issues running Woodpecker behind a reverse-proxy,
resulting from not defining the `WOODPECKER_ROOT_PATH` environment
variable in #2477.

As suggested by @qwerty287, specifying `WOODPECKER_ROOT_PATH=/foo`
*mostly* solved the issue of running the woodpecker server at an url
like `https://example.org/foo`.
However, the webhook urls and badge urls were generated excluding the
configured `WOODPECKER_ROOT_PATH`.

This PR (mostly) fixes issues related to non-empty
`WOODPECKER_ROOT_PATH`.

---------

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-09-22 16:43:31 +02:00
qwerty287 29e93bdf8b
Never log tokens (#2466) 2023-09-16 10:53:37 +02:00
renovate[bot] 3d19d863d1
fix(deps): update module github.com/tevino/abool to v2 (#2460) 2023-09-14 07:34:36 +02:00
renovate[bot] 3eced32b81
fix(deps): update module github.com/google/go-github/v39 to v55 (#2456) 2023-09-13 14:49:39 +02:00
renovate[bot] 97a7438ab1
fix(deps): update module github.com/golang-jwt/jwt/v4 to v5 (#2449)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/golang-jwt/jwt/v4](https://togithub.com/golang-jwt/jwt) |
require | major | `v4.5.0` -> `v5.0.0` |

---

### ⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the
Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>golang-jwt/jwt (github.com/golang-jwt/jwt/v4)</summary>

### [`v5.0.0`](https://togithub.com/golang-jwt/jwt/releases/tag/v5.0.0)

[Compare
Source](https://togithub.com/golang-jwt/jwt/compare/v4.5.0...v5.0.0)

### 🚀 New Major Version `v5` 🚀

It's finally here, the release you have been waiting for! We don't take
breaking changes lightly, but the changes outlined below were necessary
to address some of the challenges of the previous API. A big thanks for
[@&#8203;mfridman](https://togithub.com/mfridman) for all the reviews,
all contributors for their commits and of course
[@&#8203;dgrijalva](https://togithub.com/dgrijalva) for the original
code. I hope we kept some of the spirit of your original `v4` branch
alive in the approach we have taken here.
\~[@&#8203;oxisto](https://togithub.com/oxisto), on behalf of
[@&#8203;golang-jwt/maintainers](https://togithub.com/golang-jwt/maintainers)

Version `v5` contains a major rework of core functionalities in the
`jwt-go` library. This includes support for several validation options
as well as a re-design of the `Claims` interface. Lastly, we reworked
how errors work under the hood, which should provide a better overall
developer experience.

Starting from
[v5.0.0](https://togithub.com/golang-jwt/jwt/releases/tag/v5.0.0), the
import path will be:

    "github.com/golang-jwt/jwt/v5"

For most users, changing the import path *should* suffice. However,
since we intentionally changed and cleaned some of the public API,
existing programs might need to be updated. The following sections
describe significant changes and corresponding updates for existing
programs.

#### Parsing and Validation Options

Under the hood, a new `validator` struct takes care of validating the
claims. A long awaited feature has been the option to fine-tune the
validation of tokens. This is now possible with several `ParserOption`
functions that can be appended to most `Parse` functions, such as
`ParseWithClaims`. The most important options and changes are:

- Added `WithLeeway` to support specifying the leeway that is allowed
when validating time-based claims, such as `exp` or `nbf`.
- Changed default behavior to not check the `iat` claim. Usage of this
claim is OPTIONAL according to the JWT RFC. The claim itself is also
purely informational according to the RFC, so a strict validation
failure is not recommended. If you want to check for sensible values in
these claims, please use the `WithIssuedAt` parser option.
- Added `WithAudience`, `WithSubject` and `WithIssuer` to support
checking for expected `aud`, `sub` and `iss`.
- Added `WithStrictDecoding` and `WithPaddingAllowed` options to allow
previously global settings to enable base64 strict encoding and the
parsing of base64 strings with padding. The latter is strictly speaking
against the standard, but unfortunately some of the major identity
providers issue some of these incorrect tokens. Both options are
disabled by default.

#### Changes to the `Claims` interface

##### Complete Restructuring

Previously, the claims interface was satisfied with an implementation of
a `Valid() error` function. This had several issues:

- The different claim types (struct claims, map claims, etc.) then
contained similar (but not 100 % identical) code of how this validation
was done. This lead to a lot of (almost) duplicate code and was hard to
maintain
- It was not really semantically close to what a "claim" (or a set of
claims) really is; which is a list of defined key/value pairs with a
certain semantic meaning.

Since all the validation functionality is now extracted into the
validator, all `VerifyXXX` and `Valid` functions have been removed from
the `Claims` interface. Instead, the interface now represents a list of
getters to retrieve values with a specific meaning. This allows us to
completely decouple the validation logic with the underlying storage
representation of the claim, which could be a struct, a map or even
something stored in a database.

```go
type Claims interface {
	GetExpirationTime() (*NumericDate, error)
	GetIssuedAt() (*NumericDate, error)
	GetNotBefore() (*NumericDate, error)
	GetIssuer() (string, error)
	GetSubject() (string, error)
	GetAudience() (ClaimStrings, error)
}
```

##### Supported Claim Types and Removal of `StandardClaims`

The two standard claim types supported by this library, `MapClaims` and
`RegisteredClaims` both implement the necessary functions of this
interface. The old `StandardClaims` struct, which has already been
deprecated in `v4` is now removed.

Users using custom claims, in most cases, will not experience any
changes in the behavior as long as they embedded `RegisteredClaims`. If
they created a new claim type from scratch, they now need to implemented
the proper getter functions.

##### Migrating Application Specific Logic of the old `Valid`

Previously, users could override the `Valid` method in a custom claim,
for example to extend the validation with application-specific claims.
However, this was always very dangerous, since once could easily disable
the standard validation and signature checking.

In order to avoid that, while still supporting the use-case, a new
`ClaimsValidator` interface has been introduced. This interface consists
of the `Validate() error` function. If the validator sees, that a
`Claims` struct implements this interface, the errors returned to the
`Validate` function will be *appended* to the regular standard
validation. It is not possible to disable the standard validation
anymore (even only by accident).

Usage examples can be found in [example_test.go](./example_test.go), to
build claims structs like the following.

```go
// MyCustomClaims includes all registered claims, plus Foo.
type MyCustomClaims struct {
	Foo string `json:"foo"`
	jwt.RegisteredClaims
}

// Validate can be used to execute additional application-specific claims
// validation.
func (m MyCustomClaims) Validate() error {
	if m.Foo != "bar" {
		return errors.New("must be foobar")
	}

	return nil
}
```

#### Changes to the `Token` and `Parser` struct

The previously global functions `DecodeSegment` and `EncodeSegment` were
moved to the `Parser` and `Token` struct respectively. This will allow
us in the future to configure the behavior of these two based on options
supplied on the parser or the token (creation). This also removes two
previously global variables and moves them to parser options
`WithStrictDecoding` and `WithPaddingAllowed`.

In order to do that, we had to adjust the way signing methods work.
Previously they were given a base64 encoded signature in `Verify` and
were expected to return a base64 encoded version of the signature in
`Sign`, both as a `string`. However, this made it necessary to have
`DecodeSegment` and `EncodeSegment` global and was a less than perfect
design because we were repeating encoding/decoding steps for all signing
methods. Now, `Sign` and `Verify` operate on a decoded signature as a
`[]byte`, which feels more natural for a cryptographic operation anyway.
Lastly, `Parse` and `SignedString` take care of the final
encoding/decoding part.

In addition to that, we also changed the `Signature` field on `Token`
from a `string` to `[]byte` and this is also now populated with the
decoded form. This is also more consistent, because the other parts of
the JWT, mainly `Header` and `Claims` were already stored in decoded
form in `Token`. Only the signature was stored in base64 encoded form,
which was redundant with the information in the `Raw` field, which
contains the complete token as base64.

```go
type Token struct {
	Raw       string                 // Raw contains the raw token
	Method    SigningMethod          // Method is the signing method used or to be used
	Header    map[string]interface{} // Header is the first segment of the token in decoded form
	Claims    Claims                 // Claims is the second segment of the token in decoded form
	Signature []byte                 // Signature is the third segment of the token in decoded form
	Valid     bool                   // Valid specifies if the token is valid
}
```

Most (if not all) of these changes should not impact the normal usage of
this library. Only users directly accessing the `Signature` field as
well as developers of custom signing methods should be affected.

#### What's Changed

- Added GitHub Actions Markdown by
[@&#8203;oxisto](https://togithub.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/260](https://togithub.com/golang-jwt/jwt/pull/260)
- Remove `StandardClaims` in favor of `RegisteredClaims` by
[@&#8203;oxisto](https://togithub.com/oxisto) in
[#&#8203;235](https://togithub.com/golang-jwt/jwt/issues/235)
- Adding more coverage by [@&#8203;oxisto](https://togithub.com/oxisto)
in [#&#8203;268](https://togithub.com/golang-jwt/jwt/issues/268)
- More consistent way of handling validation errors by
[@&#8203;oxisto](https://togithub.com/oxisto) in
[#&#8203;274](https://togithub.com/golang-jwt/jwt/issues/274)
- New Validation API by [@&#8203;oxisto](https://togithub.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/236](https://togithub.com/golang-jwt/jwt/pull/236)
- `v5` Pre-Release by [@&#8203;oxisto](https://togithub.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/234](https://togithub.com/golang-jwt/jwt/pull/234)
- no need for string slice and call to strings.join by
[@&#8203;moneszarrugh](https://togithub.com/moneszarrugh) in
[https://github.com/golang-jwt/jwt/pull/115](https://togithub.com/golang-jwt/jwt/pull/115)
- Update MIGRATION_GUIDE.md by
[@&#8203;liam-verta](https://togithub.com/liam-verta) in
[https://github.com/golang-jwt/jwt/pull/289](https://togithub.com/golang-jwt/jwt/pull/289)
- Moving `DecodeSegement` to `Parser` by
[@&#8203;oxisto](https://togithub.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/278](https://togithub.com/golang-jwt/jwt/pull/278)
- Adjusting the error checking example by
[@&#8203;oxisto](https://togithub.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/270](https://togithub.com/golang-jwt/jwt/pull/270)
- add documentation to hmac `Verify` & `Sign` to detail why string is
not an advisable input for key by
[@&#8203;dillonstreator](https://togithub.com/dillonstreator) in
[https://github.com/golang-jwt/jwt/pull/249](https://togithub.com/golang-jwt/jwt/pull/249)
- Add golangci-lint by [@&#8203;mfridman](https://togithub.com/mfridman)
in
[https://github.com/golang-jwt/jwt/pull/279](https://togithub.com/golang-jwt/jwt/pull/279)
- Added dependabot updates for GitHub actions by
[@&#8203;oxisto](https://togithub.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/298](https://togithub.com/golang-jwt/jwt/pull/298)
- Bump actions/checkout from 2 to 3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/golang-jwt/jwt/pull/299](https://togithub.com/golang-jwt/jwt/pull/299)
- Bump actions/setup-go from 3 to 4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/golang-jwt/jwt/pull/300](https://togithub.com/golang-jwt/jwt/pull/300)
- Added coverage reporting by
[@&#8203;oxisto](https://togithub.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/304](https://togithub.com/golang-jwt/jwt/pull/304)
- Last Documentation cleanups for `v5` release by
[@&#8203;oxisto](https://togithub.com/oxisto) in
[https://github.com/golang-jwt/jwt/pull/291](https://togithub.com/golang-jwt/jwt/pull/291)
- enable jwt.ParsePublicKeyFromPEM to parse PKCS1 Public Key by
[@&#8203;twocs](https://togithub.com/twocs) in
[https://github.com/golang-jwt/jwt/pull/120](https://togithub.com/golang-jwt/jwt/pull/120)

#### New Contributors

- [@&#8203;moneszarrugh](https://togithub.com/moneszarrugh) made their
first contribution in
[https://github.com/golang-jwt/jwt/pull/115](https://togithub.com/golang-jwt/jwt/pull/115)
- [@&#8203;liam-verta](https://togithub.com/liam-verta) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/289](https://togithub.com/golang-jwt/jwt/pull/289)
- [@&#8203;dillonstreator](https://togithub.com/dillonstreator) made
their first contribution in
[https://github.com/golang-jwt/jwt/pull/249](https://togithub.com/golang-jwt/jwt/pull/249)
- [@&#8203;dependabot](https://togithub.com/dependabot) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/299](https://togithub.com/golang-jwt/jwt/pull/299)
- [@&#8203;twocs](https://togithub.com/twocs) made their first
contribution in
[https://github.com/golang-jwt/jwt/pull/120](https://togithub.com/golang-jwt/jwt/pull/120)

**Full Changelog**:
https://github.com/golang-jwt/jwt/compare/v4.5.0...v5.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **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:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: qwerty287 <ndev@web.de>
2023-09-13 09:01:01 +02:00
Sebastian P 07094558a8
fix: change config.config_data column type to longblob in mysql (#2434)
See
https://github.com/woodpecker-ci/woodpecker/pull/2418#discussion_r1320832841
for context.
2023-09-10 22:24:51 +02:00