Commit graph

130 commits

Author SHA1 Message Date
qwerty287 69917c1a0d
Add "Repair all" button (#2642)
to the admin repo list

ref #2639
2023-10-24 14:12:55 +02:00
qwerty287 0e5defa807
Refactor/simplify pubsub (#2554) 2023-10-13 07:34:33 +02:00
qwerty287 53b79eabcd
Add test for handling pipeline error (#2547)
Credits: @langecode

Taken from #2504
2023-10-08 14:58:13 +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
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 d04bb72e5e
Add repos list for admins (#2347) 2023-09-08 12:26:20 +02:00
Matheus Moraes 85e157bb10
fix(server/api/repo): Fix repair webhook host (#2372)
Fixes https://github.com/woodpecker-ci/woodpecker/issues/2371

Similar change to
https://github.com/woodpecker-ci/woodpecker/pull/1869/files#diff-3cd73db84155aa0447a17dadc8f50271d646fcf6132606cf2ab703cc7b80eb38R113
2023-09-06 12:17:23 +02:00
qwerty287 3e563ef198
Use API error helpers and improve response codes (#2366) 2023-09-02 13:31:10 +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
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
Pablo Ovelleiro Corral cf9a4be128
Add missing return (#2316) 2023-08-22 09:47:29 +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
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 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
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
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
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
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 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
Anbraten 3d435a9cb7
Fix log view (#1874)
closes #1857
closes #1520
closes #1879 
- fixes unicode log lines as reported in matrix

---------

Co-authored-by: 6543 <6543@obermui.de>
2023-07-01 18:55:00 +02:00
qwerty287 3033abc3b4
Add own workflow model (#1784)
Closes #1287

---------

Co-authored-by: 6543 <6543@obermui.de>
2023-06-27 18:01:18 +02:00
Benedikt Kleiner a958049485
sync repo permissions on login (#1853)
if indeed a bug, fixes #1851 after re-log

close #1666
2023-06-24 10:08:34 +02:00
qwerty287 c3c1d3bcb5
Return after error (#1875)
This allows you to work around the max timeout on the server.
2023-06-19 17:46:48 +02:00
Thomas Anderson 0c3021473f
Added Woodpecker Host Config used for Webhooks (#1869)
When SCM and Woodpecker are deployed in the same cluster, I want that
SCM requests Woodpecker directly by internal URL.


![Webhook-host-diagram](https://github.com/woodpecker-ci/woodpecker/assets/127358482/c4689d55-839a-4731-95b3-5734ba561e5f)
 
This PR adds optional URL used for Webhook calls.
2023-06-18 14:47:40 +02:00
Anbraten ff01a9ff1d
Access repos by their ids (#1691)
closes #1295 
closes #648

# TODO
- [x] add new routes with `:repoID`
- [x] load repo in middleware using `:repoID` if present
- [x] update UI routes `:owner/:name` to `:repoID`
- [x] load repos using id in UI
- [x] add lookup endpoint `:owner/:name` to `:repoID`
- [x] redirect `:owner/:name` to `:repoID` in UI
- [x] use badge with `:repoID` route in UI
- [x] update `woodpecker-go`
- [x] check cli
- [x] add migrations / deprecation notes
- [x] check if #648 got solved directly
- [x] Test
  - [x] create repo
  - [x] repo pages
  - [x] ui redirects
  - [x] forge status links
2023-06-13 01:07:52 +02:00
Anbraten 556607b525
Rework log streaming and related functions (#1802)
closes #1801
closes #1815 
closes #1144
closes  #983
closes  #557
closes #1827
regression of #1791

# TODO
- [x] adjust log model
- [x] add migration for logs
- [x] send log line via grpc using step-id
- [x] save log-line to db
- [x] stream log-lines to UI
- [x] use less structs for log-data
- [x] make web UI work
  - [x] display logs loaded from db
  - [x] display streaming logs
- [ ] ~~make migration work~~ -> dedicated pull (#1828)

# TESTED
- [x] new logs are stored in database
- [x] log retrieval via cli (of new logs) works
- [x] log streaming works (tested via curl & webui)
- [x] log retrieval via web (of new logs) works

---------

Co-authored-by: 6543 <6543@obermui.de>
2023-06-06 09:52:08 +02:00
Martin W. Kirst 14177635b6
Update swagger API specification (#1782)
# Summary

This PR drops the outdated former swagger.yaml/json and introduced
automatic API document generation from Go code.
The generated code is also used to generate documentation/markdown for
the community page,
as well as enable the Woodpecker server to serve a Swagger Web UI for
manual tinkering.

I did opt-in for gin-swagger, a middleware for the Gin framework, to
ease implementation and have a sophisticated output.
This middleware only produces Swagger v2 specs. AFAIK the newer OpenApi
3x tooling is not yet that mature,
so I guess that's fine for now.

## Implemenation notes

- former swagger.json files removed
- former // swagger godocs removed
- introduced new dependency gin-swagger, which uses godoc annotations on
top of Gin Handler functions.
- reworked Makefile to automatically generate Go code for the server
- introduce new dependency go-swagger, to generate Markdown for
documentation purposes
- add a Swagger Web UI, incl. capabilities for manual API exploration
- consider relative root paths in the implementation
- write documentation for all exposed API endpoints
- incl. API docs in the community website (auto-generated)
- provide developer documentation, for the Woodpecker authors
- no other existing logic/code was intentionally changed

---------

close #292

---------

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2023-06-03 21:38:36 +02:00
Anbraten c464f857ae
Remove unused file system api (#1791)
Co-authored-by: 6543 <6543@obermui.de>
2023-05-31 18:03:03 +02:00
qwerty287 a15821428f
Always send a status back to forge (#1751) 2023-05-14 14:18:43 +02:00
qwerty287 6d2240b2e6
Identify users using their remote ID (#1732) 2023-05-11 05:19:35 +02:00
6543 f3074ddaf9
Some small code refactorings (#1727)
Refactorings taken from pull requests #1722 and #1725
2023-04-30 17:02:47 +02:00
qwerty287 54d4ec04c0
Drop Gogs private mode (#1726)
You should use `WOODPECKER_AUTHENTICATE_PUBLIC_REPOS` instead if repos
sent from forge as public should be authenticated
2023-04-30 14:01:11 +02:00
qwerty287 0f9188597e
Initiate Pagination Implementation for API and Infinite Scroll in UI (#1651)
- Add pagination support to the API endpoints that return lists of items
- Adjust UI to enable infinite scrolling via pagination
2023-04-30 03:40:13 +02:00
qwerty287 9b32d021b3
Consistent status on delete (#1703)
Closes #1675
2023-04-15 15:22:39 +02:00
qwerty287 0970f35df5
Do not store inactive repos (#1658)
Do not sync repos with forge if the repo is not necessary in DB.

In the DB, only repos that were active once or repos that are currently
active are stored. When trying to enable new repos, the repos list is
fetched from the forge instead and displayed directly. In addition to
this, the forge func `Perm` was removed and is now merged with `Repo`.

Solves a TODO on RepoBatch.

---------

Co-authored-by: Anbraten <anton@ju60.de>
2023-03-21 23:01:59 +01:00
Anbraten f13ffc2c8f
Save agent-id for tasks and add endpoint to get agent tasks (#1631)
Save which agent is running a task. This is now visible in the admin UI
in the queue and in the agent details screen.

# changes
- [x] save id of agent executing a task
- [x] add endpoint to get tasks of an agent for #999 
- [x] show assigned agent-id in queue
- [x] (offtopic) use same colors for queue stats and icons (similar to
the ones used by pipelines)
- [x] (offtopic) use badges for queue labels & dependencies


![image](https://user-images.githubusercontent.com/6918444/226541271-23f3b7b2-7a08-45c2-a2e6-1c7fc31b6f1d.png)
2023-03-21 15:10:43 +02:00
Lauris BH 46452fbd84
Update Go dependencies and minimal Go version to 1.20 (#1650)
Signed-off-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
2023-03-21 00:48:15 +01:00
6543 e28b43ab19
Only inject netrc to trusted clone plugins (#1352)
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: 6543 <6543@obermui.de>
2023-03-20 21:17:49 +01:00
qwerty287 f582ad3159
Various enhancements in configuration (#1645)
- backends: move to cli flags instead of os.Getenv
- ssh: support 2fa with key and password
- allow to set grpc jwt secret (solves todo)
- allow to set default and max timeout (solves todo)

Closes https://github.com/woodpecker-ci/woodpecker/issues/896
Closes https://github.com/woodpecker-ci/woodpecker/issues/1131
2023-03-19 20:24:43 +01:00
6543 56e6639396
Refactor nits (#1652)
-
https://github.com/woodpecker-ci/woodpecker/pull/1641/files#r1141405630
-
ade8e6d010 (r105091268)
-
https://github.com/woodpecker-ci/woodpecker/pull/1647/files#r1141410010

---------

Co-authored-by: Anbraten <anton@ju60.de>
2023-03-19 18:32:19 +01:00
qwerty287 ade8e6d010
Various fixes and improvements (#1643)
- allow repo names to be case-insensitive
- improve backend error handling on DB get errors (record not found ->
404, else -> 500)
- replace magic numbers of http response codes
- unify the look and feel of cancel / save buttons on forms and view
them in one line

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
2023-03-19 13:52:58 +01:00
qwerty287 42a115e19e
Add PR pipeline list (#1641)
Instead of viewing PR pipelines in the branches lists, add a separate
list for them. The API endpoint for PRs supports pagination (thus I
added a lot of pagination-related stuff), the UI doesn't yet though.


![wp](https://user-images.githubusercontent.com/80460567/226099133-bb4935d6-c357-4d73-8465-9157e25c0d82.png)

Closes #1619 

Extends this part of #1640

---------

Co-authored-by: Anbraten <anton@ju60.de>
2023-03-19 10:43:57 +01:00