Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi,

Can you please raise a request to engineering for parallel steps support?

Eg. for logging in to multiple docker registries in parallel, or other actions which cannot be done in separate jobs because you require the local cache / side effects.

Uploading/downloading artifacts from adjacent jobs is not suitable for this use case.

Thanks

Hari

You must be logged in to vote

Replies: 29 comments · 48 replies

Comment options

I'd like that too. There are scenarios where it doesn't make sense juggling artifacts between jobs.
This would be greatly helpful for self-hosted and bigger runners too, where you can have many cores and handle parallelism well.

An idea how it could be used:

  steps:
    - uses: actions/checkout@v3

    - run: echo "Sequential step"

    - parallel: 
        branch_id_1:
          steps:
            - run: echo "branch 1 sequential step 1"
            - run: echo "branch 1 sequential step 2"

        # Executes steps in parallel to branch1
        branch_id_2:
          steps:
            - run: echo "branch 2 sequential step 1"
            - run: echo "branch 2 sequential step 2"

    - run: echo "More sequential steps after the whole parallel part is done."
You must be logged in to vote
3 replies
@HariSekhon
Comment options

This is a good approach as it mirrors Jenkins well-known solution for parallelizing stages.

https://www.jenkins.io/blog/2017/09/25/declarative-1/

https://www.jenkins.io/doc/book/pipeline/syntax/#parallel

@server-craftsman
Comment options

Response #1

@qoomon
Comment options

Comment options

Alternative solution:
We can convert steps into actions, and then use reusable workflows to solve the problems you said

You must be logged in to vote
0 replies
Comment options

Hi,

Can you please raise a request to engineering for parallel steps support?

Eg. for logging in to multiple docker registries in parallel, or other actions which cannot be done in separate jobs because you require the local cache / side effects.

Uploading/downloading artifacts from adjacent jobs are not suitable for this use case.

Thanks

Hari

Alternative solution:
We can convert steps into actions, and then use reusable workflows to solve the problems you said

You must be logged in to vote
3 replies
@HariSekhon
Comment options

Sorry I'm missed how putting steps in a composite action would allow you to parallelize steps such as multiple logins to different registries?

Could you please elaborate further with regards to how this solves step parallelization?

@paulz
Comment options

Parallel steps or sub jobs would save us 50% of time waiting for the CI.

@ferologics
Comment options

GH would lose a lot of money if they let people halve the time they charge for.

Comment options

Logging into docker in parallel is probably going to result in things exploding.

Each docker login command tries to mutate ~/.docker/config.json.

Today, you could probably do something like:

(To make these work, you'd want to have them rely on env vars and set the env vars using your workflow based on secrets)

log-into-docker.sh:

HOME=$HOME/.docker-docker
mkdir -p $HOME
docker login ...

log-into-gcr.sh:

HOME=$HOME/.docker-gcr
mkdir -p $HOME
docker login ...

log-into-ghcr.sh:

HOME=$HOME/.docker-ghcr
mkdir -p $HOME
docker login ...

docker-log-in.sh

for task in ./log-into-*.sh; do
  $task &
done
wait
jq '. * input' ~/.docker*/config.js > my.config.js && mv my.config.js ~/.docker/config.js
jq '. * input' ~/.docker*/plaintext-credentials.config.json > my.plaintext.js && mv my.plaintext.js ~/.docker/plaintext-credentials.config.json
You must be logged in to vote
4 replies
@HariSekhon
Comment options

If the docker CLI is not parallel safe in rewriting its config.json then that would be better raised as an issue to the docker CLI developers and the issue should be reproduceable locally using GNU parallel.

@jsoref
Comment options

Talking to the docker folks is an exercise for the brave. I wouldn't recommend it to my worst enemy.

@piotrekkr
Comment options

@jsoref I think instead of for loop with wait pid you can just use wait

If the wait utility is invoked with no operands, it shall wait
until all process IDs known to the invoking shell have terminated
and exit with a zero exit status.

About docker I totally agree. Talking to docker devs is PITA and nothing that improve dev work is actually done e.g. multiple dockerignore files or mounting volumes as non root to container and so on.

@jsoref
Comment options

@piotrekkr: thanks on both points.

Comment options

can we have the parallel steps please

You must be logged in to vote
5 replies
@MichaelVoelkel
Comment options

YES, this is the most useful option and it's obvious. Downvote must come from some GitHub dev who does not like to have some work or what? (nah, downvote was about something else, sorry, it's valid)

