Commit graph

47 commits

Author SHA1 Message Date
qwerty287 f92f8b17a3
Make agent usable for external backends (#3270) 2024-02-08 16:33:22 +01:00
Lukas 94b882fb95
Add spellcheck config (#3018)
Part of #738 

```
pnpx cspell lint --gitignore '{**,.*}/{*,.*}'
```

---------

Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2024-01-27 21:15:10 +01:00
qwerty287 d1d2e9723d
Support custom steps entrypoint (#2985)
Closes https://github.com/woodpecker-ci/woodpecker/issues/278

---------

Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: 6543 <6543@obermui.de>
2024-01-19 05:34:02 +01:00
qwerty287 b9f6f3f9fb
Replace goimports with gci (#3202)
`gci` seems to be much more strict.
2024-01-14 18:22:06 +01:00
Robert Kaussow 9bbba4441d
Enable golangci linter forcetypeassert (#3168)
Split out from https://github.com/woodpecker-ci/woodpecker/pull/2960
2024-01-12 02:01:02 +01:00
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 00df53e941
Clean up logging (#3161)
- use `Err` method instead of format strings
- use `Msg` if no format string is used
2024-01-10 20:57:12 +01:00
6543 c64340cf8f
Use UUID instead of step name where possible (#3136)
things I found while looking at  #3109
2024-01-09 05:43:03 +01:00
qwerty287 ff1f51d6a9
Rename engine to backend (#2950)
rename based on https://woodpecker-ci.org/docs/usage/terminiology

---------

Co-authored-by: 6543 <6543@obermui.de>
2023-12-14 19:20:47 +01: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
6543 5a7b689e30
Switch to go vanity urls (#2706)
Co-authored-by: Anbraten <anton@ju60.de>
2023-11-07 08:04:33 +01:00
6543 7bc40f20cb
Option to change temp dir for local backend (#2702)
---
*Sponsored by Kithara Software GmbH*
2023-11-02 15:45:18 +01:00
6543 c75068920c
save GOOS and GOARCH in local engine (#2701)
make refactoring easyer
2023-11-02 07:58:32 +01:00
6543 ebe0307c6b
Let the backend engine report the current platform (#2688)
if you run woodpecker-agent on windows and connect it to an docker
daemon, there could be two different platforms possible, as you can
switch from linux to windows mode and visa versa


---
*Sponsored by Kithara Software GmbH*
2023-11-01 15:38:37 +01:00
6543 48e4eceb0a
local backend make cmd log output similar to other shells (#2678)
the cmd currently shows the full prompt and drop the exact error level.

this set the prompt to be hidden and let cmd exit with error level
reported by the command

---
*Sponsored by Kithara Software GmbH*
2023-11-01 11:49:36 +01:00
Anbraten 4198c447fb
Destroy steps after they are done (#2681)
Co-authored-by: 6543 <m.huber@kithara.com>
2023-11-01 09:35:11 +01:00
6543 5b3bba726d
local backend ignore errors in commands inbetween (#2636)
for normal posix shells we have to add the `-e ` option ... but as there
are more shells out there we have to handle this edgecases on base per
base case.

create a switch case statement in woodpecker should be fine as there is
only a finite number of shells, used in production.

also close  #2612

---
*Sponsored by Kithara Software GmbH*
2023-10-28 13:38:47 +02:00
qwerty287 e74115027b
Add some tests (#2652)
and some cleanups
2023-10-28 13:37:54 +02:00
qwerty287 efbde332a3
Fix CI_WORKSPACE in local backend (#2627)
closes https://github.com/woodpecker-ci/woodpecker/issues/2610
2023-10-23 12:54:10 +02:00
qwerty287 46273e54d8
Require Go 1.21 (#2553)
Main change are the new `maps` and `slices` stdlib packages so we can
replace `golang.org/x/exp`.
2023-10-09 09:11:08 +02:00
6543 8629a418f8
local backend set home variable windows-equivalent too (#2323) 2023-10-01 14:56:49 +02:00
6543 3954d85a5b
Add "plugin" support to local backend (#2239)
and a nit to improve the clone


---
*Sponsored by Kithara Software GmbH*
2023-08-22 22:00:32 +02:00
6543 0c282e86e8
fix regression and add trace in clone for local backend (#2241)
regression of #2017 
close  #2211
2023-08-18 14:26:04 +02:00
6543 d253f8cc30
Make sure we dont have hidden options for backend and pipeline compiler (#2123)
move options based on **os.Getenv** into flags

---------
*Sponsored by Kithara Software GmbH*
2023-08-07 21:13:26 +02:00
6543 10b1cfcd3b
Enhance local backend (#2017)
make local backend able to clone from private

---------
*Sponsored by Kithara Software GmbH*
Co-authored-by: Bruno BELANYI <bruno@belanyi.fr>
2023-08-07 15:39:58 +02:00
6543 3cd78c9409
Refactor agent (#2021)
- code cleanup
- init backend engine only once
- pass a taskUUID to the backend

---
*Sponsored by Kithara Software GmbH*
2023-07-20 20:39:20 +02:00
Ben Cordero 3158980d3e
Get workflow id from clone steps (#1839)
When in local mode, `getWorkflowIDFromStep` can handle normal steps with
a name like `wp_01h2a6qggwz68zekrkbwqq9rny_0_step_0`.

However, it will fail on clone (unless `skip_clone: true`) with an
`invalid step name` error.

```
invalid step name wp_01h2a2ebppp43bwjdfdsyj1m6m_0_clone
```

This patch handles either `_stage_` or `_clone` as the separator that
the local backend can use to extract the workflowID.
2023-06-08 03:33:23 +02:00
Anbraten 435f5ae207
Improve local backend (#1762)
Co-authored-by: 6543 <6543@obermui.de>
2023-05-17 14:53:23 +02:00
6543 80d5d233b3
Local Backend should create SubDirs (#1706)
close #1705
2023-04-20 00:56:03 +02:00
Bruno BELANYI ea95d5aa76
Set 'HOME' during local pipeline step (#1686)
close #1685

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
2023-04-02 16:47:22 +02:00
qwerty287 f582ad3159
Various enhancements in configuration (#1645)
- backends: move to cli flags instead of os.Getenv
- ssh: support 2fa with key and password
- allow to set grpc jwt secret (solves todo)
- allow to set default and max timeout (solves todo)

Closes https://github.com/woodpecker-ci/woodpecker/issues/896
Closes https://github.com/woodpecker-ci/woodpecker/issues/1131
2023-03-19 20:24:43 +01:00
Anbraten fa5b0fb96e
Fix linter (#1647) 2023-03-18 20:35:27 +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
Josh Soref 023d03dd61
Spelling (#1405)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-11-09 08:12:17 +01:00
6543 e8490a757f
GenerateScript should not return encoded script (#1397)
followup to #1395
2022-11-06 13:36:34 +01:00
qwerty287 e901f605b1
Fix local and ssh backends (#1395)
Base64-encoded string was not decoded.
2022-11-05 14:44:33 +02:00
6543 b15ca52a63
Move constrain to only have a single command in backend to run to dedicated backends (#1032)
at the moment we compile a script that we can pipe in as single command
this is because of the constrains the docker backend gives us.

so we move it into the docker backend and eventually get rid of it altogether
2022-10-31 00:26:49 +01:00
Harikesh00 36e42914fa
Renamed procs/jobs to steps in code (#1331)
Renamed `procs` to `steps` in code for the issue #1288

Co-authored-by: Harikesh Prajapati <harikesh.prajapati@druva.com>
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2022-10-28 17:38:53 +02:00
qwerty287 849e05bb8b
Rename build to pipeline in code (#1224)
Ref:  #745

Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: 6543 <6543@obermui.de>
2022-10-18 03:24:12 +02:00
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
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
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
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