Commit graph

985 commits

Author SHA1 Message Date
qwerty287 56b8ba151a
Delete repos/secrets on org deletion (#2367) 2023-09-02 15:00:13 +02:00
qwerty287 3e563ef198
Use API error helpers and improve response codes (#2366) 2023-09-02 13:31:10 +02:00
guangwu 287590acfb
Import packages only once (#2362)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-09-01 17:02:21 +02:00
qwerty287 aab7e73322
Execute make generate with new versions (#2365)
Fixes current swagger checks:
https://ci.woodpecker-ci.org/repos/3780/pipeline/7605/26
2023-09-01 16:44:55 +02:00
qwerty287 e847cbadfa
Check permissions on repo lookup (#2357)
There was no permission check when looking up repos so you were able to
get basic repo information even if you're not allowed to.

This uses `session.MustPull` (and set repo/perms before) to fix this.
2023-08-30 16:35:34 +02:00
qwerty287 5bd12aa646
Show that repo is disabled (#2340)
And allow to show badges for disabled repos

Fixes 3rd checkbox from
https://github.com/woodpecker-ci/woodpecker/discussions/2162#discussion-5498655

![Screenshot 2023-08-28 at 11-13-23
Woodpecker](https://github.com/woodpecker-ci/woodpecker/assets/80460567/d881f0c5-6225-4921-9d05-a26f27ad5365)
2023-08-28 18:57:44 +02:00
Anbraten 25225d4902
Update grpc generated code (#2339)
missed in #2173

---------
2023-08-28 18:00:52 +02:00
qwerty287 6f1f0e37ce
Fix org fetching (#2343) 2023-08-28 17:01:18 +02:00
qwerty287 479ced3b25
Add org list (#2338)
![Screenshot 2023-08-28 at 10-08-20
Woodpecker](https://github.com/woodpecker-ci/woodpecker/assets/80460567/e3248b05-7899-43ca-a0cf-4834eae078d8)
Closes #2307
2023-08-28 11:15:16 +02:00
qwerty287 7adfa6c2ba
Fix migration (#2319) 2023-08-22 17:37:29 +02:00
Pablo Ovelleiro Corral cf9a4be128
Add missing return (#2316) 2023-08-22 09:47:29 +02:00
Anbraten 4de8cbec76
Rename grpc pipeline to workflow (#2173)
closes #1823

Co-authored-by: 6543 <6543@obermui.de>
2023-08-21 18:30:19 +02:00
qwerty287 81ead7cbf2
Support user secrets (#2126) 2023-08-21 15:04:12 +02:00
Pablo Ovelleiro Corral 09624aa286
Pass netrc data to external config service request (#2310)
Co-authored-by: Anbraten <anton@ju60.de>
2023-08-21 13:22:33 +02:00
Lauris BH a58e3b9e06
Handle parsed hooks that should be ignored (#2243)
Currently it would fail with panic:

```
runtime error: invalid memory address or nil pointer dereference
...
/woodpecker/src/github.com/woodpecker-ci/woodpecker/server/forge/gitea/gitea.go:492 (0xdfb32e)
```
2023-08-18 14:25:29 +02:00
6543 a5ef372190
Move "skip ci" logic into global pipeline conditions (#2216)
... and make custom errors follow std err conventions

this fix a 500 response if the whole pipeline is filtered out
2023-08-17 15:52:43 +02:00
6543 c2448b1745
Restructure webhook parsing (#2221)
Co-authored-by: Anbraten <anton@ju60.de>
2023-08-16 16:15:44 +02:00
Anbraten 479e500b1b
Move hook and events-stream routes to use /api prefix (#2212)
- move hook and events-stream routes to use `/api` prefix
- rename build to pipeline
2023-08-16 02:42:37 +02:00
qwerty287 4d83ea0de8
Add SSH clone URL env var (#2198)
to improve https://github.com/woodpecker-ci/plugin-git/pull/75
2023-08-12 17:39:13 +02:00
qwerty287 8cdac56d8f
Check for correct license header (#2137) 2023-08-10 11:06:00 +02:00
qwerty287 6e0def58a1
Switch to upstream ttlcache (#2187)
We've been using https://github.com/lafriks/ttlcache but it's archived.
It does work with the upstream library too, so its better to use it.
2023-08-10 09:17:12 +02:00
6543 63d5c40afd
Deprecate "platform" filter in favour of "labels" (#2181)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2023-08-09 16:09:44 +02:00
6543 ada3659eb7
make EqualStringSlice to generic EqualSliceValues (#2179)
just a fly-by refactoring
2023-08-09 09:00:12 +02:00
6543 17ab945825
Fix 'add-orgs' migration (#2117)
close  #2096

~~blocked by https://gitea.com/xorm/xorm/pulls/2320~~
2023-08-08 00:16:50 +03:00
6543 d253f8cc30
Make sure we dont have hidden options for backend and pipeline compiler (#2123)
move options based on **os.Getenv** into flags

---------
*Sponsored by Kithara Software GmbH*
2023-08-07 21:13:26 +02:00
qwerty287 4558f7c691
Fix vite server (#2134)
#1799 broke it
2023-08-07 17:03:26 +02:00
qwerty287 67b7de5cc2
Fix UI and backend paths with subpath (#1799)
I'm not sure if this is an ideal fix for this, but it seems to work for
me. If you have another idea just let me know.

Closes #1798 
Closes #1773
2023-08-07 16:05:18 +02:00
qwerty287 4ad3968ff1
Fix swagger response code (#2119)
Closes #2118
2023-08-05 19:44:49 +02:00
runephilosof-karnovgroup 8487ed92cd
Forge Github Org: Use login instead of name (#2104)
For "woodpecker-ci" the `name` is "Woodpecker CI"
 and the `login` is "woodpecker-ci"

Fixes #2092

This was causing the organization lookup to fail, because it looks up
using the `login`, when it did not find the organization, it would try
to create it. The creation would fail, because it uses the `name`, and
an organization with that `name` already exists.
Resulting in:

```
pq: duplicate key value violates unique constraint "UQE_orgs_name"
```
2023-08-03 17:30:56 +02:00
qwerty287 1a7f7a9427
Allow to disable swagger (#2093)
https://github.com/woodpecker-ci/woodpecker/issues/1944
2023-08-03 02:42:30 +02:00
Michalis Zampetakis b0fe17322f
Add some testsvfor bitbucket forge (#2097) 2023-08-03 02:06:03 +02:00
Michalis Zampetakis 4ad2c4eb45
Support bitbucket Dir() / multi-workflows (#2045) 2023-08-02 13:15:57 +02:00
Anbraten e0ed1b3e49
Change master to main (#2044) 2023-07-31 05:47:23 +02:00
Anbraten 5a812e3254
Remove default branch fallbacks (#2065) 2023-07-30 18:28:52 +02:00
6543 6d373daea0
Handle case where there is no latest pipeline for GetBadge (#2042)
address  error 2 of #2036
2023-07-28 00:34:22 +02:00
6543 bc2e2c7a1b
let generic datastore error include func name (#2041)
error logs like:
```
{"level":"warn","error":"sql: no rows in result set","time":"2023-07-25T21:29:56Z"}
```

have to less context to be helpfull.
this will cange it as the message now looks like:

```
{"level":"warn","error":"GetPipelineLast: sql: no rows in result set", "time":"2023-07-27T02:54:25+02:00"}
```
2023-07-27 21:22:24 +02:00
Anbraten e5d5ec8b47
Use id to access orgs (#1873)
closes #1743 

fixes: setting secrets for own user namespace

- create org in database
- use orgID for org related APIs

Co-authored-by: 6543 <6543@obermui.de>
2023-07-21 19:45:32 +02:00
Michalis Zampetakis dcba48f916
Add bitbucket forge BranchHead implementation (#2011)
In order to test this functionality, we had to expose the `BranchHead()`
through an API endpoint
```
GET /repos/{repo_id}/branches/{branch}/head
```

The response is a string that contains the latest commit hash of the
requested branch.
2023-07-17 21:30:06 +02:00
6543 1b646a28b4
Index stepID for logEntries so loading time decrease significantly (#2006)
speedup from 2min loading to 0.01sec :D

got missed by  #1802
2023-07-17 02:35:20 +03:00
Robert Kaussow 443c23c58a
Use global logger for xorm logs and add options (#1997)
Please let me know if this goes in the right direction. Needs some tests and docs.
2023-07-15 01:15:13 +02:00
6543 d9991e67e5
let HookParse func explicit ignore events (#1942)
for now it's not clear defined, what to do on an unsupported event.
e.g. gitea webhook panel shows 500 error and no message.

now we have a successful webhook and a message to show an info
2023-07-14 02:03:54 +02:00
qwerty287 570f5044e8
Drop support for Bitbucket Server (#1994)
Closes #1962
2023-07-13 15:47:25 +02:00
Patrick Schratz a4c791c6e5
Correct wording (#1982) 2023-07-12 13:49:18 +02:00
6543 edb92025df
Correct api docs of PostRepo & GetRepos (#1974)
... and report if needed forge_remote_id is not valid
2023-07-11 18:51:03 +02:00
6543 e85eeb10fc
Fix repo gate protection (#1969)
- clarify docs
- don't block cron pipelines
- run manual triggered pipelines right away

---------

Co-authored-by: Anbraten <anton@ju60.de>
2023-07-11 17:34:50 +02:00
6543 b54f6ebad6
Let pipeline-compiler export step types (#1958) 2023-07-11 15:53:05 +02:00
Martin W. Kirst 2c1fc4b500
support custom .JS and .CSS files for custom banner messages (white-labeling) (#1781)
This PR introduces two new server configuration options, for providing a
custom .JS and .CSS file.
These can be used to show custom banner messages, add
environment-dependent signals, or simply a corporate logo.

### Motivation (what problem I try to solve)

I'm operating Woodpecker in multiple k8s clusters for different
environments.
When having multiple browser tabs open, I prefer strong indicators for
each environment.
E.g. a red "PROD" banner, or just a blue "QA" banner.
Also, we sometimes need to have the chance for maintenance, and instead
of broadcasting emails,
I prefer a banner message, stating something like: "Heads-up: there's a
planned downtime, next Friday, blabla...".

Also, I like to have the firm's logo visible, which makes Woodpecker
look more like an integral part of our platform.

### Implementation notes

* Two new config options are introduced ```WOODPECKER_CUSTOM_CSS_FILE```
and ```WOODPECKER_CUSTOM_JS_FILE```
* I've piggy-bagged the existing handler for assets, as it seemed to me
a minimally invasive approach
* the option along with an example is documented
* a simple unit test for the Gin-handler ensures some regression safety
* no extra dependencies are introduced

### Visual example

The documented example will look like this.

![Screenshot 2023-05-27 at 17 00
44](https://github.com/woodpecker-ci/woodpecker/assets/1189394/8940392e-463c-4651-a1eb-f017cd3cd64d)

### Areas of uncertainty 

This is my first contribution to Woodpecker and I tried my best to align
with your conventions.
That said, I found myself uncertain about these things and would be glad
about getting feedback.

* The handler tests are somewhat different than the other ones because I
wanted to keep them simple - I hope that still matches your coding
guidelines
* caching the page sometimes will let the browser not recognize changes
and a user must reload. I'm not fully into the details of how caching is
implemented and neither can judge if it's a real problem. Another pair
of eyes would be good.
2023-07-10 12:46:35 +02:00
6543 7c99c8b843
Adjust model database type mapping (#1949)
adjust definitions according to feedback from real world usage
(ci.codeberg.org)

close  #1892
close  #1865
2023-07-08 20:09:53 +02:00
6543 6c58e9db9b
Fix agent auth (#1952)
if no global agent secret set, disable agent registration via it
2023-07-08 18:09:34 +02:00
6543 b4acbafffc
save forge at the beginning and use it (#1939)
fly-by refactor ...
2023-07-07 15:43:11 +02:00