@lukasz-mitka
Comment options

Downvote must come from some GitHub dev who does not like to have some work or what?

Nope, it's coming from me, because this answer doesn't bring any value. Basically a spam.

@MichaelVoelkel
Comment options

Because here no-one can request for anything because GitHub action devs don't see it? Okay, I'm not aware where requests can be made. It seems to be anyways useless because there are some many open requests at various pages and I also saw GitHub action devs saying, they will probably not do it

@lukasz-mitka
Comment options

The main post is the by HariSekhon is the request. You agree - there's an arrow up button on his post.


It seems to be anyways useless

Unfortunately yes :(


also saw GitHub action devs saying, they will probably not do it

Link please?

@MichaelVoelkel
Comment options

It's from memory, so cannot tell, sorry. I think it was either about better caching or about their unwillingness to make "include yml files for steps" or some other of the obvious shortcomings. But then again, not sure if Github even claims to be a CI/CD solution or just code repo with benefits, so maybe we should not be so hard

Comment options

The BitBucket has parallel step options. Why not add this option to GitHub actions?

You must be logged in to vote
0 replies
Comment options

This is the biggest pain point we've run into coming from Jenkins. You can approximate this feature with cache, artifacts, and matrices but it's considerably slower, more costly, and error prone.

You must be logged in to vote
2 replies
@lukasz-mitka
Comment options

How come it's error prone?

@RichiCoder1
Comment options

Every project has different needs about what artifacts they need available, how they're shaped, fs permissions, size costs, etc...
It's a one time cost, but it's not fun to figure out.

Comment options

Need parallel steps support for our scenario: deploy multi clusters concurrently within the same VPN environment. So it is convinient to achive in steps rather than actions or jobs

You must be logged in to vote
0 replies
Comment options

Using a yarn monorepo I'd like to:

  1. yarn install
  2. then build every project in parallel
  3. then run test on every project in parallel

yarn install is slow, and I currently have to repeat it for every workflow like lint, test.... It's a waste of time

You must be logged in to vote
5 replies
@jsoref
Comment options

actions/cache will help. As does switching to yarn berry.

We've been iterating over an action that does some of the work to make this better:

https://github.com/GarnerCorp/build-actions/blob/main/yarn/action.yml
(I just spotted two things in this file that I think we'll clean up today.)

You can use actions/upload-artifact and actions/download-artifact to share a build product (e.g. the output tarball from the above action) between jobs (especially a matrix of jobs to run tests).

@thepratt
Comment options

Are you using yarn workspaces? If you are, you should be able to run yarn workspaces foreach --parallel [...] https://yarnpkg.com/cli/workspaces/foreach

@michielvanderros-tomtom
Comment options

I was looking for a solution for exactly the same problem @raphaelbadia.

I did get caching to work but I'm using PNPM, which I would highly recommend as an easy time saver compared to Yarn. It uses symlinks to a system level package cache, instead of installing dependencies in all your monorepo projects.

@michielvanderros-tomtom
Comment options

Check out this approach: Making pnpm run jobs in parallel instead of finding a way to run GitHub steps in parallel: https://stackoverflow.com/questions/68427503/how-can-i-run-pnpm-workspace-projects-as-parallel-jobs-on-github-actions

@koistya
Comment options

@michielvanderros-tomtom speaking of PNPM :) Yarn supports pnpm linker out of the box, in addition to pnp and regular node_modules; yet it's developed by a team vs. single person behind pnpm, and has great design with plugin system.

Comment options

If its easier, GitHub could also allow sharing jobs workdirs

You must be logged in to vote
5 replies
@jsoref
Comment options

You can use actions/upload-artifact / actions/download-artifact today...

@erikologic
Comment options

I'm aware of that.
It is not the same as 2 jobs sharing a workdir.

@erikologic
Comment options

Have a look here: https://circleci.com/docs/caching/

@lukasz-mitka
Comment options

You can use actions/upload-artifact / actions/download-artifact today...

It's super slow. Impractical for anything larger.
actions/cache is faster but has limited capacity.

@mikepurvis
Comment options

I'm in the minority, but I'd actually like this way better too— the handling of logs is more natural because each job has its own, and you already have the dag visualization of how the jobs fit together.

The obvious syntax would be instead of runs-on: <runner-type> you can use runs-from: <previous job> and then it'll inherit the same runner or a VM clone of it if multiple jobs need to run-from the same parent.

Main question mark would be what happens to those post-action steps, if you've got a bunch of torn down auth state, that's mildly annoying, though re-authing is not nearly as bad as starting from scratch.

This doesn't cover the "multiple preparatory steps in parallel" ask that some others have been making, but I'm honestly not sure if that should be the responsibility of GitHub Actions anyway. Yes, you can do that kind of thing in your Jenkinsfile, but really it belongs in a proper build tool. Let bazel or CMake or buildx bake be the thing that forks off a bunch of different tasks and figures out what to do with exit codes and logs and who knows what else.

Comment options

I just want to start a resource in a background, which needs some time to start, eg a docker container or a simulator. This resource should start during the job start. My test step should wait until the test resource is available, or fail after an (optional) timeout.

- jobs:
   - build
     - resources:
        - test-db
           run: docker start someSlowImage
     - steps: 
       - run: assemble
       - run: test
          resources:
            - test-db
               timeout: 5min
You must be logged in to vote
2 replies
@sjhewitt
Comment options

I think you can do this using service containers: https://docs.github.com/en/actions/using-containerized-services/about-service-containers

@mikepurvis
Comment options

GitLab CI does a similar thing: https://docs.gitlab.com/ci/services/

Comment options

Just add waitFor attribute similarly to Cloud Build, no need to reinvent the wheel

Note how it was implemented in Cloud Build many years ago yet it's super convenient syntax:

steps:
- name: foo
  id: A
- name: bar
  id: B
  waitFor: ["A"]
- name: baz
  id: C
  waitFor: ["A"]

... where step B and step C are intended to run in parallel, but only after step A is completed.

steps:
- name: foo
  id: A
- name: bar
  id: B
  waitFor: ["-"]
- name: baz

... where waitFor: ["-"] indicates that this step doesn't have to wait for the previous step(s) to complete.

https://cloud.google.com/build/docs/configuring-builds/configure-build-step-order

You must be logged in to vote
7 replies
@jsoref
Comment options

They might not, but each Google Cloudbuild step runs a separate disposable container and you can't persist state from one to another. Thus anyone making a comparison to them is making a very uniformed comparison.

I'm well aware of both. We're in the process of migrating some builds from Cloudbuild to GitHub Workflows and I've been using GitHub Workflows/Actions for years.

@koistya
Comment options

@jsoref you can pass state between steps in Cloud Build as easily as in GitHub Actions steps (docs). For example, the following list of steps — 1 npm install, 2 build A, 3 build B, 4 deploy A, 5 deploy B, works perfectly well in Cloud Build (sharing the /workspace files alongside the installed NPM dependencies and build output). I am currently checking what developers are saying about GitHub Actions on Reddit, and it appears to be a consensus opinion that it is still very immature because some of the core features, such as parallel step execution and others, are missing.

steps:
  - uses: actions/checkout@v3
  - uses: actions/setup-node@v3
  # Install dependencies
  - run: yarn install
  # Build the API and web front-end (app)
  - id: build-api
    run: yarn workspace api build
  - id: build-app
    run: yarn workspace app build
  # Deploy
  - id: deploy-api
    run: yarn workspace api deploy
    waitFor: ["build-api", "build-app"]   # <- This "waitFor" field demonstrates
  - id: deploy-app                        # the elegance of parallel steps feature
    run: yarn workspace app deploy        # in Google Cloud Build. If implemented
    waitFor: ["build-api", "build-app"]   # in GitHub Actions it would reduce the pain
                                          # configuring parallel steps 10-fold 💰 🙌 👍  🎉 👏 💪

^^ Deployment of packages api and app starts in parallel after both api and app packages were successfully built.

@jsoref
Comment options

steps:
  - uses: actions/checkout@v3
  - uses: actions/setup-node@v3
  # Install dependencies
  - run: yarn install
  # Build the API and web front-end (app)
  - id: build-api-app
    run: |
      yarn workspace api build &
      yarn workspace app build
      fg %1 || true
  # Deploy
  - id: deploy-api-app
    run: |
      yarn workspace api deploy &
      yarn workspace app deploy
      fg %1 || true
@koistya
Comment options

@jsoref In your example above there are no separate steps for building individual packages/projects, with separate success/failure statuses and separate logs, that's the point of this issue. I can't stress enough how painful it is (at least for me) to have this feature (parallel steps) missing in GitHub Actions. 😫 😖 😣 😡 💔 😭 😩 💢 🤬 💥 💢 😤

@jsoref
Comment options

You can make that if you want, just create logs for each thing in the main step and then pass the various job outputs to individual steps for reporting.

It really isn't terribly hard

Comment options

As a workaround I was able to use this
https://github.com/marketplace/actions/distributed-task-runner

` name: Distributed Tasks
steps:
- uses: actions/checkout@v3

  - name: Run bash commands in parallel
    uses: sambacha/parallelish@v1
      id: tasks
    with:
      cmd1: echo $BASH_VERSION; date;
      cmd2: echo $BASH_VERSION; date;`

This way I was able to run our tests parallel

You must be logged in to vote
3 replies
@koistya
Comment options

Are you able to see the logs separately for different parallel commands in GitHub Actions?

@malindajudo
Comment options

@koistya : no, can not see logs separately , but if one of the cmd fails the can see logs

@adnan-koder
Comment options

That’s an interesting workaround, @malindajudo. Running parallel steps in GitHub Actions can definitely simplify workflows, especially when dealing with tasks like multiple deployments or integrating third-party APIs. For example, in a web app development company, managing Docker containers and parallelizing tasks can help eliminate the complexity of sequential executions. This capability would allow teams to scale their processes faster, reduce bottlenecks, and enhance overall efficiency in their CI/CD pipelines.

This comment was marked as off-topic.

Comment options

Hi. Are there any updates on this topic from a Github team member ?
Reading the thread it seems like a strong painpoint.

You must be logged in to vote
0 replies

This comment was marked as off-topic.

Comment options

Would be great to have some updates here. Parallel steps would be great, plenty of instances where for example I'd like to know whether multiple steps fail (eg: a lint check as well as unit tests). While jobs can run in parallel, each needs to be setup again. Would be great for a pipeline to be able to run a setup step that for example pulls dependencies and then splits off in parallel steps each starting from the state left by the setup.
Bitbucket is able to do this, for example.

You must be logged in to vote
0 replies
Comment options

Would be awesome if we can, for example, compile our js/css files at the same time we are running composer (for PHP projects).

You must be logged in to vote
0 replies
Comment options

Just wanted to add, that parallel jobs means waiting for multiple available workers, which can add a lot to the total build time, and in some cases you don't need the extra hardware.

Not sure what's the problem with implementing this. It just adds an option that aparently a lot of people find useful.

You must be logged in to vote
0 replies
Comment options

Hi,

Can you please raise a request to engineering for parallel steps support?

Eg. for logging in to multiple docker registries in parallel, or other actions which cannot be done in separate jobs because you require the local cache / side effects.

Uploading/downloading artifacts from adjacent jobs is not suitable for this use case.

Thanks

Hari

Bitbucket can do it, just saying...

You must be logged in to vote
0 replies
Comment options

the current way of running steps in parallel (i.e using bash & or a variant of it) has a very bad ux when you think about logging

You must be logged in to vote
0 replies
Comment options

Don't know much about Actions as I'm new to this (trying to find alternatives to Drone CI), but a simple feature like this took so long time to implement, maybe the design of Actions has some fundamental flaws on create DAG of steps.
In Drone CI DAG was designed and supported in a long time ago, and there is even a view of the DAG graph.

image

Drone steps are by default parallel, unless you add a 'depends_on' list to steps, which would transform them to a DAG.
I think this might be a better and more flexible design choice than by default sequential.

You must be logged in to vote
1 reply
@artemisart
Comment options

Hello, I was considering Drone CI to use parallel steps, any reasons why you're trying to replace it? Thanks!

Comment options

Would love this feature as well. We already have quite long running pipelines and saving some time would be great. We build our .NET backend then pack it as docker image. While creating the image takes significant time we also need to upload our symbols to Sentry for better error analysis. While docker images are being created we could parallelize the upload to Sentry. A new job is no option as we lose the symbol files we require. Right now we run a separate job which fetches git, compiles, etc. all just to upload already built symbols.

Please implement this! :)

