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

Run background tasks #131

Open
TristanHoladay opened this issue Jul 16, 2024 · 1 comment
Open

Run background tasks #131

TristanHoladay opened this issue Jul 16, 2024 · 1 comment
Labels
enhancement ✨ New feature or request

Comments

@TristanHoladay
Copy link

TristanHoladay commented Jul 16, 2024

Is your feature request related to a problem? Please describe

I'd like to run a task / cmd in the background, allowing the next task / cmd to run, making use of what's been started by the first task / cmd.

My use case is in uds-engine we are embedding the ui in a Go backend. For e2e testing running in CI, we want to start the backend and then execute the npm script that runs our playwright tests, which will run against that Go server.

The task:
Screenshot from 2024-07-16 06-41-19

The current issue is that even when using the & at the end of our server cmd Maru does not move on to the next cmd in the sequence.
Screenshot from 2024-07-16 06-40-46

At the moment, the only way to do this is to split the task into 2 separate tasks and call them from two different terminals.

Describe the solution you'd like

  • Given a single task that has cmds with & (or some other designation)
  • When those cmds are processed they run in the background
  • Then the next cmd / task runs

Describe alternatives you've considered

Potentially #80 could solve this issue as well, allowing us to call both tasks, to start the backend and run the tests, from a single point in our CI workflow.

e.g.

- name: Run server and then e2e tests
        run: uds run test:e2e-backend test:e2e-frontend

Another workaround (that we're currently doing) is to remove the server startup from a task and run it directly in a github actions step because github actions handles the background cmd and moves on to the next step

  # Run e2e backend first to start air server in the background
      - name: Run e2e backend setup
        run: |
            uds run setup:slim-cluster --no-progress
            go install github.com/air-verse/air@latest
            air -c .air.toml &

      - name: Run e2e frontend tests
        run: uds run test:e2e --no-progress

Additional context

Add any other context or screenshots about the feature request here.

@zachariahmiller
Copy link
Contributor

This would pair nicely with something like a defer for cleanup. i've run into this and come up with super janky solutions numerous times already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants