1
0
mirror of https://codeberg.org/crowci/crow.git synced 2025-08-06 09:22:46 +03:00
Commit Graph

117 Commits

Author SHA1 Message Date
qwerty287
f4f6eaadba fix: Correctly handle approval requirement if PR is closed (#4902) 2025-03-10 10:10:46 +01:00
pat-s
a28c366d14 feat: add CI_COMMIT_PULL_REQUEST_TITLE env var (#80)
fix #70

Reviewed-on: https://codeberg.org/crowci/crow/pulls/80
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2025-02-23 19:53:33 +00:00
pat-s
d6137b74b8 fix: properly respect keepMinPipelines when filtering purgeable pipelines (#79)
### Before

- Only `totalCount - keepMin` pipelines were queried from the DB, causing the diff never to be evaluated
- The missing count then caused the later subsetting to be effectively non-functional, as it would include almost all pipelines due to the missing batch filtered out earlier

### After

- `totalCount`pipelines are queried from the DB in batches
- The sorting and filtering is done after the loop
- More helpful debug logs

Reviewed-on: https://codeberg.org/crowci/crow/pulls/79
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2025-02-23 18:22:45 +01:00
pat-s
901a614246 feat: add log purge setting as repo setting (#34)
follow-up #10 (which was a git hickup)

![image](/attachments/a7655406-b492-4912-873b-d3d6f692be9e)

![image](/attachments/fe365dce-65dd-40cc-aeb8-3d9ca95a52ad)

## Behaviour

Log purging is attempted in an asynchronous process before a new pipeline of a specific repo is started.
It does so by

1. Getting all existing pipelines
2. Filtering by `keepMin` and `keepDuration` settings
3. Calling `LogDelete` for all remaining pipelines

Deleting only logs instead of the full pipeline (which `crow-cli pipeline purge` does) is preferred to keep historic pipeline information. Storing this in the DB is just a single line and doesn't contain much content (in contrast to logs).

## Defaults

- No minimum count is kept (`CROW_DEFAULT_LOGS_PIPELINES_KEEP_MIN`)
- All pipelines of the last 90 days (per repo) are kept (`CROW_DEFAULT_LOGS_KEEP_DURATION`)

## Todo

- [x] implement purge call during pipeline start
- [x] add settings to DB column and repo settings
- [x] tests
- [x] think about defaults
- [x] Currently the purge happens on all pipelines in scope, including ones which have already been cleared. To avoid these unnecessary calls, which also will add up for repos with many pipelines, an indicator is needed which allows filtering these pipelines out.

fix #9

Co-authored-by: crowci-bot <admin@crowci.dev>
Reviewed-on: https://codeberg.org/crowci/crow/pulls/34
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2025-02-19 21:19:13 +00:00
pat-s
a554f93226 refactor: frontend error handler & notification system (#56)
- Use title and message in error message
- Errors: don't auto-remove popup, force click
- Show API method and endpoint in error message title
- Use black/white bg and notification type color only on the side
- Return errors as JSON instead of strings. Include the api endpoint in the error message.
- improve error messages when missing access token
- improve pipeling config load error messages
- Error messages are shown for 9s (instead of 3)
- remove custom `notifyError` function
- Increase popup width from 300px to 340px

Co-authored-by: crowci-bot <admin@crowci.dev>
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Reviewed-on: https://codeberg.org/crowci/crow/pulls/56
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2025-02-19 16:04:31 +00:00
pat-s
cecfb22099 refactor: mocking (#38)
- `mockery` can now be run in one call instead of multiple ones
- Use the recommended "packages" approach which will be the new default moving forward
- Enforce consistent naming of mock files
- Remove warnings when invoking `mockery`
- Get rid of *many* linter warnings 🎉️

Reviewed-on: https://codeberg.org/crowci/crow/pulls/38
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2025-02-15 10:23:47 +00:00
pat-s
7673d5253f refactor: migrate import paths from github to codeberg 2025-01-31 14:57:57 +01:00
pat-s
0bd5202468 chore: revert tab - spaces migration due to test errors 2025-01-20 22:00:29 +01:00
pat-s
5797d2c420 chore: editorconfig fixes 2025-01-20 15:34:57 +01:00
Patrick Schratz
f262ab5c08 refactor: add CROW_ vars (#21) 2025-01-19 13:01:18 +01:00
Patrick Schratz
5e0dc2688f refactor: use own import paths (#5) 2025-01-17 00:36:19 +01:00
qwerty287
fdfabe6368 Support Git as only VCS (#4346)
Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
2024-12-27 22:49:19 +01:00
qwerty287
81b74025d4 Update Go imports paths (#4605)
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
2024-12-22 10:44:34 +01:00
6543
6e18a44880 Set new default approval mode based on repo visibility (#4456)
Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-12-05 09:16:25 +01:00
Thomas Anderson
532c3e3ed3 Do not set empty environment variables (#4193)
Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
2024-12-02 22:18:09 +01:00
Fernando Barbosa
896e550143 Increase log level when failing to fetch YAML (#4107)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-11-28 12:08:48 +02:00
qwerty287
5bb7cef08b Allow to set custom trusted clone plugins (#4352)
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Thomas Anderson <127358482+zc-devs@users.noreply.github.com>
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-26 14:27:05 +01:00
Anbraten
5e2fa8164b Extend approval options (#3348) 2024-11-18 14:49:12 +01:00
Lauris BH
5699d22a55 Add server configuration option to add default set of labels for workflows that has no labels specified (#4326) 2024-11-14 22:23:42 +01:00
qwerty287
29474fc7d9 Split repo trusted setting (#4025) 2024-11-01 21:37:31 +01:00
6543
febb8c5276 Implement org/user agents (#3539) 2024-09-30 12:33:16 +01:00
6543
6ad20ced5b Move docker resource limit settings from server to agent (#3174)
so you can set it per agent and not per server
2024-09-26 16:56:59 +01:00
6543
fcc57dfc38 Replay pipeline using cli exec by downloading metadata (#4103)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-09-25 07:20:51 +02:00
6543
e89a2f38fd Make cli exec metadata on pair with build in server generated metadata (#4119)
remove some old environment and add all missing options to set the whole build-in environment on `cli exec` via flags


---
*Sponsored by Kithara Software GmbH*

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-09-16 22:03:24 +02:00
qwerty287
83926133d4 Allow to restart declined pipelines (#4109) 2024-09-14 17:27:45 +02:00
6543
38ed7f9efd Remove some ci environment variables (#3846)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-09-08 08:59:58 +03:00
6543
3c8204a0e0 Allow alter trusted clone plugins and filter them via tag (#4074) 2024-09-01 20:41:10 +02:00
6543
e4f954ef94 Remove all default 3rd party privileged plugins (#3918) 2024-08-31 19:04:47 +02:00
qwerty287
bcecbbd398 Fix lint (#4032) 2024-08-14 22:37:05 +03:00
qwerty287
acd862cac3 Improve error on config loading (#4024) 2024-08-11 12:05:10 +02:00
hg
df5287bb65 Set CI_PREV_COMMIT_{SOURCE,TARGET}_BRANCH as mentioned in the documentation (#4001) 2024-08-08 19:01:59 +02:00
6543
1c7c87b8f0 Remove deprecated pipeline settings (#3916) 2024-07-23 13:06:47 +02:00
6543
764329ed1d Make sure plugins only mount the workspace base in a predefinde location (#3933) 2024-07-18 22:52:22 +02:00
Anbraten
ceb14cadc5 Fix deploy task env (#3878) 2024-07-07 13:43:07 +02:00
Lauris BH
28e982fffb Global and organization registries (#1672)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-07-03 06:33:11 -07:00
Anbraten
2fa9432ef8 Cleanup state reporting (#3850) 2024-07-01 11:20:55 +02:00
6543
4dcdebd786 Let webhook pass on pipeline parsion error (#3829) 2024-06-26 15:07:19 +02:00
6543
4ec046e415 Spellcheck "server/*" (#3753)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-06-04 08:30:54 +02:00
Robert Kaussow
89e100cfd1 Add godot linter to harmonitze toplevel comments (#3650) 2024-05-13 22:58:21 +02:00
qwerty287
8b785be645 Fix parent pipeline number env on restarts (#3683) 2024-05-06 11:47:02 +02:00
Fernando Barbosa
e6bda2c2b3 Support github deploy task (#3512)
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-05-02 18:56:19 +02:00
Anbraten
d494b6a959 Use forge from db (#1417)
This is the first step towards support for multiple forges (#138). It
inserts a forge using the currently existing env varaibles into db and
uses this forge from db later on in all places of the code.

closes #621

addresses #138 

# TODO
- [x] add forges table
- [x] add id of forge to repo
- [x] use forge of repo
- [x] add forge from env vars to db if not exists
- [x] migrate repo.ForgeID to the newly generated forge
- [x] support cache with forge from repo
- [x] maybe add forge loading cache? (use LRU cache for forges, I expect
users to have less than 10 forges normally)

---------

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
2024-04-16 08:04:55 +02:00
qwerty287
00f0fcd416 Rework addons (use rpc) (#3268)
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
2024-04-15 10:04:21 +02:00
Robert Kaussow
b4cd1da29c Apply skip ci filter only on push events (#3612)
Fixes: https://github.com/woodpecker-ci/woodpecker/issues/3606
2024-04-14 15:25:28 +03:00
6543
e57a09a404 Update pipeline state on server as a whole on approval (#3504)
We can not just update some records for steps, as we want the pipeline
engine as single source of truth but not manage the state.
And the server should only manage the state but not how pipelines work.

We can match the pipeline but neither workflows or steps 1:1, so we
"update" them as a whole by deleting existing workflow and step data and
insert the new info from engine.

close   #3494
close  #3472

---------
*Sponsored by Kithara Software GmbH*

---------

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
2024-03-18 20:07:45 +01:00
6543
43264a5f8e rename stepID to workflowID to reflect value (#3502)
address https://github.com/woodpecker-ci/woodpecker/issues/3494#issuecomment-2001986597
2024-03-18 15:21:26 +01:00
Robert Kaussow
a779eed3df Enable golangci linter gomnd (#3171) 2024-03-15 18:00:25 +01:00
qwerty287
cb3efd2cd9 Simplify store interfaces (#3437)
Use `store.Store` interface if possible.
2024-02-25 10:37:10 +01:00
qwerty287
5b0430ab4a Fix storing steps (#3431)
Closes https://github.com/woodpecker-ci/woodpecker/issues/3427
2024-02-25 08:16:14 +01:00
qwerty287
16dca0abc2 Store workflows/steps for blocked pipeline (#2757)
This stores workflows and steps to DB even if it is not yet approved and
thus blocked.

I'm not really happy with this, because even though it is stored, it
must parse the pipeline again and set back the original UUID. If you
have any ideas how to fix/improve this just comment.

In addition, this allows to view step list and side panel for approved
pipelines, https://github.com/woodpecker-ci/woodpecker/pull/2345 is
partially not longer necessary.

Closes https://github.com/woodpecker-ci/woodpecker/issues/895

---------

Co-authored-by: 6543 <6543@obermui.de>
2024-02-22 15:48:29 +01:00