You must be logged in to vote
0 replies
Comment options

I have 5 small steps (10-30sec), each runs a docker container with different arguments. Ideally I would have first step to build docker image and then run those five steps in parallel. Doing this with workflows seems cumbersome and would possibly prolong the total run time with artifact upload and artifact downloads added to share the image between jobs.

You must be logged in to vote
4 replies
@jsoref
Comment options

if you can fit more than one docker container in a single github runner, then it definitely makes more sense to use a single step to create the image and then run the steps in parallel. We use docker compose up with a container definition to get parallelism like that.

@AurimasNav
Comment options

if you can fit more than one docker container in a single github runner, then it definitely makes more sense to use a single step to create the image and then run the steps in parallel. We use docker compose up with a container definition to get parallelism like that.

correct me if I'm wrong, but in a case with docker compose that would be a single step and you have to dig into the logs to figure out which of the containers failed?

@jsoref
Comment options

Yes. We did it. It isn't difficult.

You could probably use docker inspect -f '{{ .State.ExitCode }}' (we didn't do that, but...)

@qoomon
Comment options

try https://github.com/qoomon/actions--parallel-steps

Comment options

Hey y'all! We are still gathering all the high engagement feedback items and triaging them for our work this year. Sorry I haven't commented on this one already.
I will add it to our backlog and have a look at what this would take to turn this into a real feature <3

Thank you for all engaging and staying engaged for such a long period of time - please keep voting up on the top request and sharing your feedback with us

You must be logged in to vote
0 replies
Comment options

💬 Your Product Feedback Has Been Submitted 🎉

Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users.

Here's what you can expect moving forward ⏩

  • Your input will be carefully reviewed and cataloged by members of our product teams. 
    • Due to the high volume of submissions, we may not always be able to provide individual responses.
    • Rest assured, your feedback will help chart our course for product improvements.
  • Other users may engage with your post, sharing their own perspectives or experiences. 
  • GitHub staff may reach out for further clarification or insight. 
    • We may 'Answer' your discussion if there is a current solution, workaround, or roadmap/changelog post related to the feedback.

Where to look to see what's shipping 👀

  • Read the Changelog for real-time updates on the latest GitHub features, enhancements, and calls for feedback.
  • Explore our Product Roadmap, which details upcoming major releases and initiatives.

What you can do in the meantime 💻

  • Upvote and comment on other user feedback Discussions that resonate with you.
  • Add more information at any point! Useful details include: use cases, relevant labels, desired outcomes, and any accompanying screenshots.

As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities.

Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐

You must be logged in to vote
0 replies
Comment options

I just released https://github.com/qoomon/actions--parallel-steps This action supports basically all types of steps.
Under the hood this action utilize https://github.com/nektos/act
Example workflow run => https://github.com/qoomon/actions--parallel-steps/actions/runs/14564463805/job/40851697315
Disclaimer I guess there will be some use cases that are not working out of the box, feel free to create an issue I'm pretty confident that missing requirements can be implemented.

You must be logged in to vote
3 replies
@qoomon
Comment options

the latest release now supports pre and post steps and command files (except step summary)

@qoomon
Comment options

With the latest release of act https://github.com/qoomon/actions--parallel-steps is now fully functional. Looking forward for some feedback

@qoomon
Comment options

@HariSekhon does this work for your initial post/request?

Comment options

Just adding my voice so maybe by the time my grandkids are coding, GitHub Actions will support parallel steps.

You must be logged in to vote
0 replies
Comment options

Implementing parallel steps in GitHub Actions would significantly enhance CI/CD workflows, especially for tasks like deploying to multiple environments or managing dependencies across various services. For instance, in a mobile app development company, managing Docker containers and parallelizing tasks can help eliminate the complexity of sequential executions. This approach not only speeds up the development cycle but also ensures more efficient use of resources.

Incorporating a feature that allows for parallel execution of steps within a single job, while maintaining access to the same environment and cache, would be a valuable addition. It would streamline processes and reduce the overhead associated with managing multiple jobs.

Looking forward to seeing this feature implemented, as it would greatly improve the flexibility and efficiency of workflows in GitHub Actions.

You must be logged in to vote
1 reply
@qoomon
Comment options

try my action https://github.com/qoomon/actions--parallel-steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback Share your thoughts and suggestions on GitHub features and improvements In Backlog GitHub is aware of this and it's in the backlog
Morty Proxy This is a proxified and sanitized view of the page, visit original site.