Commit graph

103 commits

Author SHA1 Message Date
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 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
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
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
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 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
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
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 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 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
6543 5a7b689e30
Switch to go vanity urls (#2706)
Co-authored-by: Anbraten <anton@ju60.de>
2023-11-07 08:04:33 +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
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 e74115027b
Add some tests (#2652)
and some cleanups
2023-10-28 13:37:54 +02:00
Anbraten f44aa8a6fd
Remove plugin-only option from secrets (#2213) 2023-10-24 20:38:47 +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
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
Sebastian P 47b9dab016
Fix: change tasks.task_data column type to longblob in mysql (#2418)
Fix #2206 

Changes are copied and adapted from #1050
2023-09-10 13:33:48 +02:00
qwerty287 81ead7cbf2
Support user secrets (#2126) 2023-08-21 15:04:12 +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
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 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
6543 b54f6ebad6
Let pipeline-compiler export step types (#1958) 2023-07-11 15:53:05 +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
qwerty287 cd982fcbd1
Fix pipeline status calculation/reporting (#1898)
Closes #1895 
Regression of #1784
2023-06-29 14:56:01 +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
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
qwerty287 5d74174bc3
Drop old columns (#1838) 2023-06-07 19:22:44 +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 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
Julien Palard 6af9371011
Docs: The WOODPECKER_ADMIN environment variable is singular. (#1699) 2023-04-08 01:34:36 +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
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
Anbraten 2337f1854a
Add queue details UI for admins (#1632)
# Changes
- Adds an admin view to see the whole work-queue of the server. 
- The admin can also pause / resume the queue. 
- The view is reloading data every 5 seconds automatically.
- The task model from queue got removed in favor of the one from models.
2023-03-20 04:50:56 +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
Anbraten 277a839157
Add users UI for admins (#1634)
Co-authored-by: Lauris BH <lauris@nix.lv>
2023-03-18 21:21:20 +01:00
Lukas 1b43b0bf20
Add pull request labels as environment variable (#1321)
Closes #1308 

Co-authored-by: Anbraten <anton@ju60.de>
2023-03-17 03:43:04 +01:00
Lukasz dc90f97524
Persist DepStatus of tasks (#1610) 2023-03-11 01:58:28 +01:00
6543 18d3139e9e
Use modern error handling and enforce it via lint (#1327)
Co-authored-by: Anbraten <anton@ju60.de>
2023-02-02 00:08:02 +01:00