1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00
Commit graph

45 commits

Author SHA1 Message Date
Ryan
20cdc7d0ff Fix regex for GITHUB_ENV parsing (#893)
* fix: correct env pattern regex

GitHub Actions allows for envvars to contain

Signed-off-by: hackercat <me@hackerc.at>

* format: format and typo fix

Signed-off-by: hackercat <me@hackerc.at>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-11-19 17:36:50 +00:00
ChristopherHX
862508658b Close docker client (#789)
* Close docker client!

* Fix nil dereference

* Update run_context.go

* Bump

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-10-24 16:50:43 +00:00
Ryan
bd8f62b024 fix: rewrite how image env is merged (#828)
* fix: rewrite how image env is merged

* test: add test for extractFromImageEnv
2021-09-27 19:01:14 +00:00
Ryan
26ae039f33 Add reading environment from Docker image (#771)
* fix: read envvars from image definition

* fix: add test

* fix: sort slices

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-09-26 16:37:53 +00:00
Marcin Falkowski
0e52836daf support for container option: --hostname (#809) 2021-09-10 05:03:40 +00:00
Ryan
789847e4f9 Add proper support for working-directory & fix command builder (#772)
* fix: align other Docker executors to print action

* fix: formatting

* fix: add proper workdir support

* fix: replace script filepath after slice creation

* fix: match substring so it works for pwsh

+ rename containerPath to scriptPath to reflect what value it contains
2021-08-10 19:40:20 +00:00
ChristopherHX
faaee889d5 Read localaction's from container (#719)
Fix localaction tests (missing checkout)

Co-authored-by: Ryan (hackercat) <me@hackerc.at>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-08-03 17:39:56 +00:00
Joseph Benden
160016b5fa Add support for container kernel capabilities (#716)
This patch adds two new command-line flags to specify one or
more kernel capabilities to add or remove from the workflow
containers.

The command-line flag `--container-cap-add` allows for adding
specific capabilities on the workflow containers; where as,

The command-line flag `--container-cap-drop` allows for removing
specific capabilities on the workflow containers.

This was developed to specifically be able to add `SYS_PTRACE`
to a workflow I maintain. It involves using this capability to
monitor a make build, to then build a compilation database.

Signed-off-by: Joseph Benden <joe@benden.us>
2021-06-04 16:06:59 +00:00
Björn Brauer
aa283f5cd3 fix: avoid race condition by not running exec/start twice (#702)
ContainerExecAttach implicitly runs ContainerExecStart while attaching
to stdout/stderr.
Ref: e02bc91dcb/client/container_exec.go (L40)

Calling both can lead to a race condition as observed in #627

Fixes: #627

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
2021-05-25 12:35:52 +00:00
Ryan (hackercat)
3f9e6abd6c Move actions path outside of workdir (#701)
* feat: add option to specify user for exec

* fix: move actions to static path outside workdir

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-05-24 17:09:03 +00:00
Josh Soref
b77b9c3714 Fix: GITHUB_PATH should prepend (#690)
* GITHUB_PATH is prepend

https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path

* Check for replacing system binaries

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-05-18 13:22:39 +00:00
Torbjørn Vatn
707067856b $GITHUB_PATH support (#566)
* Regression in the .golangci.yml file

* This looks like an even better fix to #451

The previous solution only prevented the `starting container process caused "exec: \"bash\"`
error when someone added an "extra" path in the workflow using `::add-path`

* Add support for >> $GITHUB_PATH

* The newRunCommand has too high cyclomatic complexity

* Add "linux/arm64" to new test

* The cyclop linter was complaining so I extracted some funcs

* Close some readers

* Fix typo

* fix: add missing composite function

* Fix regress from merging

* Keep the error messages as is

* consolidate with master

* Close the tar reader on defer

* New way to get ContainerWorkdir

* Remove arch from runner test

* Separate the UpdateFromEnv and UpdateFromPath

Co-authored-by: hackercat <me@hackerc.at>
2021-05-06 13:30:12 +00:00
Ryan (hackercat)
dd198c2dd3 Fix environment variables and move envs.txt/event.json to fixed location (#667)
* fix: environment variables sourcing from `/etc/environment`

* fix: move `envs.txt` & `event.json` to `/tmp/`

Since #635 `envs.txt` is not copying properly when running `act` in WSL2
Moving it to fixed location resolves that.
2021-05-05 23:11:43 +00:00
Markus Wolf
16c81e63ff Add custom docker registry authentication (#665)
* Add custom docker registry authentication

Uses DOCKER_USERNAME and DOCKER_PASSWORD as secrets provided into
the act cli.

Closes #527

Co-authored-by: Björn Brauer <zaubernerd@zaubernerd.de>

* Add test to check if pull authentication is filled in

* Update debug message to be more descriptive

Co-authored-by: Ryan (hackercat) <me@hackerc.at>

Co-authored-by: Björn Brauer <zaubernerd@zaubernerd.de>
Co-authored-by: Ryan (hackercat) <me@hackerc.at>
2021-05-05 09:37:17 -07:00
Ryan (hackercat)
69b692b962 Add super-linter + fix lint issues (#650)
* feat: bump `golangci-lint`, add `super-linter`, replace outdated linter

Bump `golangci-lint` version.
Add `super-linter` to lint other languages.
Go linter is disabled because it's currently broken:
https://github.com/github/super-linter/pull/370
Replacing `scopelint` with `exportloopref`: "[runner] The linter
'scopelint' is deprecated (since v1.39.0) due to: The repository of the
linter has been deprecated by the owner.  Replaced by exportloopref."
Fixed formatting in `.golangci.yml`
Add addtional linters:
  `misspell`: purely style, detects typos in comments
  `whitespace`: detects leading and trailing whitespace
  `goimports`: it's gofmt + checks unused imports

* fix: lint/fix `go` files

* fix: lint with `standardjs`

* fix: lint/fix with `markdownlint`, make template more verbose

* feat: add lint stuff to makefile

* fix: `UseGitIgnore` formatting

* fix: lint/fix `README.md`

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-05-03 09:52:03 -07:00
Ryan (hackercat)
cf202bedb5 Add option to allow files/directories in .gitignore to be copied to container (#537)
* disable gitignore for actions

* feat: Add option to allow/disallow paths specified in .gitignore

Co-authored-by: Alan Birtles <alan.birtles@eu.sony.com>
2021-05-03 07:37:20 -07:00
Ryan (hackercat)
2f37fc728b fix: reworked container architecture (#619)
- Don't set architecture, let Docker host decide it's own platform,
  remove `runtime` dependency and don't show default in `--help`
- Remove most tests, we need to check only once if it works on
  different platform
- Rename `DeleteImage` to `RemoveImage` to conform to existing
  function in `docker` cli, added options to specify `force` and
  `pruneChildren`
2021-05-02 08:15:13 -07:00
Jay Pipes
6d023b011e use container image platform only on docker 1.41+ (#591)
Commit fef399d057 introduced support for
specifying a container image platform for cross-platform image building.

Unfortunately, attempting to execute a docker command that includes the
`--platform` flag against Docker daemons using API Version 1.40 and
before results in the following error:

```
"specify container image platform" requires API version 1.41, but the Docker daemon API version is 1.40
```

To allow `act` to be used on the 19.03 Docker CE and earlier versions,
this patch simply checks the Docker daemon API version and only
specifies platform specification when the daemon API version is 1.41 or
greater.

Fixes Issue #586
2021-03-30 10:10:42 -07:00
hackercat
391acea9e2 Add option to run custom architecture (container platform) (#525)
* Add QEMU to run different architectures

* Update dependencies in `go.mod`

* Add `--container-architecture` flag to specify custom image architecture

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-03-28 21:08:40 -07:00
Hibariya
fa4c3c59cb Add --userns flag to support Docker daemon that enables user namespace (#533)
I got an error like this after hitting `act` command.

> Error: Error response from daemon: cannot share the host's network namespace when user namespaces are enabled

According to the document, when user namespaces are enabled on the Docker daemon,
neither host network mode and --privileged work without --userns=host. Since `act`
uses host network mode to match GitHub Actions runners, it cannot run jobs when
user namespaces are enabled. So I added the flag.

https://docs.docker.com/engine/security/userns-remap/#user-namespace-known-limitations

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-02-27 08:31:25 -08:00
KADOTA, Kyohei
035108c9f1 Format sources with gofmt (#472)
Co-authored-by: Casey Lee <cplee@nektos.com>
2021-01-14 21:37:38 -08:00
Cat™
9cb63f0bd6 Fix slashes when running on Windows (#461) 2021-01-11 22:41:35 -08:00
Torbjørn Vatn
b60851b818 GitHub env file support (#426)
* Upgrade to the official golangci-lint action and fix some issues it found

* Update deps

* Remove a shadow warning

* Initialize the splitPattern only once

* Initial attempt at supporting $GITHUB_ENV

Needs some polishing and tests

* Now it's actually working

* Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term

* Disable the issue-228 test again

* The linter is picky

* Discovered that the workflow/envs.txt had to exist in certain cases

* Fix small linter issue
2021-01-11 22:39:43 -08:00
Lyle Underwood
d36a3f80c7 Remove confusing message about symlinks (#381) 2020-10-06 10:02:37 -07:00
Bar Weiss
4e7bcf23b6 Fix copyDir to normalize file paths in tar archive (#360) 2020-09-15 07:00:15 -07:00
whywaita
4d237924ac add flag of privileged mode 2020-08-02 05:21:49 +09:00
Josh Soref
72c3bf2220 Spelling (#240)
* spelling: cartesian

* spelling: deferring

* spelling: marshal
2020-05-18 09:53:42 -07:00
Sven Dowideit
dea1ed5769 extract the docker NewClientWithOpts, and add connectionhelper for DOCKER_HOST set to ssh://remote (#207)
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-05-03 21:15:42 -07:00
Casey Lee
8611e2a3d2 fix: ignore symlink errors 2020-04-22 23:48:25 -07:00
Casey Lee
9253d2102c fix: #182 - support symlinks in workspace 2020-04-22 23:24:31 -07:00
Máximo Cuadros
5e7ec329bd *: update go-git import (#194) 2020-04-16 16:24:30 -07:00
Aidan Steele
249ebdb066 Improved gitignore handling (#163) 2020-03-18 06:55:39 -07:00
Casey Lee
41dabfd633 add file info to files cp into container 2020-03-13 23:21:25 -07:00
Casey Lee
96f6ad0f43 fix #50 - exclude anything in .gitignore from being copied into the job volume 2020-03-09 18:32:48 -07:00
Casey Lee
e60c46b79f fix #122 - support actions/checkout for repos other the one for this workflow (#143) 2020-03-09 17:45:42 -07:00
Casey Lee
caba9f7645 fix #141 - use host network to match GitHub Actions runners (#142) 2020-03-09 17:43:24 -07:00
Casey Lee
fbecf70cc2 remove super verbose log statement 2020-02-24 17:58:34 -08:00
Casey Lee
199c125522 run with copy of workingdir 2020-02-24 17:48:21 -08:00
Casey Lee
6df3e39a46 move action cache to volume 2020-02-24 16:38:49 -08:00
Casey Lee
0f6340f811 cache dir for remote actions 2020-02-23 22:34:48 -08:00
Casey Lee
e5680477f9 local actions done 2020-02-23 16:36:44 -08:00
Casey Lee
12ac7300b9 shared container for job 2020-02-23 15:01:25 -08:00
Casey Lee
c44aa2a118 cleanup logging
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:40 -05:00
Casey Lee
33f8290eb3 successfully able to run simple workflows
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:25 -05:00
Casey Lee
fbab49c68d initial load of yaml working 2020-02-04 16:38:41 -08:00
Renamed from container/docker_run.go (Browse further)