Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gitpod.yml: Multi-line tasks lack error handling #13508

Closed
mkoeppe opened this issue Oct 1, 2022 · 2 comments
Closed

.gitpod.yml: Multi-line tasks lack error handling #13508

mkoeppe opened this issue Oct 1, 2022 · 2 comments
Labels
type: bug Something isn't working

Comments

@mkoeppe
Copy link

mkoeppe commented Oct 1, 2022

Bug description

The description of multi-line tasks in https://www.gitpod.io/docs/configure/workspaces/tasks#multi-line-tasks is incomplete and lacks a discussion of error handling.

In https://trac.sagemath.org/ticket/34623 we observed that error in one command are ignored and Gitpod just continues to execute the following commands.

The examples shown in this documentation in this section and https://www.gitpod.io/docs/configure/workspaces/tasks#wait-for-a-port-to-be-available do not promote good practices.

Steps to reproduce

tasks:
  - name: Dependencies & Database
    init: |
      exit 1
      echo "Got here, should not have"

Workspace affected

No response

Expected behavior

No response

Example repository

No response

Anything else?

No response

@mkoeppe mkoeppe added the type: bug Something isn't working label Oct 1, 2022
@axonasif
Copy link
Member

axonasif commented Oct 3, 2022

What you're saying about error handling is true, it's upto the bash shell.

However, in your example snippet, you have exit 1, which will exit the task shell itself. So it's not an appropriate example. I believe you wanted to express the fact that commands within a task which are run inside a bash shell do not halt on errors status. This would showcase what you wanted to:

tasks:
  - name: Dependencies & Database
    init: |
      (exit 1)
      echo "Got here, should not have"

Notice the parentheses around exit 1. However, this is not important here, just pointing out 😄

For a solution, please check #13520, I've also added an example on our docs.

@mkoeppe
Copy link
Author

mkoeppe commented Oct 3, 2022

in your example snippet, you have exit 1, which will exit the task shell itself. So it's not an appropriate example.

Yes, of course, you're right.

@axonasif axonasif closed this as completed Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants