Race condition exists for matrixed GitHub Actions for `use_existing_version_if_available = true`
See original GitHub issueBackground
While trying to run a job matrix using this Action to deploy to two environments simultaneously, the jobs failed if they started at the same time and were uploading the same (new) application version zip. Dropping the parallelism on this step fixed the problem (I now run this action without an environment, and then n
times more after that completes with the environment populated from the matrix).
Obviously it would be ideal to not waste the computation & upload twice, but the upload step should tolerate the app version already existing at any point during the upload.
Steps to Reproduce
- Run a matrixed deployment, as per the yml snippet below
multi-deploy:
name: "Deploy Elastic Beanstalk"
runs-on: ubuntu-latest
strategy:
matrix:
environment_name: [ a, b, c ]
steps:
- name: Download deployment artifact
uses: actions/download-artifact@v2
with:
name: eb-app-zip
- name: Upload application zip to S3 and create EB application version
uses: einaregilsson/beanstalk-deploy@v16
with:
aws_access_key: ${{ secrets.EB_AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.EB_AWS_SECRET_ACCESS_KEY }}
application_name: ${{ inputs.application_name }}
environment_name: ${{ matrix.environment_name }}
version_label: ${{ inputs.version_label }}
version_description: Commit ${{github.sha}} deployed by github actions
region: ${{ inputs.aws_region }}
deployment_package: deploy.zip
use_existing_version_if_available: true
wait_for_deployment: true
wait_for_environment_recovery: 60
Expected Result
One of the uploads “wins” and the others fall in line and use that app version (“already existing”)
Actual Result
One of the uploads “wins” and the other jobs error out, crashing themselves and the winning upload’s job, too.
Example Failure Output
The bucket name and key have been changed to basic values.
Uploading file to bucket mybucket
New build successfully uploaded to S3, bucket=mybucket, key=/myuniquekey/deploy-COMMITSHA.zip
Error: Deployment failed: Error: Status: 400. Code: InvalidParameterValue, Message: Application Version deploy-COMMITSHA already exists.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Ok, this is officially out as v19. 🙂
True – that would be a good idea. I’ll dig a bit into seeing if there’s a way to tell if we’re in a matrix.