act/pkg/common
Markus Wolf 1891c72ab1
fix: continue jobs + steps after failure (#840)
* fix: continue jobs + steps after failure

To allow proper if expression handling on jobs and steps (like always,
success, failure, ...) we need to continue running all executors in
the prepared chain.
To keep the error handling intact we add an occurred error to the
go context and handle it later in the pipeline/chain.

Also we add the job result to the needs context to give expressions
access to it.
The needs object, failure and success functions are split between
run context (on jobs) and step context.

Closes #442

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

* style: correct linter warnings

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

* fix: job if value defaults to success()

As described in the documentation, a default value of "success()" is
applied when no "if" value is present on the job.

https://docs.github.com/en/actions/learn-github-actions/expressions#job-status-check-functions

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

* fix: check job needs recursively

Ensure job result includes results of previous jobs

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

* test: add runner test for job status check functions

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

* test: add unit tests for run context if evaluation

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

* refactor: move if expression evaluation

Move if expression evaluation into own function (step context) to
better support unit testing.

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

* test: add unit tests for step context if evaluation

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

* fix: handle job error more resilient

The job error is not stored in a context map instead of a context
added value.
Since context values are immutable an added value requires to keep
the new context in all cases. This is fragile since it might slip
unnoticed to other parts of the code.

Storing the error of a job in the context map will make it more stable,
since the map is always there and the context of the pipeline is stable
for the whole run.

* feat: steps should use a default if expression of success()

* test: add integration test for if-expressions

* chore: disable editorconfig-checker for yaml multiline string

Co-authored-by: Björn Brauer <zaubernerd@zaubernerd.de>
Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
2021-12-08 20:57:42 +00:00
..
cartesian.go Fix Cartesian product to return empty set if empty set is given (#503) 2021-01-23 14:55:54 -08:00
cartesian_test.go Fix indent with go fmt (#531) 2021-02-17 11:47:59 -08:00
draw.go GitHub env file support (#426) 2021-01-11 22:39:43 -08:00
dryrun.go successfully able to run simple workflows 2020-02-20 21:05:25 -05:00
executor.go fix: continue jobs + steps after failure (#840) 2021-12-08 20:57:42 +00:00
executor_test.go Clean the repository cache if it is in incomplete state (#595) 2021-04-06 06:43:02 -07:00
file.go Add super-linter + fix lint issues (#650) 2021-05-03 09:52:03 -07:00
git.go Fix github SSH regex for missing .git extension (#871) 2021-11-13 14:56:31 +00:00
git_test.go Fix github SSH regex for missing .git extension (#871) 2021-11-13 14:56:31 +00:00
job_error.go fix: continue jobs + steps after failure (#840) 2021-12-08 20:57:42 +00:00
line_writer.go integration test 2020-02-24 12:48:12 -08:00
line_writer_test.go integration test 2020-02-24 12:48:12 -08:00
logger.go successfully able to run simple workflows 2020-02-20 21:05:25 -05:00
outbound_ip.go Asset server implementation (#677) 2021-11-10 09:57:22 -08:00
testflag.go feat: allow existing logger from context (#898) 2021-11-27 17:45:56 +00:00