Parallel Steps #14484
|
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 |
Replies: 47 comments 84 replies
|
I'd like that too. There are scenarios where it doesn't make sense juggling artifacts between jobs. 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." |
|
Alternative solution: |
Alternative solution: |
|
Logging into docker in parallel is probably going to result in things exploding. Each docker login command tries to mutate 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)
HOME=$HOME/.docker-docker
mkdir -p $HOME
docker login ...
HOME=$HOME/.docker-gcr
mkdir -p $HOME
docker login ...
HOME=$HOME/.docker-ghcr
mkdir -p $HOME
docker login ...
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 |
|
can we have the parallel steps please |
|
The BitBucket has parallel step options. Why not add this option to GitHub actions? |
|
This is the biggest pain point we've run into coming from Jenkins. You can approximate this feature with |
|
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 |
|
Using a yarn monorepo I'd like to:
yarn install is slow, and I currently have to repeat it for every workflow like |
|
If its easier, GitHub could also allow sharing jobs workdirs |
|
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 |
Just add a
|
|
As a workaround I was able to use this ` name: Distributed Tasks This way I was able to run our tests parallel |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Hi. Are there any updates on this topic from a Github team member ? |
|
This is an excellent proposal! The approach of introducing A few thoughts on the design:
The examples provided really help illustrate the use cases this would solve. Looking forward to seeing this feature ship before mid-2026! |
|
This looks great, I would add a (more niche) use case: having a background step that can wait for another step without blocking the "main thread" of foreground steps. steps:
- name: Starts A in background
id: a
run: ...
background: true
- name: Does not wait for A
id: b
run: ...
background: true
- name: Waits for A but not B
run: |
wait-step a
...
background: true
- name: Wait for A and B but no C
run: |
wait-step a b
... |
|
What I really miss in the parallel step design is to have the matrix strategy on step level like this (I create sometimes ca. 30 matrix jobs that run only < 30s) - run: echo Process the following in parallel / generate the matrix in this step dynamically
- strategy:
max-parallel: 2
matrix:
artifacts:
- name: pkg1
path: pkg1/out
- name: pkg2
path: pkg2/out
steps:
# Here you could also add the build command to run sequentially before the upload artifact
# upload-artifact usually only uploads all files into a single artifacts this is bad if you want to download only a single package
- uses: actions/upload-artifacts@v6
with:
name: ${{ stepMatrix.artifacts.name }}
path: ${{ stepMatrix.artifacts.path }}Yes I can do this example with javascript and the @actions/artifact package, but then I need much more code (On the other hand the runner needs more code for this) In my opinion Parallel Syntactic Sugar weakness is that the count of parallel steps is constant, with a matrix strategy you can adjust the called actions count and parallelism depending on the reusable workflow input parameters. Just like in job.strategy. |
|
+1 |
|
Planned to be shipped between April-June 2026 github/roadmap#1191 |
|
Sounds like a cool feature. When is it shipped and can be used? |
|
Hi everyone, wanted to give an update on this. We've been working on implementing background/parallel steps, some of you have noticed changes in some of our other repos like runner and language services. We're currently dogfooding background steps internally and will publicly ship once that process is completed. I'll post another update once it's shipped. |
|
Tested this feature in some of my orgs reusable workflows and it seems not to be working in composites. Is that intended? Is support for composites expected in the future? |
This comment was marked as spam.
This comment was marked as spam.
|
This is now shipped :) as a few folks have called out, its a v1 and is not 'everything we could have possibly done'. I would ask for folks to create new specific feedback issues for improvements (such as composite Action support) so we can get votes on those items specifically to know the priority, get our focus, and not get lost in threads in here. Thank you for the patience, feedback and engaging. More to come <3 |
|
This is so cool! Thanks for this feature 😄 Just wondering: would it be possible to define my parallel steps in a matrix-like kind of way? Useful for cases where the steps sequences are the same but too simple/lightweight for using a proper job Matrix E.g.: jobs:
build-openapi-spec:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Get deployed tags and add a worktree for each environment
id: get-deploy-tags
run: |
for environment in dev stage prod; do
deploy_tag="$(git tag --sort=creatordate | grep "^${environment}-" | tail -n1)"
git worktree add worktree-"$environment" "$deploy_tag"
done
- parallel-matrix:
vars:
environment: [dev, stage, prod]
steps:
- uses: ruby/setup-ruby@v1
with:
working-directory: worktree-${{ parallel-matrix.vars.environment }}
bundler-cache: true
- name: Build OpenAPI specs
working-directory: worktree-${{ parallel-matrix.vars.environment }}
run: bundle exec rake rswag |
|
I just tried it in a composite action and it doesn't seem to be supported there, sadly: Error: D:\a\msys2-tests\msys2-tests\./action.yml (Line: 6, Col: 7): Unexpected value 'parallel' |
|
For windows, |
|
It appears that calling the same external workflow multiple times within a single step can lead to conflicts, depending on the timing. First run: Prepare all required actions
Getting action download info
Download action repository 'pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2' (SHA:fe02b34f77f8bc703788d5817da081398fad5dd2)
Download action repository 'actions/cache@3edfce9056124e459a23f683a21433670d47daca' (SHA:3edfce9056124e459a23f683a21433670d47daca)
Error: Directory not empty : '/home/runner/work/_actions/actions/cache/3edfce9056124e459a23f683a21433670d47daca/.github'Second run: Prepare all required actions
Getting action download info
Download action repository 'denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed' (SHA:22d081ff2d3a40755e97629de92e3bcbfa7cf2ed)
Download action repository 'actions/cache@3edfce9056124e459a23f683a21433670d47daca' (SHA:3edfce9056124e459a23f683a21433670d47daca)
Error: Can't find 'action.yml', 'action.yaml' or 'Dockerfile' for action 'actions/cache/restore@3edfce9056124e459a23f683a21433670d47daca'. |
Hi everyone, these changes have been shipped, you can start adding in
backgroundsteps andparallelblocks into your jobs.