Commit graph

88 commits

Author SHA1 Message Date
6543
9a57602174
Pipeline compiler should not alter specified image (#1005)
* pipeline compiler should not alter specifyed image

adress #1003
2022-08-26 20:00:11 +02:00
6543
f21d854114
Move away from deprecated go funcs (#1123) 2022-08-25 08:39:19 +02:00
6543
d3eea72663
Bump deps (#1125)
* upgrade to codeberg.org/6543/go-yaml2json v0.2.1

* upgraded github.com/bmatcuk/doublestar/v4 v4.0.2 => v4.2.0

* upgraded github.com/docker/cli v20.10.14+incompatible => v20.10.17+incompatible

* upgraded github.com/docker/docker v20.10.14+incompatible => v20.10.17+incompatible

* upgraded github.com/gin-gonic/gin v1.7.7 => v1.8.1

* upgraded github.com/golang-jwt/jwt/v4 v4.4.1 => v4.4.2

* upgraded github.com/moby/moby v20.10.14+incompatible => v20.10.17+incompatible

* upgraded github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 => v0.0.0-20220808134915-39b0c02b01ae

* upgraded github.com/lafriks/ttlcache/v3 v3.1.0 => v3.2.0

* upgraded github.com/mattn/go-sqlite3 v1.14.12 => v1.14.15

* upgraded github.com/lib/pq v1.10.5 => v1.10.6

* github.com/prometheus/client_golang v1.12.1 => v1.13.0

* upgraded github.com/urfave/cli/v2 v2.5.1 => v2.11.2

* upgraded github.com/rs/zerolog v1.26.1 => v1.27.0

* upgraded golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 => v0.0.0-20220822191816-0ebed06d0094

* upgraded github.com/xanzy/go-gitlab v0.64.0 => v0.73.1

* upgraded google.golang.org/grpc v1.47.0 => v1.49.0
2022-08-25 08:09:05 +02:00
6543
a46723334b
refactor: use switch-case not try-err (#1112) 2022-08-15 14:39:08 +02:00
Lauris BH
5a945c10e9
Fix to show build pipeline parse error (#1066) 2022-08-15 14:37:46 +02:00
Anbraten
fc862bf627
Default clone do checkout tags on tag pipeline (#1110) 2022-08-15 11:52:30 +02:00
Anbraten
e269890643
Allow multiple when conditions (#1087)
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: LamaAni <zshotan@bloomberg.net>
2022-08-14 19:32:49 +02:00
Florian Märkl
7031904dbe
Wait to finish reading logs before calling Wait() on pipeline (#1010)
This fixes errors like the following and chopped off logs ...
2022-07-31 17:12:15 +02:00
6543
1e8d4cc455
Update jsonschema and pipeline linting 2022-07-19 15:09:39 +02:00
6543
d2556a0613
Update jsonschema and define "services" (#1036)
Co-authored-by: Anbraten <anton@ju60.de>
2022-07-19 15:01:36 +02:00
6543
69ec44075c
Let single line command be a single command (#1009)
* rm go-shlex usage

* update
2022-07-19 07:20:27 +02:00
6543
8da0ee47f7
Use variables in pipeline (#1026)
use yaml aliases (https://yaml.org/spec/1.2.2/#3222-anchors-and-aliases) to have pipeline `variables`

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: Anbraten <anton@ju60.de>
2022-07-17 18:25:56 +02:00
6543
31bad81979
Use external lib to convert yaml to json (#1028)
this move shared/yml/* into an independent lib
2022-07-17 17:23:31 +02:00
Florian Märkl
4879e922c1
Avoid calling /bin/env in local backend (#1011)
/bin/env was used to resolve a command name against PATH and pass
additional environment variables.
All of this can also be achieved using functionality already provided by
go's exec lib, which will then internally pass the appropriate arguments
to e.g. execve.
2022-07-04 20:27:17 +02:00
Florian Märkl
061596d802
Gracefully handle non-zero exit code in local backend (#1002)
A non-zero exit code signifies a pipeline failure, but is not a fatal error in the agent.
Since exec reports this as exec.ExitError, this has to be handled explicitly.
This also fixes logs not being shown on build errors.
2022-07-02 15:56:08 +02:00
6543
9449b67da9
fix regression from 81dcdea2be (missmatch) 2022-06-16 23:11:27 +02:00
6543
068063655b
Make pipeline runtime log with description (#970)
* introduce runtime descriptors to pipeline runtime

* nit return orig error at traceStep()

* more logging

* refactor

Co-authored-by: Zav Shotan <zshotan@bloomberg.net>
2022-06-15 18:11:20 +02:00
Zav Shotan
81dcdea2be
Add support for steps to be a list (instead of dict) (#826)
- Support for pipeline/containers as list
- Support for container name in logs (step.Name)

Co-authored-by: Zav Shotan <zshotan@bloomberg.net>
Co-authored-by: 6543 <6543@obermui.de>
2022-06-13 23:13:09 +02:00
Arno Hautala
cdbba4c306
fix run_on references with runs_on in docs (#965) 2022-06-10 05:44:26 +02:00
Anbraten
e79ad00826
Add agent tagging / filtering for pipelines (#902)
Officially support labels for pipelines and agents to improve pipeline picking. 

* add pipeline labels
* update, improve docs  and add migration
* update proto file

---
closes #304 & #860
2022-05-31 01:12:18 +02:00
6543
e2e094cfda
Revert "Do not run clone step if no pipeline step will run (#877)"
This reverts commit f05f918b8d.
2022-05-20 05:20:17 +02:00
qwerty287
f05f918b8d
Do not run clone step if no pipeline step will run (#877)
Skip the clone step and ignore hook/pipeline if no pipeline step except clone would run. The status reported back to the forge is `success`.

Closes https://github.com/woodpecker-ci/woodpecker/issues/778
2022-05-18 23:25:14 +02:00
6543
7cf5a1545e
Drop deprecated environment vars (#920) 2022-05-17 17:26:35 +02:00
6543
4136df7551
Drop VarArgs in steps in favour of settings (#919)
* drop VarArgs in steps in favour of settings
* update unit tests
2022-05-17 16:43:05 +02:00
qwerty287
687d57217d
Fix branch condition on tags (#917)
* Fix branch condition on tags

* Add docs

* Update docs/docs/20-usage/20-pipeline-syntax.md

Co-authored-by: Anbraten <anton@ju60.de>
2022-05-16 20:04:00 +02:00
Zav Shotan
acbcc53872
Added support for step errors when executing backend (#817)
When executing a backend step, in case of failure of the specific step, the run is marked as errored but the step error is missing.

Added:
1. Log for the backend error (without trace)
2. Mark the step as errored with exit code 126 (Could not execute).

Co-authored-by: Zav Shotan <zshotan@bloomberg.net>
Co-authored-by: Anton Bracke <anton@ju60.de>
2022-05-11 13:40:44 +02:00
Anbraten
62a1fd8dcb
Add support to define a custom docker network and enable docker ipv6 (#893)
- Add support to define a custom docker network and enable docker ipv6
- Adjust docs
2022-04-29 15:15:32 +02:00
qwerty287
9c6c4559a7
Add SSH backend (#861)
Add SSH backend that runs commands via SSH.

Close #848
2022-04-29 12:30:50 +02:00
John Olheiser
67d76248a3
Take in an io.Reader instead of file path (#885)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2022-04-19 10:40:48 +02:00
mscherer
16cf59163e
Do not ignore failure to clean up the context (#876) 2022-04-07 01:08:04 +02:00
6543
58303dd2a7
Move value of default clone image into shared constant package (#873) 2022-04-06 15:30:49 +02:00
mscherer
c3788d943f
Fix insecure /tmp usage in local backend (#872)
Since /tmp is writable by everybody, a user could precreate
/tmp/woodpecker with 777 permissions, allowing them to modify the
pipeline while it is being run, or preventing the pipeline from running.

And since os.MkdirAll error code wasn't checked, the same attacker
could have precreated the directory where the pipeline is executed to
mess with the run, allowing code execution under the UID of the
agent (who has access to the toke, to communicate with the server, which
mean a attacker could inject a fake agent, steal credentials, etc)
2022-04-06 03:33:00 +02:00
Anbraten
6ae7e2cc4f
Fix uppercase from_secrets (#842)
Secret names where matched based on their lowercase value already just the conversion to lowercase for `from_secrets` was missing.
2022-03-19 12:34:32 +01:00
Anthony Wang
80c72b590c
Add support to run pipelines using a local backend (#709)
This adds support for #559. I tested using [this .woodpecker.yml](https://git.exozy.me/Ta180m/Hello-world/src/branch/main/.woodpecker.yml) on my self-hosted [Woodpecker instance](https://ci.exozy.me/Ta180m/Hello-world). I was also able to get this to build [Hugo websites](https://ci.exozy.me/Ta180m/howtuwu/build/1). It's currently very simplistic but works!

close #559
2022-03-10 22:07:02 +01:00
eleith
e0d8d13a91
fix pipeline schema to support branch as an array in 'when' (#836) 2022-03-09 15:49:06 +01:00
Anbraten
e178b7b4b2
Improve agent backend loading and suppress expectable errors (#818)
* improve agent loop loading backend once

* supress container not found or stopped warnings
2022-03-08 16:21:43 +01:00
6543
a3ac393264
Use shared func for registering Sigterm on a context (#799) 2022-02-28 09:27:31 +01:00
Lukas Bachschwell
a2315fe931
Do not filter on linux/amd64 per default (#805)
* Do not filter on linux/amd64 per default & add tests

Tasks with no platform would otherwise not perform on runners with different OS/ARCH combos

Signed-off-by: Lukas Bachschwell <lukas@lbsfilm.at>
Co-authored-by: 6543 <6543@obermui.de>
2022-02-26 22:54:28 +01:00
6543
8ae124d5e6
Remove unused code (#797)
* delete empty code files

* delete outdated readme

* delete unused code

* dedup license
2022-02-25 21:42:45 +01:00
6543
505cf8c09a
make gRPC error "to many keepalive pings" only show up in trace logs (#787)
hotfix #717

This comes from the agent being inactive / not sending and requesting any data if there a no pipelines waiting for him to execute. GRPC seems to only allow 2 pings without calling an actual endpoint before closing the connection. I think this will be indirectly solved in the moment we implement something like #536

https://github.com/grpc/grpc/blob/master/doc/keepalive.md

Co-authored-by: Anbraten <anton@ju60.de>
2022-02-24 15:53:44 +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
mscherer
3b52afab93
Use DOCKER_HOST env to search for docker before searching for a hardcode docker socket (#763)
Fix #757
2022-02-09 00:08:20 +01:00
6543
95ce87fa1b
Fix path schema (#723)
- allow array for path
- remove "include:" as it is default case
- run tests on schema changes too
2022-01-29 14:26:00 +01:00
Anthony Wang
be11e57976
Fix avivable -> available typo in backend.go (#710) 2022-01-20 18:21:57 +01:00
6543
04eb7935db
Improve compile pipeline (#699)
Refactor
- use constants for strings
- more tests
- move constraint code into own package

Enhance
- all constrains use doublestart (glob pattern matching) now

Co-authored-by: Anbraten <anton@ju60.de>
2022-01-17 14:43:30 +01:00
Philipp
366701fde7
Fix multiline secrets replacer (#700)
* Fix multiline secrets replacer

* Add tests
2022-01-16 22:57:37 +01:00
6543
03638b2934
pipeline backend: remove unused var (#683) 2022-01-09 23:28:41 +01:00
6543
7986eba002
Hide multi line secrets from log (#671)
close #388
2022-01-08 20:39:52 +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