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

Adds unique name for upload-artifact jobs #2285

Merged
merged 6 commits into from
Jan 15, 2025

Conversation

gadial
Copy link
Collaborator

@gadial gadial commented Jan 14, 2025

Summary

This PR fixes an error in the github action for deploy preventing wheels from being uploaded.

Details and comments

When using actions/upload-artifact@v4 a unique name should be given for separate jobs, otherwise the name clash results in Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run.

This PR adds a unique name to the action.

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to make sure that the corresponding download-wheels action is also updated, and likely use a prefix that you can reliably know, to glob against. I think github.job will be different for each of these runs, so you might struggle to write a usable glob.

(e.g. name: dist-${{ 'whatever' }}-${{ 'whatever' }} in all uploads, then

- uses: actions/download-artifact@v4
  with:
    pattern: 'dist-*'
    merge-multiple: true

@gadial gadial requested a review from jakelishman January 15, 2025 06:50
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The top comment explains a little more, but a final comment (from my perspective): technically, it's possible to set

with:
  skip-existing: true

in the config of the PyPI upload step, which would mean that the race condition on the separate wheels accidentally getting pulled into the shared wheels upload wouldn't matter - anything already uploaded would just be silently skipped. That's the historic behaviour of twine.

That said, it's probably best just to fix the prefixes to not need to bother - it's easy enough for us to just avoid the race condition entirely, and if we ever need to retrigger the job to rebuild, we can just modify it on-the-fly (since we'd have to be modifying the script anyway).

Comment on lines 60 to 65
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: aer-deploy-build_wheels_aarch64-${{ matrix.os }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly, this set of artifacts (and a couple more noted below) gets uploaded in the line right below this one, so it doesn't need to be pulled down by the download-artifact run in the publish_shared_wheels job. Perhaps we could have the prefix be deploy-shared-, then jobs that previously uploaded to the publish-shared-wheels artifact name can become (e.g.) deploy-shared-x86_64-${{ matrix.os }} and deploy-shared-arm64-macos, while the others become deploy-separate-aarch64-linux etc? So then the glob is on deploy-shared-*, which won't attempt to re-download the wheels that aren't marked as job dependencies.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I changed this to "separate" in d9d7fb7 and set the upload prefix to handle "shared".

Comment on lines 88 to 91
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: publish-shared-wheels
name: aer-deploy-wheel-arm64-macos-${{ matrix.os }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still upload-artifact@v3 and needs bumping or the download-artifact@v4 won't be able to find it.

This is the only other upload-artifact run (along with the top comment) that gets downloaded by the shared uploader - all the others below it in this file might not want to match the prefix exactly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped to v4 in d9d7fb7 and changed the name to include "shared". I was hesitant to change to v4 in my original PR since I am not aware of the reasons to the original bump to v4 and why only it affected only part of the file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from v3 to v4 was a huge breaking change in the upload/download-artifact jobs. You certainly always have to match (v4 download can't find v3 uploads, and so on), and I think GitHub will be pushing to deprecate and remove the old v3 system soon too - iirc, it was completely piggy-backed onto their logging framework, and never properly designed as an artifact store.

Comment on lines 111 to 116
- uses: actions/upload-artifact@v4
with:
path: ./dist/qiskit*
name: aer-deploy-sdist-${{ matrix.os }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployed right after - maybe give a aer-deploy-separate- prefix to avoid being pulled by the shared uploader?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the prefix as you suggested in d9d7fb7

Comment on lines 156 to 161
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: aer-deploy-gpu-build-cuda11-${{ matrix.os }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployed here. Also, it's still upload-artifact@v3.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped to v4 and added "separate" in d9d7fb7

Comment on lines 201 to 206
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: aer-deploy-gpu-build-cuda12-${{ matrix.os }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployed here. Also, it's upload-artifact@v3.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped to 4 and added "separate" in d9d7fb7

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see, this looks right now, though debugging changes to CI/CD pipelines is always a bit slow, and it's unfortunate that Aer doesn't have a way of emulating "dry run" deployments to test them, like Terra does.

Thanks for the changes, Gadi.

@gadial gadial merged commit 4a6fd11 into Qiskit:main Jan 15, 2025
34 checks passed
@gadial gadial deleted the deploy_job_upload_artifact_fix branch January 15, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants