-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MAINT Protect CUDA GPU workflow against timed commits #29286
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
MAINT Protect CUDA GPU workflow against timed commits #29286
Conversation
Isn't giving a git hash not safer? This implementation seems a bit brittle to me somehow. |
Yes using a hash would be safer. However, it is also more tedious to get the hash from the web UI so you can paste it. So there is a trade off to be made. |
I am fine with either option. Copy/pasting the commit hash is not that tedious. The problem is that once we have the git hash it's hard to find which PR holds that hash. So when looking at the list of past runs at https://github.com/scikit-learn/scikit-learn/actions/workflows/cuda-gpu-ci.yml would be hard to find the PR that was tested from the logs. EDIT: actually it should be quite doable: https://stackoverflow.com/a/48085242/163740 Updating my preference to use a commit hash. |
Favoring the commit hash too, as I mentioned in the emails (probably too long 😅). Maybe, rather than the PR number, we can use a commit link copied from inside the PR in the trigger workflow dialog box. It seems convenient enough for us maintainers to copy and paste from inside the PR for example here: and the URL seems to have both the PR and the commit:
In the workflow you can parse the PR number and the commit from the URL and you are good to go, only need to add the right The fact that Github issues a warning when I am composing this message may indicate that there are subtleties see https://github.com/refined-github/refined-github/wiki/GitHub-markdown-linkifier-bug: Edit: having read more it looks more like a rendering thing so I don't think it affects the GPU CI workflow. |
I updated the PR to use a commit hash. WDYT @betatim? |
I mis-clicked... did not intend to close. |
Commit hash is also fine for me (or should we go all in and implement the label based solution in this PR already? It seems we have boarded the "let's fix this properly" train already 😄. We also need to update Or do we not worry for now as the PR hasn't been merged and we could wait for the label solution to be done (in which case fishing the PR number out via |
I am not sure I will have time to iterate over this PR today or tomorrow. So I would rather be in favor of merging as is and do the label based solution directly in #29245 to address the need for the PR number. |
@ogrisel Has it been tested in some fashion or should we merge only by inspecting the diff? |
No I did not test on a fork. It would require editing the workflow to remove the |
Indeed the current PR is unlikely to find the commit with such a naive checkout:
|
What's our feeling about using a URL like It seems OKish to copy-and-paste into the dialog box and contains the PR number + the commit. update-lock-files.yml may need to be adapted a bit but I think this is doable. |
I find it a bit ugly. Let me check if the current workflow does not work on my fork first because the following works:
|
I confirm that the current commit_hash checkout used in this PR works on my fork: https://github.com/ogrisel/scikit-learn/actions/runs/9566401522/job/26371606982 |
Actually, to really test it I would need someone else to open a PR with an empty commit from your own fork pointing to |
It works when dispatching on a commit from another fork's PR: https://github.com/ogrisel/scikit-learn/actions/runs/9566663488/job/26372488765 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's merge this one, thanks!
For the record, I am fine with the current state of this PR but I am not opposed to using the full PR+commit URL @lesteve suggested if others prefer it. But some parsing will be needed. An alternative follow-up would be to completely replace this workflow by a label event PR-scoped workflow which would be inherently secure to cache poisoning attacks on cache contents associated with the |
This should prevent contributors to push malicious changes in their PR right after a maintainer has manually triggered on their PR.
I guess the only way to test that this works as expected to is to merge to
main
an trigger test build, although I could not find an exhaustive list of what triggers updates of the value ofgithub.event.repository.updated_at
.