Commit graph

449 commits

Author SHA1 Message Date
M.Yamashita
35d6e9f71e
Remove the comment-out code. (#1691)
Co-authored-by: Jason Song <i@wolfogre.com>
2023-04-19 03:46:00 +00:00
ChristopherHX
9884da0122
fix: environment handling windows (host mode) (#1732)
* fix: environment handling windows (host mode)

* fixup

* fixup

* add more tests

* fixup

* fix setenv

* fixes

* [skip ci] Apply suggestions from code review

Co-authored-by: Jason Song <i@wolfogre.com>

* Update side effects

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-04-18 18:09:57 +00:00
Björn Brauer
de0644499a
fix: ensure networkmode "host" unless explicitly specified (#1739)
act defaults network mode to "host", but when `--container-options` are
passed on the CLI, it uses the docker CLI options parser, which fills
empty values with defaults, in which case network mode is set to
"default".
Unless the user explicitly sets `--container-options="--network=xxx"`,
we should always default to "host", to keep act's behaviour.

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-04-18 14:37:59 +00:00
Jason Song
816a7d410a
Avoid using log.Fatal in pkg/* (#1705)
* fix: common

* fix: in runner

* fix: decodeNode

* fix: GetMatrixes

* Revert "fix: common"

This reverts commit 6599803b6ae3b7adc168ef41b4afd4d89fc22f34.

* fix: GetOutboundIP

* test: fix cases

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-04-18 14:17:36 +00:00
ChristopherHX
97749a27b9
fix: ghc assignment typo (#1729)
* fix: ghc assignment typo

* fixup server_url
2023-04-13 14:09:29 +00:00
ChristopherHX
d70b225e85
fix: reusable workflow panic (#1728)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-04-13 13:47:59 +00:00
Markus Wolf
c0130ed030
fix: add server_url attribute to github context (#1727)
* fix: add `server_url` attribute to github context

The `server_urL` attribute was missing in the `github` context.
Previously it was exposed as environment variable only.

Closes #1726

* fix: also set `api_url` and `graphql_url` attributes
2023-04-13 13:09:28 +00:00
Jason Song
8518d70bdf
feat: improve GetOutboundIP (#1707)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-03-31 13:28:08 +00:00
Jason Song
d3dfde055a
fix: use os.UserHomeDir (#1706)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-03-31 13:08:46 +00:00
Kris
75ffa205c4
Make sure working directory is respected when configured from matrix (#1686)
* Make sure working directory is respected when configured from matrix

* Fix regression by setting Workingdirectory on stepRun instead of step or too early
2023-03-28 12:24:03 +00:00
Shubh Bapna
636c8a34ae
feat: specify matrix on command line (#1675)
* added matrix option

* select the correct subset of matrix configuration after producing all the matrix configuration

* add tests

* update readme

* lint fix

* remove matrix from readme

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-03-19 17:25:55 +00:00
Shubham Agrawal
09de42f067
Support for docker steps in host environment (#1674)
* Support for docker steps in host environment

* removed workdir changes
2023-03-14 14:07:31 +00:00
Markus Wolf
6744e68ee2
fix: correct ref and ref_name (#1672)
* fix: correct ref and ref_name

The ref in the GitHub context is always full qualified
(e.g. refs/heads/branch, refs/tags/v1).
The ref_name is the ref with the strippep prefix.
In case of pull_requests, this is the merge commit ref
(e.g. refs/pull/123/merge -> 123/merge).

* test: update test data
2023-03-09 20:03:13 +00:00
Jason Song
ac5dd8feb8
fix: return err in walk (#1667)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-03-08 15:13:11 +00:00
ChristopherHX
24440d9f15
test: Enshure ForcePull config doesn't break docker actions (1661) 2023-03-08 14:57:49 +00:00
ChristopherHX
f3c88b5091
fix: crash if the id tool fails to run in the container (1660) 2023-03-08 14:41:25 +00:00
Jason Song
19abab6375
fix: safe file name (#1651)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-03-03 08:38:33 +00:00
Alex Savchuk
973dd7f7ef
fix: compare properties of Invalid types (#1645)
* fix: compare properties of Invalid types

 fix: compare properties of Invalid types #1643

* fix linter problem

* Fix review comment
2023-03-03 08:16:33 +00:00
Alex Savchuk
5500c928eb
fix: github.job property is empty, GITHUB_JOB should be job id (#1646)
* fix: github.job property is empty, GITHUB_JOB should be job id

fix: github.job property is empty #1621
fix: GITHUB_JOB should be the id not the name #1473

* fix linter problem.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-27 19:10:31 +00:00
Markus Wolf
89cb558558
fix: update output handling for reusable workflows (#1521)
* fix: map job output for reusable workflows

This fixes the job outputs for reusable workflows. There is
a required indirection. Before this we took the outputs from
all jobs which is not what users express with the workflow
outputs.

* fix: remove double evaluation

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-23 22:34:47 +00:00
ChristopherHX
53095d76f4
fix: crash malformed composite action (#1616)
* fix: crash malformed composite action

* Add remote composite action test

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-23 22:16:07 +00:00
ChristopherHX
05eaeaa528
feat: workflowpattern package (#1618)
* feat: workflowpattern package

* nolint:gocyclo

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-23 18:21:08 +00:00
R
8790c9b8e6
fix: add GITHUB_STEP_SUMMARY (#1607) 2023-02-23 15:24:44 +00:00
Josh Soref
be4a1477a5
fix: tolerate workflow that needs a missing job (#1595) (#1619)
Change planner functions to return errors

This enables createStages to return `unable to build dependency graph`

Fix PlanEvent to properly report errors relating to events/workflows
2023-02-16 16:41:59 +00:00
ChristopherHX
21ea3d0d5f
chore: Remove obsolete Container.UpdateFromPath (#1631)
* chore: Remove obsolete Container.UpdateFromPath

* remove unused import
2023-02-16 16:11:26 +00:00
Jason Song
1316307313
chore: use new style octal (#1630)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-16 15:34:51 +00:00
Jason Song
b0a5068f6d
fix: don't override env (#1629) 2023-02-16 15:16:46 +00:00
Aidan
44333c758a
Pass dockerfile to build executor (#1606)
This allows testing actions with non standard dockerfile names

Signed-off-by: Aidan Jensen <aidan@artificial.com>
2023-02-08 17:14:43 +00:00
dependabot[bot]
36dbbc1dfa
build(deps): bump github.com/docker/cli from 23.0.0-rc.1+incompatible to 23.0.0+incompatible (#1611)
* build(deps): bump github.com/docker/cli

Bumps [github.com/docker/cli](https://github.com/docker/cli) from 23.0.0-rc.1+incompatible to 23.0.0+incompatible.
- [Release notes](https://github.com/docker/cli/releases)
- [Commits](https://github.com/docker/cli/compare/v23.0.0-rc.1...v23.0.0)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* update-test

* update test

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2023-02-06 12:33:42 +00:00
ChristopherHX
e775fea265
refactor: GITHUB_ENV command / remove env.PATH (#1503)
* fix: GITHUB_ENV / PATH handling

* apply workaround

* add ctx to ApplyExtraPath

* fix: Do not leak step env in composite

See https://github.com/nektos/act/pull/1585 for a test

* add more tests

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-04 13:35:13 +00:00
Aidan
24c16fbf25
Update max container name length (#1597)
* Update max container name length

Signed-off-by: Aidan Jensen <aidan@artificial.com>

* Use hashed name instead to prevent conflicts

Signed-off-by: Aidan Jensen <aidan@artificial.com>

---------

Signed-off-by: Aidan Jensen <aidan@artificial.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-03 19:54:19 +00:00
Shubh Bapna
ce168f9595
feat: allow overriding of GITHUB_ env variables (#1582)
* allow overriding of GITHUB_ env variables

* bug fix for overriding env vars with empty string

* revert step.go

* refactor github_context to prevent lint failures. added more setters

* added ability to override github env variables

* handled base and head ref
2023-02-03 19:35:49 +00:00
Aidan
c4b64ec1c1
Docker build fixes (#1596)
- Join relative path and split dockerfile off to get context

Signed-off-by: Aidan Jensen <aidan@artificial.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-02-03 09:07:16 +00:00
ChristopherHX
f91b2aa5db
fix: Apply forcePull only for prebuild docker actions (#1599) 2023-02-02 17:24:35 +00:00
ChristopherHX
3748772201
test: Do not leak step env in composite (#1585)
* test: Do not leak step env in composite

To prevent merging regressions.

* Update runner_test.go
2023-01-29 14:47:56 +00:00
Markus Wolf
82a8c1e80d
feat: add remote reusable workflows (#1525)
* feat: add remote reusable workflows

This changes adds cloning of a remote repository to
run a workflow included in it.

Closes #826

* fix: defer plan creation until clone is done

We need wait for the full clone (and only clone once)
before we start to plan the execution for a remote workflow

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-01-19 20:49:11 +00:00
Alexandre Lavigne
7ebcc1c816
Feature/allow worktrees (#1530)
* Use go-git to find remote URL

* Use go-git package to resolve HEAD revision (commit sha1)

* Use go-git to find checked-out reference

* Remove unused functions
2023-01-19 06:29:23 +00:00
Casey Lee
63ae215071
fix: update artifact server to address GHSL-2023-004 (#1565) 2023-01-16 21:01:54 +00:00
dependabot[bot]
d8ba8cbf17
build(deps): bump github.com/moby/buildkit from 0.10.6 to 0.11.0 (#1563)
* build(deps): bump github.com/moby/buildkit from 0.10.6 to 0.11.0

Bumps [github.com/moby/buildkit](https://github.com/moby/buildkit) from 0.10.6 to 0.11.0.
- [Release notes](https://github.com/moby/buildkit/releases)
- [Commits](https://github.com/moby/buildkit/compare/v0.10.6...v0.11.0)

---
updated-dependencies:
- dependency-name: github.com/moby/buildkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: use new patternmatcher.Matches

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Casey Lee <caseypl@amazon.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-01-16 17:26:22 +00:00
Robin Breathe
d064863f9b
fix: allow override of artifact server bind address (#1560)
* Prior to this change, the artifact server always binds to the detected
  "outbound IP", breaks functionality when that IP is unroutable.
  For example, Zscaler assigns the host a local CGNAT address,
  100.64.0.1, which is unreachable from Docker Desktop.
* Add the `--artifact-server-addr` flag to allow override of the address
  to which the artifact server binds, defaulting to the existing
  behaviour.

Fixes: #1559
2023-01-16 14:12:20 +00:00
Shubh Bapna
767e6a8696
Input (#1524)
* added input flags

* added input as part of the action event and added test cases

* updated readme

Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2023-01-13 19:28:17 +00:00
ChristopherHX
b2fb9e64ac
refactor: remove docker image list reference filter (#1501)
* refactor: remove docker reference filter

* make it work

* solve logic failure

* Another mistake

* another one

* revert signature of ImageExistsLocally

It is better to keep two return values
2023-01-13 17:52:54 +00:00
ChristopherHX
8b4f210872
fix: add-matcher fails github workflow (#1532)
* fix: add-matcher fails github workflow

* make linter happy
2023-01-13 17:01:40 +00:00
Björn Brauer
3f3b25ae84
feat: add support for building docker actions with private registries (#1557)
This commit adds a new `LoadDockerAuthConfigs` function, which loads all
registry auths that are configured on the host and sends them with the build
command to the docker daemon.

This is needed in case act builds a docker action and the images referenced in
that docker action are located on private registries or otherwise require
authentication (e.g. to get a higher rate limit).

The code is adapted from how the docker cli works:
257ff41304/cli/command/image/build.go (L323-L332)

Co-authored-by: Markus Wolf <mail@markus-wolf.de>

Co-authored-by: Markus Wolf <mail@markus-wolf.de>
2023-01-12 21:29:30 +00:00
ChristopherHX
7e8d070811
feat: Allow building without docker support (#1507)
* feat: Allow building without docker support

* fix macos build tag

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-01-10 22:08:57 +00:00
ChristopherHX
a53a1c2000
fix: extra path lost in composite actions (#1531)
* test: define test case of path issues

Test case for #1528

* test: add multi arch grep

* fix: Always use current ExtraPath

* replace setup-node with run step

* Update push.yml

* yaml mistake

Co-authored-by: Markus Wolf <mail@markus-wolf.de>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-01-10 21:55:05 +00:00
Markus Wolf
3f4a6dc462
test: make sure workflow_call is not a github event calling our workflow (#1520)
Since reusable workflows are defining inputs and ouputs using the
on.workflow_call syntax, this could also be triggered by a workflow_call
event. That event does not exist within GitHub and we should make
sure our worklow is not called by that kind of 'synthetic' event.

See 74da5b085c (r1042413431)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-01-10 21:43:12 +00:00
Markus Wolf
b14398eff3
fix: preserve job result state in case of failure (#1519)
* fix: preserve job result state in case of failure

There is just one job field for the job result. This is also true for
matrix jobs. We need to preserve the failure state of a job to
have the whole job failing in case of one permuation of the matrix failed.

Closes #1518

* test: remove continue-on-error on job level

This feature is not yet supported by act and if implemented
would make this test invalid

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-01-10 21:31:12 +00:00
ChristopherHX
6ab71ecebb
fix: align runner.os / runner.arch to known values (#1510)
* fix: align runner.os / runner.arch to known values

* .

* .

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-19 14:58:55 +00:00
Aaron Holmes
bef9b5c3c7
feat: Support "result" on "needs" context. (#1497)
* Support "result" on "needs" context.

This change adds "result" to a job's "needs" context, as documented [here](https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context). `act` currently tracks the success/failure/cancelled status of a job, but does not include this value the `needs` context.

Fixes #1367

* Change `Needs` to use a new struct rather than the open type `interface{}`.

Related #1497
Fixes #1367

* Add integration test to "needs" context change.

Relates: #1497

* feat: allow to spawn and run a local reusable workflow (#1423)

* feat: allow to spawn and run a local reusable workflow

This change contains the ability to parse/plan/run a local
reusable workflow.
There are still numerous things missing:

- inputs
- secrets
- outputs

* feat: add workflow_call inputs

* test: improve inputs test

* feat: add input defaults

* feat: allow expressions in inputs

* feat: use context specific expression evaluator

* refactor: prepare for better re-usability

* feat: add secrets for reusable workflows

* test: use secrets during test run

* feat: handle reusable workflow outputs

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* refactor: fix savestate in pre steps (#1466)

* refactor: fix savestate in pre steps

* fix pre steps collision

* fix tests

* remove

* enable tests

* Update pkg/runner/action.go

* Rename InterActionState to IntraActionState

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* fix: tail (not absolute) as entrypoint of job container (#1506)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Fix conflict in merge.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-19 08:37:53 +00:00
ChristopherHX
0c8c082ac0
fix: tail (not absolute) as entrypoint of job container (#1506)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-15 17:31:59 +00:00
ChristopherHX
b8d7e947cf
refactor: fix savestate in pre steps (#1466)
* refactor: fix savestate in pre steps

* fix pre steps collision

* fix tests

* remove

* enable tests

* Update pkg/runner/action.go

* Rename InterActionState to IntraActionState

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-15 17:08:31 +00:00
Markus Wolf
a8e05cded6
feat: allow to spawn and run a local reusable workflow (#1423)
* feat: allow to spawn and run a local reusable workflow

This change contains the ability to parse/plan/run a local
reusable workflow.
There are still numerous things missing:

- inputs
- secrets
- outputs

* feat: add workflow_call inputs

* test: improve inputs test

* feat: add input defaults

* feat: allow expressions in inputs

* feat: use context specific expression evaluator

* refactor: prepare for better re-usability

* feat: add secrets for reusable workflows

* test: use secrets during test run

* feat: handle reusable workflow outputs

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-15 16:45:22 +00:00
ChristopherHX
d281230cce
refactor: fix add-path / GITHUB_PATH commands (#1472)
* fix: add-path / GITHUB_PATH commands

* Disable old code

* fix: missing mock

* Update tests

* fix tests

* UpdateExtraPath skip on dryrun

* patch test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-09 11:16:15 +00:00
ChristopherHX
7d9951200f
feat: JobLoggerFactory (#1496)
Remove overriding io.Stdout in TestMaskValues to prevent deadlock in GitHub Actions
2022-12-09 10:25:32 +00:00
Markus Wolf
0f8861b9e3
fix: handle env-vars case sensitive (#1493)
Closes #1488
2022-12-07 15:31:33 +00:00
ChristopherHX
8c5748a55c
fix: step env is unavailable in with property expr (#1458)
* fix: step env is unavailable in with property expr

* don't run the test on windows

* fix: composite action add missing shell

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-06 16:46:20 +00:00
ChristopherHX
57bf4d27a2
refactor: share UpdateFromEnv logic (#1457)
* refactor: share UpdateFromEnv logic

* Add test for GITHUB_OUTPUT

Co-authored-by: Ben Randall <veleek@gmail.com>

* Add GITHUB_STATE test

* Add test for the old broken parser

Co-authored-by: Ben Randall <veleek@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-06 16:19:27 +00:00
ChristopherHX
4c2524ab4d
feat: --container-options (#1462)
* feat: `--container-options`

This deprecates the following options
- `--privileged`
- `--container-cap-add`
- `--container-cap-drop`
- `--container-architecture`
- `--userns`

* Merge binds/mounts, add desc

* avoid linter error

* fix: apply options to step env / deprecate warning

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-06 15:58:47 +00:00
ChristopherHX
d9fe63ec24
refactor: move autoremove into the jobexecutor (#1463)
* refactor: move autoremove into the jobexecutor

breaking: docker container are removed after job exit

* reduce complexity

* remove linter exception

* reduce cyclic complexity

* fix: always allow 1 min for stopping and removing the runner, even if we were cancelled

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-06 15:45:06 +00:00
Brice Dutheil
1797775be3
Pass LANG=C.UTF-8 to environment (#1476)
* fix: pass LANG=C.UTF-8 to environment

Fixes: #1308

* fix: pass LANG=C.UTF-8 to environment in container only

Fixes: #1308
Signed-off-by: Brice Dutheil <brice.dutheil@gmail.com>

Signed-off-by: Brice Dutheil <brice.dutheil@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-12-06 10:36:39 +00:00
Lim Chun Leng
87327286d5
Fix shellcommand error on sh shell (#1464)
Co-authored-by: Lim Chun Leng <limchunleng@gmail.com>
2022-11-25 10:38:49 +00:00
Randolph Chung
5200c49155
fix: handle subdirectors and exclusions (#1012) (#1446) 2022-11-21 14:47:38 +00:00
Magnus Markling
a108f10ccc
Remove dead code (#1425)
Co-authored-by: Casey Lee <cplee@nektos.com>
2022-11-16 22:12:00 +00:00
Markus Wolf
809da7198c
feat: interpolate the step names (#1422)
* feat: interpolate the step names

Step names could contain expressions refering to event data.

Fixes #1353

* test: add missing mock data

* fix: setup composite expression evaluator

The RunContext does contain a cached ExpressionEvaluator.
This should be the case the composite RunContext as well.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Casey Lee <cplee@nektos.com>
2022-11-16 21:55:23 +00:00
ChristopherHX
e520382d2f
feat: GITHUB_STATE and GITHUB_OUTPUT file commands (#1391)
* feat: set-state and set-output file commands

* increase test timeout from 10m to 15m

* Prepare for HostExecutor PR

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-11-16 21:42:57 +00:00
ChristopherHX
f2b98ed301
feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00
Markus Wolf
2614b3eb0c
fix: keep path to event json file in composite actions (#1428)
* fix: keep path to event json file in composite actions

The event.json paths need to be copied over, since it the
GithubContext is recreated from the composite RC. And that
does read some value for the event file if available.

* test: add test case

* test: paste the test correctly and revert a line

Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-11-16 17:00:49 +00:00
ChristopherHX
d97481d567
fix: nil pointer access ( workflow_dispatch ) 2022-11-10 20:16:00 +00:00
Markus Wolf
9b95a728d8
feat: parse types of reusable workflows (#1414)
This change does parse the different types of workflow jobs.
It is not much by itself but the start to implement reusable
workflows.

Relates to #826

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-11-01 15:58:07 +00:00
Eng Zer Jun
2f1c5a19f1
refactor: move from io/ioutil to io and os packages (#1417)
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-10-29 17:15:38 +00:00
Zack Wang
bc17371017
Fixes #1387 (#1388) 2022-10-18 22:27:28 +00:00
Markus Wolf
1e0ef8ce69
Mapping workflow_dispatch inputs into the Expression inputs context (#1363)
* test: check workflow_dispatch inputs

This implements a test to check for `workflow_dispatch` inputs.
This will be a prerequisite for implementing the inputs.

* feat: map workflow_dispatch input to expression evaluator

This changes adds the workflow_dispatch event inputs
to the `inputs` context and maintaining the boolean type

* fix: coerce boolean input types

* fix: use step env if available, rc env otherwise
2022-10-17 16:25:26 +00:00
ChristopherHX
5d2eb1f238
fix: ci is failing since 2022-10-17 (#1397)
* Update push.yml

* Update main.yaml

* Update action.yml
2022-10-17 16:03:17 +00:00
Markus Wolf
ff5e289804
test: add test for networking setup in act (#1375)
* test: add test for networking setup in act

This test makes sure that the hostname inside of act is resolvable.

* fix: only merge existing container options

When merging parsed container options without options being
set in a job, the default docker options are returned and
will override the expected defaults by act (e.g. network mode).

This is a first attempt to mitigate this behavior and only
merge settings if something was requested on a job.

* refactor: split config merging into own function

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-10-12 16:30:56 +00:00
Markus Wolf
f0b1845802
fix: re-evaluate env for remote composite actions (#1385)
The env for remote composite actions need to be re-evaluated
at every stage (pre, main, post) as it is created during the
pre stage but there might be changes used as input to this
actions main stage (e.g. outputs for another action).

This is not required for local actions as their env is created
for the main stage (there is no pre stage).
Post stages do not need an updated env since they cannot recieve
inputs from other actions.
2022-10-12 16:19:32 +00:00
Markus Wolf
36310139e0
fix: interpolate action input defaults (#1376)
This fixes the regression to interpolate input defaults which contain
expressions.
2022-10-07 14:51:27 +00:00
Alex Savchuk
48188a6280
fix: support docker create arguments from container.options (#1022) (#1351)
* fix: support docker create arguments from container.options (#1022)

* fix processing of errors, add verbose logging, fix test

* disable linter for code copied from docker/cli

* fix all linter issues

* Add license info

* Add opts_test.go from docker/cli and required testdata

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-10-06 22:09:43 +00:00
Markus Wolf
679cac1677
Fix composite input handling (#1345)
* test: add test case for #1319

* fix: setup of composite inputs

This change fixes the composite action setup handling of inputs.

All inputs are taken from the env now. The env is composed of
the 'level above'.
For example:
- step env -> taken from run context
- action env -> taken from step env
- composite env -> taken from action env

Before this change the env setup for steps, actions and composite
run contexts was harder to understand as all parts looked into
one of these: parent run context, step, action, composite run context.

Now the 'data flow' is from higher levels to lower levels which should
make it more clean.

Fixes #1319

* test: add simple remote composite action test

Since we don't have a remote composite test at all
before this, we need at least the simplest case.
This does not check every feature, but ensures basic
availability of remote composite actions.

* refactor: move ActionRef and ActionRepository

Moving ActionRef and ActionRepository from RunContext into the
step, allows us to remove the - more or less - ugly copy operations
from the RunContext.

This is more clean, as each step does hold the data required anyway
and the RunContext shouldn't know about the action details.

* refactor: remove unused properties
2022-10-06 21:58:16 +00:00
Markus Wolf
1bade27534
fix: handle go closure iteration (#1374)
Copy the matrix to make it closure aware
2022-10-05 22:13:00 +00:00
Alex Savchuk
21484b5c1e
fix: show workflow info even if on.push is not defined (#1329) (#1335)
* fix: show workflow info even if on.push is not defined (#1329)

To fix listing of workflows in such cases list/graph filtering was split with planning.

Now act supports one of the following list (-l)/graph (-g) cases:
* show all jobs of loaded workflows: act -l
* show specific job JOBNAME: act -l -j JOBNAME
* show jobs of loaded workflows in which event EVENTNAME is set up: act -l EVENTNAME
* show jobs of loaded workflows in which first defined workflow event is set up: act -l --detect-event

For planning it supports:
* running specific job JOBNAME with triggered event determined from:
** CLI argument: act -j JOBNAME EVENTNAME
** first defined in loaded workflows event: act -j  JOBNAME --detect-event
** only defined in loaded workflows event: act -j JOBNAME
** push event by default: act -j JOBNAME

*  running jobs of loaded workflows in which event is set up, event is determined from:
** CLI argument: act EVENTNAME
** first defined in loaded workflows event: act --detect-event
** only defined in loaded workflows event: act
** push event by default: act

Except #1329 this PR fixes #1332, #1318

* Update docs/help
2022-09-29 05:59:52 +00:00
Markus Wolf
13d530302e
fix: restore the job logger setup after job cancelation (#1365)
To be able to tag all log-lines with appropriate fields
after a workflow run is canceled, we need to restore
the JobLogger in the cancelation context.
2022-09-27 19:13:32 +00:00
Björn Brauer
00acf68188
feat: pass current matrix information to job logger (#1364)
For log processing of the JSON logs, we want to be able to know which
keys/values of the matrices were used.
This commit adds the current matrix map to the job logger.

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

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
2022-09-27 15:49:22 +00:00
Markus Wolf
97c083e902
fix: align github.ref to GitHub Action (#1362)
* fix: align github.ref to GitHub Action

The `github.ref` value should be `refs/heads/branch` in most cases.
There are a few exceptions handled by the code.

This change prefixes the default case with `refs/heads` and adds
tests for this and the excpetional cases.

* fix: correct existing assertions
2022-09-26 22:49:19 +00:00
ChristopherHX
7d0407fa4a
fix: crash on invalid docker credentials (#1348)
* fix: crash on invalid docker credentials

* add test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-09-26 06:17:06 +00:00
ChristopherHX
6037182487
fix: missing defaults in nodejs pre (#1349)
* Update action.go

* add Test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-09-26 06:08:08 +00:00
Alex Savchuk
d1daf2f28d
fix: support expression for step's continue-on-error field (#900) (#1331)
Co-authored-by: Markus Wolf <KnisterPeter@users.noreply.github.com>
2022-09-08 14:20:39 +00:00
Alex Savchuk
b514649c3d
fix: show workflow name when get error on yml parsing (#1133) (#1328)
Additionally close workflow file when a job name is invalid
2022-09-06 20:41:43 +00:00
Fabian Kammel
e1b906813e
support runner.arch (#1290)
* support runner.arch

Signed-off-by: Fabian Kammel <fk@edgeless.systems>

* add arch to runner definition

Signed-off-by: Fabian Kammel <fk@edgeless.systems>

* get architecture from docker

Signed-off-by: Fabian Kammel <fk@edgeless.systems>

* Update pkg/container/docker_run.go

Co-authored-by: ChristopherHX <christopher.homberger@web.de>

* lint: goimport file

Signed-off-by: Fabian Kammel <fk@edgeless.systems>
Co-authored-by: Casey Lee <caseypl@amazon.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-08-29 15:39:31 +00:00
Markus Wolf
92ddcdae09
refactor: ignore already closed error (#1285)
* refactor: ignore already closed error

This hides the `file already cloesd` error as it is
distracting in the output and does not provide any value.

* refactor: use go errors

Co-authored-by: Casey Lee <caseypl@amazon.com>
2022-08-07 06:07:54 +00:00
Markus Wolf
3364f95569
fix: ensure all post steps are executed (#1286)
This fixes an issue in the chain of post steps introduced
while updating the step-logger for composite actions.

It includes a test case so we make sure this does not happen
again.
2022-07-29 19:43:24 +00:00
Ermal Kaleci
9d76bac4ef
walk submodule path instead of dir name (#1282)
* walk submodule path instead of dir name

* use file path instead of relative path

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-28 14:16:30 +00:00
Robert Kowalski
5f5b8959d6
fix: add parent step id in composite action step id (#1268)
when running nested composite actions, step ids were repeating
leading to errors in parsing the output. this patch adds the
parent step id to ste stepID field.

Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-authored-by: Markus Wolf <markus.wolf@new-work.se>

Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-27 19:56:41 +00:00
Grigory Entin
ddee19b946
Made env interpolated instead of evaluated. (#1222)
* Made env interpolated instead of evaluated.

* [skip ci] Add Test Workflow file

* Activate Test

* fix Test

Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2022-07-27 19:46:04 +00:00
Robert Kowalski
1a71c52ef3
lint: add ReadHeaderTimeout (#1277)
currently build fail with:

```
run golangci-lint
  Running [/home/runner/golangci-lint-1.47.0-linux-amd64/golangci-lint run --out-format=github-actions] in [] ...
  Error: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec)
```

for example in this PR:
https://github.com/nektos/act/runs/7405009660?check_suite_focus=true

this sets the required ReadHeaderTimeout
2022-07-25 12:12:48 +00:00
Markus Wolf
409446211f
fix: the number in the github event is of type number (#1252)
* fix: the number in the github event is of type number

The go %s formattig option outputs the type if the given
input value is not of type string.

* test: update test data as well

* fix: use floats
2022-07-12 11:36:53 +00:00
John OConnor
a5ceb54caf
only perform chown operation for non root users (#1250) 2022-07-08 22:39:42 +00:00
Hisham Muhammad
91296bd5eb
fix: allow TimeoutMinutes to be expression in Jobs (#1247)
This change stops act from rejecting valid entries such as

```
    timeout-minutes: ${{ matrix.runtime == 'v8' && 30 || 15 }}
```

at the job level.

This change complements the fix that was already in place
for the Step struct, done in #1217. See:

52f5c4592c

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-08 00:31:19 +00:00
R
e70b968924
fix: use docker images from dockerhub (#1249) 2022-07-08 00:21:51 +00:00
ChristopherHX
f71f2778f0
fix: checkout container path should always use / (#1226)
Container.CopyDir is no longer working with `\` as destpath.
2022-06-21 21:23:49 +00:00