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

[CI] Set PYPI_TOKEN in build_wheel.yml #1542

Conversation

shintaro-iwasaki
Copy link
Contributor

@shintaro-iwasaki shintaro-iwasaki commented Jan 12, 2023

PYPI_TOKEN is not set in the new nightly wheel script (build_wheel.yml), so it fails to upload created wheel files to PYPI (https://github.com/pytorch/FBGEMM/actions/runs/3901417835). This PR fixes this issue.

Details

We need to use a secret PYPI_TOKEN to upload wheel files to PyPI. It needs to be accessed via env (e.g., https://github.com/pytorch/FBGEMM/blob/v0.3.0/.github/workflows/fbgemm_nightly_build.yml#L264-L265).

upload_pypi job in the new nightly script uses a Docker (via linux_job.yml). Because I am not 100% sure if we can securely pass this PYPI_TOKEN to the Docker container, this PR changes upload_pypi to use a default GitHub Action runner (ubuntu-latest) and pass PYPI_TOKEN as the original nightly script does, which is the standard method and therefore should be more secure.

@netlify
Copy link

netlify bot commented Jan 12, 2023

Deploy Preview for pytorch-fbgemm-docs canceled.

Name Link
🔨 Latest commit cb9d8cf
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-fbgemm-docs/deploys/63c04646ebc6c50008c15341

@shintaro-iwasaki shintaro-iwasaki force-pushed the siwasaki/pr/fix_pypi_token branch from b1132e9 to cb9d8cf Compare January 12, 2023 17:41
@facebook-github-bot
Copy link
Contributor

@shintaro-iwasaki has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@shintaro-iwasaki merged this pull request in dc328f2.

facebook-github-bot pushed a commit that referenced this pull request Jan 14, 2023
Summary:
This PR follows up #1542; `github.secrets` is not passed to a reusable workflow by default, so #1542 does not fix the issue. This PR solves the issue by setting `secrets: inherit` in the caller workflow script.

### [Details]

The main PyPI upload mechanism is defined in `build_wheel.yml`. This is a "reusable workflow" and is triggered by `push_wheel_trigger.yml` every night. GitHub Actions, by default, does not pass `github.secrets` to a reusable workflow even if both belong to the same repository (https://docs.github.com/en/actions/using-workflows/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow). The setting above fixes the issue (as far as I tried locally).

Note 1: This problem does not exist in the original scripts (e.g., `fbgemm_nightly_build.yml`) because they do not use a reusable workflow mechanism (i.e., both cron trigger and `pypi-upload` logics exist in the same file).

Note 2: The new mechanism cannot define a trigger and `pypi-upload` in the same file as the original script does because I could not find a way to put all the following triggers in a single file:
1. cron-based job trigger (now in `push_wheel_trigger.yml`)
2. manual job trigger (=`workflow_dispatch`, now in `push_wheel_trigger.yml`)
3. per-PR job trigger to test wheel creation (enabled when a special label is added, now in `test_wheel_trigger.yml`)

Pull Request resolved: #1546

Reviewed By: jianyuh

Differential Revision: D42508939

Pulled By: shintaro-iwasaki

fbshipit-source-id: 5ec2381327fbe143659b745cc8d7ed5a23c7694b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants