Commit graph

823 commits

Author SHA1 Message Date
6543
c4960cdd2c
Ignore items from WOODPECKER_ENVIRONMENT only containing a key and no value (#781)
* fix 761

* refactor: rename to match what it does & log ignore case
2022-02-23 08:59:52 +01:00
Zav Shotan
905350fa15
Add support for default clone image environment variable (#769)
This allows for custom clone images for deployment in air-gap systems.

Co-authored-by: Zav Shotan <zshotan@bloomberg.net>
2022-02-10 17:05:19 +01:00
Zav Shotan
f16525fae5
Add flag to always authenticate when cloning public repositories (#760)
As a developer using an custom git server (e.g. Github Enterprise) I would like to be able to authenticate 
the user on repositories which are marked as public.

See issue: https://github.com/woodpecker-ci/woodpecker/issues/473

Ref: https://github.com/woodpecker-ci/woodpecker/pull/693#issuecomment-1025771162
2022-02-08 17:55:08 +01:00
6543
0d463ca467
Let non required migration tasks fail and continue (#729) 2022-01-31 15:50:10 +01:00
6543
2a5159f7fe
Fix pipeline timestamps (#730)
* only calculate time on running builds

* Add updated timestamp into database and use it in frontend

* add more trace logging

* refactor (move grpc unrelated func into related package)

* fix xorm schema

* add todo
2022-01-31 15:38:39 +01:00
Anbraten
6af94d79e3
Remove unused flags / options (#693)
Some flags where unused and / or unnecessary as they are covered by alternatives implemented in PRs of milestone 0.15.0 and just complicated the setup.

closes #681
2022-01-31 15:38:00 +01:00
6543
071bd7418a
Fix tests and pipeline (#732)
* fix pipeline

* use EqualStringSlice to compare slices in tests

* full test coverage

* tests: wait for mysql/postgres to sync ...
2022-01-31 14:39:53 +01:00
6543
edbf6a3ba9
Allow to change status context again (#674)
* use flag value

* fix test

* sed -i 's/STATUS_CONTEXT/WOODPECKER_STATUS_CONTEXT/g'

* docs

* Update docs/docs/91-migrations.md

Co-authored-by: Anbraten <anton@ju60.de>
2022-01-29 20:37:36 +01:00
Anbraten
401072abb1
Support ChangedFiles for Github & Gitlab PRs and Gitlab pushes (#697) 2022-01-17 23:46:59 +01:00
Anbraten
2f780193b1
github tag build should not have changed files (#698) 2022-01-16 18:44:44 +01:00
6543
5a120db69d
remove "panic()" as much as posible from code (#682) 2022-01-09 23:27:30 +01:00
Anbraten
37c82b905c
Show yml config of pipeline in UI (#649)
closes #89
2022-01-09 03:59:45 +01:00
Anbraten
5e595978fa
Send decline events back to UI (#680)
and remove unused code
2022-01-09 03:47:31 +01:00
6543
8489b5bd37
Gitea: push webhook notice changed files of all related commits (#675)
* getChangedFilesFromPushHook: use all commits

* add test
2022-01-08 22:16:07 +01:00
6543
1588495b1a
Build ref link point to commit not compare if only one commit was pushed (#673)
close #401
2022-01-08 22:06:00 +01:00
6543
c186e2fa8c
Update dev-docs & improve migration code (#670) 2022-01-08 20:21:22 +01:00
6543
acbde30c3b
Lint code with gofumpt (#664) 2022-01-06 07:44:14 +01:00
6543
2f91bdd4a0
gofumpt -w -l -extra . (#661) 2022-01-05 21:50:23 +01:00
6543
dec0eeeed7
Use global branch filter only on events containing branch info (#659)
- close #581
- delete unused code
- simplify code
- add check to procBuilder to fail on invalid config
2022-01-05 17:54:44 +01:00
jdoubleu
abd3d1d5c3
API GetRepos() return empty list if no active repos exist (#658) 2022-01-03 20:31:53 +01:00
jdoubleu
132d3567f4
skip nested GitLab repositories during sync (#656)
Implements https://github.com/woodpecker-ci/woodpecker/pull/651#issuecomment-1003794674, partly fixes #648
2022-01-03 16:35:46 +01:00
Anbraten
7e6765ce95
hotfix gitlab sub repo listing (#652) 2022-01-03 16:35:17 +01:00
Anbraten
f7d1451ca3
pass repo to remote perm func (#653)
* pass repo to remote perm func

* go:generate mockery

Co-authored-by: 6543 <6543@obermui.de>
2022-01-03 15:33:36 +01:00
6543
a2429eb570
Do not exclude repo owner from gated rule (#641) 2022-01-01 13:17:42 +01:00
6543
30c3e139d7
proc.Tree() func do not depend on sorted procs list (#647)
* proc.Tree() func do not depend on sorted procs list

* Add test case

Signed-off-by: 6543 <6543@obermui.de>
2021-12-31 17:43:09 +01:00
ktprograms
b76606308c
Add field for image list in Secrets Repo Settings (Web UI) (#638)
- Add field for image list in Secrets Repo Settings (Web UI)
  Simple comma separated input field, split into images array
- validate secret images in backend
- trim spaces and filter empty list items

Signed-off-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
2021-12-30 07:26:36 +01:00
Anbraten
8e8f8967c3
Improve status updates (#561)
- link to specific proc (only general build before)
- set status for all procs (before: only for the whole build on some SCMs)
- set status after restart
- set status to pending after waiting for approval
- make status of gitlab, gitea & github equal
- dedupe status update code
- dedupe `PostBuild` code

close #410, close #297, close #459, close #521
2021-12-28 17:02:49 +01:00
6543
0aefdc9978
Add tests framework for storage migration (#630)
* add test sqlite db

* migration tests for sqlite

* fix pipeline config

* fix tests to other dbms

* fix postgres & mysql
2021-12-20 16:15:21 +01:00
6543
b2ce1f5da5
fix sqlite migration on column drop of uncommon schemas (#629)
* fix sqlite schema normalising

* sqlite robuster alg to extract columns form schema
2021-12-20 09:59:27 +01:00
6543
ef597eca0c
Add flag for not fetching permissions (FlatPermissions) (#491) (#625)
Co-authored-by: Alex Eftimie <alex.eftimie@getyourguide.com>
2021-12-19 12:04:29 +01:00
Anbraten
ed0a9fd756
Use gitlab generic webhooks instead of drone-ci-service (#620)
Benefits:
- the webhook delivery history of the drone-ci-service is broken (no way to check if a webhook was successfully delivered by Gitlab)
- drone-ci-service has limited events support (for example no comment or branch deleted event)
- independent from drone integration in general
2021-12-19 01:12:09 +01:00
Anbraten
ce462ce4ac
fix new build not published to UI if blocked mode enabled (#619) 2021-12-19 00:23:48 +01:00
6543
f4c73792f3
Calculate build number on creation (#615)
* Calculate build number on creation
* Delete repo.Counter (form code and database)
2021-12-18 20:37:51 +01:00
Anbraten
1f85615a5d
Improve hook errors (#612)
Fixed problems:
- `c.AbortWithError()` stops the chain, but does not return a message as http response
- only return woodpeckers own messages and hide errors from http response (could be dangerous)
- added missing returns
- log all messages send to the user (at least on debug level)
2021-12-18 14:58:01 +01:00
6543
039bce7758
Use same func for accept gated pipelines and none gated pipelines (#594)
* write back to webhook caller what happend

* skip sound like an error - it is none change that

* improve hook func

* dedup code & fix bugs that only existed on gated builds

* startBuild use std context

* wordings

Co-authored-by: Anbraten <anton@ju60.de>

* nit

* todo done

Co-authored-by: Anbraten <anton@ju60.de>
2021-12-18 00:09:09 +01:00
Anbraten
3bee9044f1
Add flag to set oauth redirect host in dev mode (#586) 2021-12-13 20:22:09 +01:00
6543
0e89923854
rm workaround for gitlab webhook parsing (#601)
upstream got merged: https://github.com/xanzy/go-gitlab/pull/1282
possible because of #599
2021-12-12 21:40:36 +01:00
Anbraten
fe6c999160
Let remove be a remove (#593)
* UI: let remove be a remove
* UI: add deactivate repo btn
* Store: DeleteRepo also delete related
* Store: more test coverage

Co-authored-by: 6543 <6543@obermui.de>
2021-12-11 16:03:14 +01:00
6543
4cbdacb21c
Nits Collected over last month (#595)
- add coverage.out
- add context queue
- fix misspell
- sanitize config: WOODPECKER_GITEA_URL
- storage backend migration should have no xorm session within migration function
2021-12-11 13:15:04 +01:00
6543
7ab33f62f7
fix unit tests 2021-12-11 02:41:28 +01:00
Anbraten
cb97b39c82
Fix pr secret event names (#592)
* Fix pr secret event names
* Add validation for secret events
2021-12-11 02:37:40 +01:00
6543
4ea00f0035
Make cancel pipeline work again (#585)
* logger: on level debug or trace add caller to logs

* more logging

* fix cancel bug

* ignore error if occur for queue cancel
2021-12-08 23:40:00 +01:00
6543
3ec00140d9
Dont panic, report error back (#582)
dont panic! return error back
2021-12-08 23:36:23 +01:00
Anbraten
56f957b4e6
Improve favicons (#576)
- dark-mode favicon variants
- favicons based on pipeline state if opened build page

Co-authored-by: 6543 <6543@obermui.de>
2021-12-08 13:58:00 +01:00
Lukas
680d003a29
Add linter revive (#554)
* Add linter revive

* Add underscore to variable name to prevent shadowing

* Remove unnecessary leading underscore

* Revert changes to vendor file

* export ConfigFetcher as interface

* no 'yoda conditions'

* rename envsubst

Co-authored-by: 6543 <6543@obermui.de>
2021-12-01 14:22:06 +01:00
6543
7931bc78eb
Let normal repo admins change timeout to lower values (#543)
fix #534
fix #179

Co-authored-by: Anbraten <anton@ju60.de>
2021-11-27 16:06:00 +01:00
Lukas
2c75a299e2
Add linter unused (#551) 2021-11-27 15:29:37 +01:00
Lukas
eb134a2e27
Add linter ineffassign (#550) 2021-11-27 13:17:03 +01:00
6543
34a17f8219
Postgress can exec Sync2 after migration only in own transactions (#544)
(postgress do not allow us to use sync2 twice in one transaction at all)
2021-11-27 12:02:52 +01:00
6543
5e6b38e0e7
Server obtain remote from glob config not from context (#540) 2021-11-26 13:01:54 +01:00
6543
8b476e7722
Simplify web router code (#541) 2021-11-26 09:50:56 +01:00
Anbraten
c1a8884d62
Add backend selection for agent (#463)
- add backend selection option
- by default it will auto-detect a backend
2021-11-26 03:34:48 +01:00
Anbraten
65e10d46b3
Serve index.html directly without template (#539)
Remove not needed template functions
2021-11-26 01:12:44 +01:00
Lukas
fb333a3b1b
Add linter structcheck (#537) 2021-11-26 00:27:43 +01:00
Anbraten
063d0bb32a
Replace DRONE_ with CI_ variables in pipeline steps (#427)
Dropped support for `DRONE_*` environment variables in pipeline steps. Pipeline meta-data can be accessed with `CI_*` variables.
  - `CI_*` prefix replaces `DRONE_*`
  - `CI` value is now `woodpecker`
  - `DRONE=true` has been removed
2021-11-25 20:43:31 +01:00
6543
ff8ad5bb83
Fix registry delete (#532)
- Make make it possible to delete `"§4fda`
- Reject non urls for registry-address
- Fix #520
2021-11-25 19:04:36 +01:00
Lukas
fac0e16996
Add linter staticcheck (#535)
* Add linter staticcheck

Co-authored-by: 6543 <6543@obermui.de>
2021-11-25 17:15:36 +01:00
Lukas
116c310820
Add linter misspell (#530)
* Add linter misspell

* Fix spelling

Co-authored-by: Anbraten <anton@ju60.de>
2021-11-24 02:01:12 +01:00
Lukas
25bf91bd37
Add linter whitespace (#531) 2021-11-24 01:31:11 +01:00
6543
fe31fb1e06
Drop error only on purpose or else report back or log (#514)
- Remove Deadcode
- Simplify Code
- Drop error only on purpose
2021-11-23 15:36:52 +01:00
6543
f454371e56
store migrations: cache migrations and add note (#522)
* Cache migrations instead of query each time
* Add a note of migration execute order 

Co-authored-by: Anbraten <anton@ju60.de>
2021-11-23 05:06:46 +01:00
6543
51617e7f86
Rename struct field and add new types into server/model's (#523)
Resolve some todos in server/model:
 * Move persistent queue into its own package
 * Create Types: StatusValue, SCMKind, RepoVisibly
 * Rename struct Repo fields: SCMKind, IsSCMPrivate
2021-11-22 12:55:13 +01:00
6543
07b32fa0fe
Update database in one transaction on syncing user repositorys (#513)
* userSyncer Sync commit changes in one transaction
* cover new cases with unit tests
2021-11-18 15:42:18 +01:00
6543
4891f104f0
Update only relevant cols on repo sync (#512)
close #511
2021-11-15 00:55:37 +01:00
6543
86bb8f195c
format do 'simplify' and check via CI (#509)
* `make format` simplify code now

* code format

* check simplified via linter
2021-11-14 22:33:45 +01:00
6543
2524c6900c
Fix reggression, save not activated repos to database on sync again (#510)
* Fix #508
* Add testcase

Unrelated nits:
* Rm one index (unique will already create an index)
* Do not drop  on UpdateUser
2021-11-14 22:13:59 +01:00
6543
ca8e215cfa
Migrate to Xorm (#474)
close #234

* Migrate store
* Migrate tests
* Rewrite migrations
* Init fresh DB in on step
* Rm old stuff (meddler, sql files, dead code, ...)
2021-11-13 20:18:06 +01:00
6543
aca5fddcf3
Use Goblin Assert as intended (#501)
this allow for better debugging if an error occur
2021-11-04 14:42:25 +01:00
Anbraten
58838f225c
Rewrite of WebUI (#245)
Rewrite of the UI using Typescript, Vue3, Windicss and Vite. The design should  be close to the current one with some changes:
- latest pipeline in a sidebar on the right
- secrets and registry as part of the repo-settings (secrets and registry entries shouldn't be used as much so they can be "hidden" under settings IMO)
- start page shows list of active repositories with button to enable / add new ones (currently you see all repositories and in most cases you only add new repositories once in a while)
2021-11-03 17:40:31 +01:00
Anbraten
06800cb61e
Change paths to use woodpecker instead of drone (#494)
* change paths to use woodpecker instead of drone

* improve sql file migration

* add migration notice
2021-10-28 14:02:43 -05:00
6543
965235e421
Remove some wrapper and make code more redable (#478)
* meaningful var names
* no context wrapper, use store directly
* retrieve store from context once
* rm store.GetRepoOwnerName
2021-10-28 11:12:58 +02:00
6543
473a05d5b5
Update gogs client (#487)
* update github.com/gogits/go-gogs-client

* migrate

* fix test & use DefaultBranch
2021-10-28 10:09:27 +02:00
6543
798c2bc8b2
Upgrade urfave/cli to v2 (#483)
* migrate urfave/ci v1 -> v2
* refactor cli (format flag)
* log error if agent can not listen on port 3000

close #452
2021-10-27 21:03:14 +02:00
Anbraten
d35f5158bc
Add repo branches endpoint (#481)
* add repo branches endpoint

* add branches func to remotes
2021-10-27 02:47:55 +02:00
Anbraten
63a93087a1
Gitea use default branch (#480)
instead of hard-coded default branch use what gitea tell us
2021-10-27 00:37:01 +02:00
Anbraten
3c5827f08a
Fix repo access (#476)
* fix repo access

* fix permission syncing
2021-10-26 21:29:30 +02:00
6543
5990d32fd3
More logging and refactor (#457)
* only use "context"
* enable 'h2' support at server
* trace log  remote and database config
* log loglevel on start
2021-10-19 11:44:49 +02:00
Cyrill Burgener
fd8e0b248b
Add TestPipelineName to procBuilder_test.go (#461)
test for a bug where pipelines that use `depends_on` were not built in multi-pipeline builds. The problem is that pipelines names keep a leading `'/'` when the pipeline path does not have a trailing `'/'`.
2021-10-19 09:35:10 +02:00
6543
bbbb53b9bc
Always wait 3s to fetch pipeline config (#458)
This fix a bug where first try will fail because timeout is 0s
2021-10-19 02:04:21 +02:00
John Olheiser
8e658c135d
Add log level API (#444)
* Add log level API

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update cli/loglevel/loglevel.go

Co-authored-by: Anbraten <anton@ju60.de>

* Move API to api routes

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-authored-by: Anbraten <anton@ju60.de>
2021-10-18 18:25:20 -05:00
Anbraten
fd9448cad7
simplify routes (#437) 2021-10-13 18:36:11 +02:00
Anbraten
72aa979644
Add repo permission endpoint (#436) 2021-10-13 14:16:26 +02:00
Anbraten
e6183e3378
Move api-routes to own file (#434) 2021-10-12 21:01:14 +02:00
Anbraten
f779860ff1
Add web-config.js endpoint (#433)
This is a preparation for #245 and adds a new endpoint (`.js``file) which can be included by the web-ui to get some config and credentials like the user profile or access-token.
2021-10-12 18:21:13 +02:00
Anbraten
3d6bc43ff1
Remove unused repo-config option (#432) 2021-10-12 12:00:03 +02:00
John Olheiser
4276a04f0c
Move entirely to zerolog (#426)
Completely switch to zerolog

(Remove usage of logrus and std logger)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2021-10-12 09:25:13 +02:00
John Olheiser
9c85c8fd68
Enable pull_request hook by default on repository activation (#420)
Closes #419

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2021-10-09 03:26:35 +02:00
luzpaz
9b687a923e
Fix various typos (#416)
Fix various typos found via `codespell -q 3 -S vendor -L pullrequest,pullrequests`
2021-10-08 18:35:56 +02:00
John Olheiser
88389e4a06
Append trailing slash to default GH API URL (#411) 2021-10-07 09:49:45 +02:00
6543
169e7e5aa3
Refactor Gitlab Remote (#358)
- Replace custom client
- Update Docs
- Test if it works
- Update Tests

close #285
2021-10-03 14:42:47 +02:00
Anbraten
bb37836600
Replace drone strings with woodpecker (#391)
Co-authored-by: 6543 <6543@obermui.de>
2021-10-02 10:59:34 +02:00
Anbraten
ed6d3f3cea
Use go embed for web files and remove httptreemux (#382)
- replace togo with go embed
- replace httptreemux with gin

closes #308
2021-09-29 17:34:56 +02:00
6543
a82d569bd1
Upgrade github client (#381)
* update github client

* ajust types
2021-09-29 07:59:46 +02:00
6543
7f3a6eb17f
Update Generated Proto Code (#351)
update generated code (definitions, client implementation & server interface)
and add documentation how to generate
2021-09-29 02:10:09 +02:00
Marian Steinbach
17b8867b96
Clean up config environment variables for server and agent (#218)
The goal here is to make consistent use of configuration environment variables prefixed `WOODPECKER_`. Where several variants existed, this PR aims to remove all but one option, leaving the most explicit.

This PR only changes server and agent code, but not documentation, in order to keep the PR digestible. Once we have consensus that this is correct, I'll change docs accordingly.

User (rather: admin) facing changes in this PR:

- In general, support for all server and agent config environment variables (env vars) starting with `DRONE_` is removed. The according `WOODPECKER_*` variables must be used instead.
- The env var `WOODPECKER_HOST` replaces `DRONE_HOST`, and `DRONE_SERVER_HOST`.
- The env var `WOODPECKER_AGENT_SECRET` is used to configure the shared secret which agents use to authenticate against the server. It replaces `WOODPECKER_SECRET`, `DRONE_SECRET`, `WOODPECKER_PASSWORD`, `DRONE_PASSWORD`, and `DRONE_AGENT_SECRET`.
- The env var `WOODPECKER_DATABASE_DRIVER` replaces `DRONE_DATABASE_DRIVER` and `DATABASE_DRIVER`.
- The env var `WOODPECKER_DATABASE_DATASOURCE` replaces `DRONE_DATABASE_DATASOURCE` and `DATABASE_CONFIG`.
2021-09-28 15:43:44 +02:00
Anbraten
6144f16631
Remove unsupported pipeline file extension "yaml" (#373)
Docs, `sanitizePath` and json-schema do not mention / support `.yaml` (only `.yml`) files so they should simply be ignored.
2021-09-28 14:07:25 +02:00
6543
e3499f610d
Pass down context.Context (#371)
* pass context down to remote clients

* make tests work

* add ctx to Refresh() and use it

* bitbucketserver

* code format

* plugin interface: add todo context

* solve todo

* RM TODO by using context.WithTimeout

* refactor & fix

* Apply suggestions from code review

Co-authored-by: Anbraten <anton@ju60.de>

* go fmt

* Update server/remote/coding/coding.go

Co-authored-by: Anbraten <anton@ju60.de>

Co-authored-by: Anbraten <anton@ju60.de>
2021-09-28 12:56:59 +02:00
6543
c0888de86b
Delete Gerrit placeholder (#372) 2021-09-28 10:22:34 +02:00
6543
f81bd8c656
Extend Logging & Report to WebHook Caller back if pulls are disabled (#369)
* Add more logging 
* Format Code
* Add TODOs
* Fix nits
* Delete two unused functions
* Report to WebHook Caller back if pulls are disabled
2021-09-27 23:32:08 +02:00
6543
a94807efeb
Refactor: move model/ to server/model/ (#366) 2021-09-27 19:51:55 +02:00