tasks: Fail on error by default (run with `bash -e`)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.8k
- Forks
- 1.4k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 5
Description
Is your feature request related to a problem? Please describe
Gitpod multiline tasks don't fail if the failed command is in the middle (https://github.com/gitpod-io/gitpod/issues/13520).
For example, this inevitable failure will result in great success.
- init: |
echo The failure is inevitable.
true
false
true
echo Unachievable great success."
Which is equivalent to this bash call.
$ bash -c "echo The failure is inevitable.
true
false
true
echo Unachievable great success."
The failure is inevitable.
Unachievable great success.
https://github.com/gitpod-io/website/pull/2843 adds an explanation with a code snippet that users need to copy paste if they want to amend this behavior and fail on errors. The problem is, all other CI/CD systems that are configured by YAML, such as GitHub Actions, fail on multiline strings by default.
Describe the behaviour you'd like
The solution is to add -e option to bash when task is executed. Then the execution will be equal to this behavior.
$ bash -e -c "echo The failure is inevitable.
true
false
true
echo Unachievable great success."
The failure is inevitable.
The example at the https://github.com/gitpod-io/website/pull/2843 then could be altered to show how modify scripts to ignore failures.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Gitpod task execution path that invokes bash for multiline tasks, then compare its current behavior with the bash and bash -e examples in the issue. Done means multiline tasks stop after a failed command by default, with the documented example updated to explain how to ignore failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, typescript
- Domain
- developer-experience, devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100