Commit graph

394 commits

Author SHA1 Message Date
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
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 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 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 f02789c74a
Fix bug where db file is posible moved outside of docker volume (#496)
#494 introduced a bug, where a migration function can remove the sqlite3 file outside of the mounted docker volume.
that would result in a data lose after a container recreate.

this fix it by only rename the file if in same folder else just use the old path as fallback and put warnings into the log

Co-authored-by: Anbraten <anton@ju60.de>
2021-10-30 14:53:24 +02: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 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
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
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
John Olheiser 03bb0e69d8
Replace debug with log-level flag (#440)
* Add logging level to CLI and API

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

# Conflicts:
#	server/router/router.go

* Apply suggestions from code review

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

* Refactor log level

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

* Remove API

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

* Fix API imports

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

* do not relay on external default

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Anbraten <anton@ju60.de>
2021-10-16 17:41:36 -05:00
Anbraten 4cc8594b63
Update links to woodpecker-ci.org (#445) 2021-10-14 18:13:57 +02:00
John Olheiser 12db87f8e6
Change prometheus namespace to woodpecker (#439)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2021-10-13 08:34:57 +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
Masaya Watanabe 7913d6db95
Fix channel buffer used with signal.Notify (#421)
Co-authored-by: Anbraten <anton@ju60.de>
2021-10-09 03:14:25 +02:00
6543 5d8e60808d
Move cli exec flags to own file (#380)
Co-authored-by: Anbraten <anton@ju60.de>
2021-10-03 15:07:39 +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 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
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
6543 06d83c7b0e
Remote Gitea drop basic auth support (#365)
you now have to set **gitea-client** and **gitea-secret**.
2021-09-27 08:11:11 +02:00
Anbraten 0fa271f465
Add json schema and cli lint command (#342)
- Add json schema file
- Add tests to validate sample pipeline files
- Add new command `lint` to cli to test a directory or single file to use correct schema

Example:  `woodpecker-cli lint ./pipeline/schema/.woodpecker/`

---
close #275 
preparation for #276 


Co-authored-by: 6543 <6543@obermui.de>
2021-09-27 02:38:15 +02:00
Anbraten bd19f90756
Replace www-path with www-proxy option for development (#248)
By adding a new ENV variable called `WOODPECKER_WWW_PROXY` it is possible to serve a webinterface via a proxy configured by the `WOODPECKER_WWW_PROXY` value for development instead of serving the interface from the bundled code or from some folder location as the old `WOODPECKER_WWW` option allowed. Using a proxy allows developing the UI with hot-reloading.
2021-09-27 00:22:23 +02:00
6543 0bd10fa507
Cleanup Code (#348)
* Fix "Empty slice declaration using a literal"
* Fix "collides with imported package name"
* Remove unused code in pipeline
* Remove unused oauth2.providerAuthHeaderWorks()
* Add TODOs
* Format Code
* Cleanup doublestar import
* Migrate deprecated functions

Co-authored-by: Anbraten <anton@ju60.de>
2021-09-24 16:29:26 +02:00
Jacob Floyd e34daae0cf
Move cncd/pipeline/pipeline/ to pipeline/ (#347)
* Refactor: move cncd/pipeline/ to pipeline/

* Refactor: move pipeline/pipeline/ to pipeline/
2021-09-24 13:18:34 +02:00
Jacob Floyd a0d008e071
Move cncd/{logging,pubsub,queue}/ to server/{logging,pubsub,queue}/ (#346)
* Move cncd/{logging,pubsub,queue}/ to server/{logging,pubsub,queue}/

* Update REAMDEs and include history

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

Co-authored-by: Anbraten <anton@ju60.de>
2021-09-23 22:29:09 +02:00
Jacob Floyd 780c902a6b
Refactor: move remote/ to server/remote/ (#344) 2021-09-23 18:25:51 +02:00
Jacob Floyd bfb9af121c
Create agent/ package for backend agnostic logic (#338)
* Refactor: Move agent stats structs to agent/

Based in part on changes by laszlocph (kube branch):
7f4a0c8c12 Factor into Runner
f7fe9edd0b Using Runner in server

* Refactor: Add Runner constructor with counter field

Based in part on changes by laszlocph (kube branch):
7f4a0c8c12 Factor into Runner
f7fe9edd0b Using Runner in server

* Refactor: Move Runner to agent/ package

Based in part on changes by laszlocph (kube branch):
7f4a0c8c12 Factor into Runner
f7fe9edd0b Using Runner in server

* Refactor: pass pipeline.backend.Engine into agent.Runner

Based in part on changes by laszlocph (kube branch):
7f4a0c8 Factor into Runner
f7fe9ed Using Runner in server

* Use well-known function signature for WriteTo

* Rename stats.go -> state.go

Co-authored-by: Anbraten <anton@ju60.de>
2021-09-23 16:58:12 +02:00
Jacob Floyd e2b59787c1
Move plugins/ package to server/plugins/ (#343) 2021-09-23 16:12:46 +02:00
Jacob Floyd 5fe712cca6
Move package store/ to server/store/ (#341)
* Refactor: move store/ to server/store/

* fix pipeline for moved tests

Co-authored-by: 6543 <6543@obermui.de>
2021-09-23 13:33:59 +02:00
Jacob Floyd b8f55f31e2
Move router package to server/router/ (#339) 2021-09-22 22:41:32 +02:00
Jacob Floyd 35a45b7961
Reorganize code into server/{api,grpc,shared} packages (#337)
* move api code to server/api
* move grpc server for agent communication to server/grpc
* move server.Config to server/config.go as it is used by both server/api and server/grpc
* move shared code used by server/api and server/grpc to server/shared
2021-09-22 20:48:01 +02:00
Anbraten b3d40024a9
Rename cmd agent and server folders and binaries (#330)
Renamed `cmd/drone-agent` to `cmd/agent` and `cmd/drone-server` to `cmd/server` and binaries to get rid of the drone name.
2021-09-21 17:06:13 +02:00
Anbraten 188b9e6eb5
Refactor cli (#329)
- move cli files from `cli/drone` to `cli/`
- move cli main to `cmd/cli/main.go` to match agent and server
- use version from `version/version.go` to match agent and server
2021-09-21 16:36:41 +02:00
Anbraten 289f0c9ad6
Change pipeline config path resolution (#299)
# Config resolution
- pipeline-config setting empty / not specified (default): `.woodpecker/` => `.woodpecker.yml` => `.drone.yml`
- pipeline-config setting defined by user: try that file / folder and no fallback (if a user sets some special value that is normally done for some reason)

# Changes
- pipeline-config setting will be empty by default
- remove fallback setting for config loading (simplifies config)

---
closes #133

---

* adjust config fetching mechanism

* default path empty

* remove fallback flag from ui and db
2021-09-17 21:40:43 +02:00
6543 d59fdb4602
[CI] Fix docs deploy & links (#301)
* set git commiter

* update links to docu

* fix image link
2021-09-11 18:48:52 +02:00
Matthias Fulz cf19b41ad4
Add flag for specific grpc server addr (#295)
Adding flag to server for setting up listen addr of grpc:

--grpc-addr / $WOODPECKER_GRPC_ADDR
2021-09-09 18:34:29 +02:00
Anbraten 1a67fc6e99
Use server-host as source for public links and warn if it is set to localhost (#251)
* Use server-host as source for public links

* use config and rm GetURL()

* fix: solve import cycle

Co-authored-by: 6543 <6543@obermui.de>
2021-08-20 16:32:52 +02:00
6543 70958acc44
update / remove drone dependencies (#236)
* include github.com/drone/signal

* update github.com/drone/envsubst

* move github.com/woodpecker-ci/expr to woodpecker org
2021-06-30 19:15:28 +02:00
6543 bfc4aa8059
Enforce code format (#228)
* format .drone.yml & go code

* improve .editorconfig

* extend Makefile

* enforce go code format

* fix space

* update deps

* clean up
2021-06-22 12:34:35 +02:00
techknowlogick 77e046b47f
Add OAuth2 Support for Gitea Remote (#226)
* add oauth support for Gitea

* go fmt

* cli flags
2021-06-17 09:02:44 +02:00
Marian Steinbach 16bdc9fe12
Move flag definitions into extra files (#215) 2021-05-31 14:35:47 +02:00
Marian Steinbach 3d083ec058
Remove unused code in server (#213) 2021-05-31 14:34:00 +02:00
Marian Steinbach 8f76192b77
Show all env var names in log messages (#208) 2021-05-31 13:28:24 +02:00
Alex Eftimie a3a361ad10
Update setup.go 2021-05-27 07:27:13 +02:00
Alex Eftimie 943a308afe Allow configuring the URL to user documentation 2021-05-27 06:58:30 +02:00
Laszlo Fogas c7ebd68232 Relaced laszlocph/woodpecker with woodpecker-ci/woodpecker 2021-05-25 14:08:27 +02:00
Laszlo Fogas 5ea7098569 Go 1.16, go fmt, go modules update 2021-02-19 09:43:03 +01:00
Jens 25e403e434 Add WOODPECKER_ vars to agent 2020-08-26 13:54:25 +00:00
Jens 6137045247 Add WOODPECKER_ variables 2020-08-26 13:40:26 +00:00
Jens Heinrich aaf80259d3
Update server.go
Reference both possible values to make debugging easier
2020-08-04 18:03:15 +02:00
Laszlo Fogas 6feae313ec
Merge pull request #120 from imduffy15/docker-config-secrets
Add global registry from docker config file on woodpecker server
2020-05-20 08:43:11 +02:00
Laszlo Fogas 14636cc226
Merge pull request #119 from imduffy15/owner-filter
Add whitelist for syncable owners
2020-05-20 06:53:24 +02:00
Ian de010dfb39 Add global registry from docker config file on woodpecker server 2020-05-19 13:44:16 +01:00
Laszlo Fogas 1444b06a7e
Merge pull request #118 from imduffy15/global-envs
Add support for a global env from a server flag
2020-05-19 14:26:33 +02:00
Laszlo Fogas a9ee3c2296
Merge pull request #116 from imduffy15/secure-grpc
Allow the agent to connect to a secure grpc endpoint
2020-05-19 13:53:07 +02:00
Ian 0d90789422 Add whitelist for syncable owners 2020-05-18 16:58:59 +01:00
Ian 070f6ea49c Add support for a global env from a server flag 2020-05-18 16:48:31 +01:00
Ian a11db91e49 Upgrade dependencies 2020-05-18 16:41:15 +01:00
Ian c26b722736 Allow the agent to connect to a secure grpc endpoint
Add flags to allow the agent to connect to a secure grpc endpoint.

This can be done by placing nginx in front of the drone-server or updating the
code to accept tls servers for the grpc server.
2020-05-18 15:49:38 +01:00
Laszlo Fogas 16765d939d Compile error 2019-11-12 21:49:38 +01:00
Laszlo Fogas 8dee34878d Version is now a string coming from ldlags and git tags 2019-11-12 21:10:16 +01:00
Laszlo Fogas 630c383181 Project is renamed to Woodpecker 2019-08-27 13:07:19 +02:00
Laszlo Fogas f0c641fa9d Exposing waiting job count as metric 2019-07-10 10:00:38 +02:00
Laszlo Fogas 1d564e978f More prometheus metrics, refactoring 2019-06-28 14:28:41 +02:00
Laszlo Fogas f25317599a Unlimited 2019-06-01 09:45:20 +02:00
Laszlo Fogas 16d68eddbf Was throwing: currval of sequence builds_build_id_seq is not yet defined in this session 2019-05-30 14:06:49 +02:00
Laszlo Fogas f65c4993c1 Fixes 2019-05-30 12:15:29 +02:00
Laszlo Fogas 5dc9f7dc83 Reimlemented metrics 2019-05-30 11:11:14 +02:00
Laszlo Fogas a4541ac901 Pull in cncd/* for simpler workflow 2019-04-06 15:44:04 +02:00
Laszlo Fogas ca5817ffc2 Renamed package 2019-04-04 20:51:20 +02:00
Brad Rydzewski 6a651f1e39 move vault params to extras 2018-05-01 21:05:30 -07:00
Matt Leung 187d1d65bb add additional opt to set v.auth 2018-04-27 14:50:47 -07:00
Matt Leung 79428aa231 Enable Vault auth through kubernetes auth method
Added a feature to obtain the initial Vault token from the Kubernetes
auth method.

This works by making a request to the Vault server at the specified auth
method mount point's login path and presenting the JWT located in a file
on a running pod, along with the Kubernetes role to authenticate as.

Vault will then respond with a token and its TTL, if the request is valid.
2018-04-24 14:56:28 -07:00
Brad Rydzewski 897eb95bcd
Merge pull request #2369 from JonasFranzDEV/master
Add context to Gitea status
2018-03-30 09:32:09 -07:00
Thomas Boerger 06ff6b50ed
Use specific token for prometheus metrics 2018-03-27 22:22:19 +02:00
Thomas Boerger 7f49e69607
Just fixed format with go fmt ./... 2018-03-21 14:02:17 +01:00
Jonas Franz 6a32935011
Add context to gitea status
Signed-off-by: Jonas Franz <info@jonasfranz.software>
2018-03-10 20:11:34 +01:00
Brad Rydzewski 580fe9abb7 add apache license header to files 2018-02-19 14:24:10 -08:00
Brad Rydzewski ce740a635e
Merge pull request #2295 from jmccann/keepalive_server
Allow setting MinTime for keepalive enforcement on server
2018-02-19 13:36:13 -08:00
Brad Rydzewski 909053ba5b
Merge pull request #2244 from appleboy/fix2
Fix drone filter func
2018-02-19 13:01:05 -08:00
Tony Li 9651a8043e
add usage for cpu-set 2018-02-13 10:41:36 -08:00
Tony Li 84954e2d20
fix verbage 2018-01-30 13:30:06 -05:00
Tony Li 0a6666b4bf
update server-agent usage 2018-01-30 13:28:17 -05:00
Tony Li 22522bfe44
update server usages 2018-01-30 13:28:07 -05:00
Tony Li 625ef44f55
make same 2018-01-29 19:21:46 -05:00
Tony Li 73914fdbd5
update server cli usage 2018-01-29 19:21:32 -05:00
Tony Li e1a695bd04
update agent cli usage 2018-01-29 19:00:14 -05:00
Jacob McCann 8295166ca4 Update usage for keepalive-min-time 2018-01-24 08:41:11 -06:00
jhernandezb 546e0bad00
Fix autocert generation 2018-01-18 10:33:41 -06:00