Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Introduce a gate/check GHA job#97533

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugovk merged 1 commit intopython:mainfromwebknjaz:maintenance/gha-check
Jul 6, 2023

Conversation

webknjaz
Copy link
Contributor

@webknjazwebknjaz commentedSep 24, 2022
edited
Loading

This adds a GHA job that reliably determines if all the required dependencies have succeeded or not.

It also allows to reduce the list of required branch protection CI statuses to just one —check. This reduces the maintenance burden by a lot and have been battle-tested across a small bunch of projects in its action form and in-house implementations of other people.

This action is now in use in aiohttp (and other aio-libs projects), CherryPy, some of the Ansible repositories, pip-tools, all of the jaraco's projects (likesetuptools,importlib_metadata), some of the hynek's projects (likeattrs,structlog), some PyCQA, PyCA, PyPA and pytest projects, a few AWS Labs projects. Admittedly, I maintain a few of these but it seems to address some of the pain folks have:jaraco/skeleton#55 (comment).

I saw a few attempts to reduce the maintenance burden for GHA and figured
this might be useful for CPython too, which is why I'm submitting this patch.
Looking forward to hearing what you think!

The story behind this is explained in more detail athttps://github.com/marketplace/actions/alls-green#why.

arhadthedev reacted with thumbs up emoji
@@ -317,3 +320,44 @@ jobs:
run: make pythoninfo
- name: Tests
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"

check: # This job does nothing and is only used for the branch protection
if: always()
Copy link
ContributorAuthor

@webknjazwebknjazSep 24, 2022
edited
Loading

Choose a reason for hiding this comment

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

This is mandatory because otherwise it'll get askipped status in some cases and the branch protection sees that asskipped == success which is undesired.

- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@198badcb65a1a44528f27d5da555c4be9f12eac6
with:
allowed-skips: >-
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This setting tells the action that if the listed jobs (comma-separated) got skipped, that's okay. But the jobs are allowed to be skipped based on the same condition they've got set. If the first job requests test runs, this list will compute as empty and none of the jobs will be allowed to be skipped (meaning that skips would turn into failures).

Copy link
Member

Choose a reason for hiding this comment

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

Do I understand this right?

  • Ifcheck-docs starts, it must pass; if they skip, that's fine.

  • Ifcheck_generated_files or any of the other jobs in its group start, they must all pass; if they all skip, that's fine.

  • Iftest_hypothesis starts, it must pass; if they skip, that's fine.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@hugovk almost: this is paired with the setting above ☝️ — essentially, if something is allowed to be skipped, and it is skipped, the action will treat it as non-failure.
But if something is allowed to be skipped and is not skipped, whether its failure is to be treated as such is controlled by theallowed-failures input.

Also, not they are not grouped inside the action, the templating here just produces a comma-separated list of things and the action doesn't know it was in some group externally. So yes, such a relation kinda exists, but I would say that it's indirect.

And since there's no “groups”, if any of the jobs that are allowed to be skipped run, each individual job is evaluated separately from the “group”, based on the fact of failures being allowed or not.

N.B. Whether a job is allowed to fail is also contributed by thecontinue-on-error setting, which is mostly useful for controlling individual matrix jobs. If a job was allowed to fail prior to this one, the action will not “see” if it was red and treat it as green.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

  • Iftest_hypothesis starts, it must pass; if they skip, that's fine.

With the context I added earlier, seeing thattest_hypothesis is listed inallowed-failures unconditionally, it will never cause failures. This reflects the current branch protection configuration as seen in the Checks widget in PRs.

@hugovk
Copy link
Member

Thanks for the PR!

Some points to consider:

  1. This changes the security levels: a small group of6 org owners + 8 repo admins can change the required checks via repo settings. With this PR, any of the ~90 active core devs can merge changes to this file. Is that okay? I think it's probably fine, we're not deploying or anything from here, but let's make sure.

  2. Whilst this does reduce maintenance burden in administering which checks are required or not, is that something that needs changing often?
    For projects that test a big matrix of Python versions, it's definitely a plus: no need to add/remove version-specific checks via the interface once or twice a year. Maybe less so here?

  3. Has this ~14 vs. ~90 been a bottleneck in the past?

@webknjaz
Copy link
ContributorAuthor

@hugovk these are good points and I haven't considered some of them.

  1. I should probably document the security considerations in README. It seems like this might be solvable by requiring reviews from code owners, for example. This should limit the scope of the CI updates made flying under the radar. It also occurred to me that the repository settings updates happen unnoticed, with no traceability for the larger public — only the admins would be able to see this in the security audit log and only if they specifically search for such changes. Whereas with the branch-protection-as-a-code, it's all there, verifiable viahttps://github.com/python/cpython/commits/main/.github/workflows/build.yml.
  2. I've been offering similar PRs to many projects with matrixes of various sizes, and I've seen the maintainers forgetting to add new matrix factors. After all, it's a mental overhead having to memorize to perform some extra action items far from the place where you're editing the source code, especially since they aren't even in the code.
  3. That's not something I can observe/verify 🤷‍♂️ — maybe@ezio-melotti knows?

@webknjazwebknjazforce-pushed themaintenance/gha-check branch 2 times, most recently from46d97b5 tob436563CompareJanuary 6, 2023 19:19
@ambv
Copy link
Contributor

I don't know if this is worth it for CPython as a number of jobs we require are outside of GitHub Actions (CLA, Issue Number, and News). So this check will increase complexity but won't actually solve the problem of bringing all required checks in one place.

zware reacted with thumbs up emoji

@CAM-Gerlach
Copy link
Member

@hugovk , as you've worked a lot of CI stuff lately across the various Python-org repos, do you have further feedback on this?

  1. I should probably document the security considerations in README. It seems like this might be solvable by requiring reviews from code owners, for example.

Just to note, that would be a prettyhuge change in terms of workflow for this repo, sinceCODEOWNERS is used here for much more than just who isrequired to review certain changes. I'm not sure that itself is a dealbreaker for this proposal, but certainly something to keep in mind.

zware reacted with thumbs up emojiwebknjaz reacted with eyes emoji

@zware
Copy link
Member

Agreed with@ambv: this looks like significant added complexity for not much actual gain in this project. It looks like a nice idea for some other setups, but doesn't feel like a great fit for us here. It's also possible I'm just missing the point, though :)

webknjaz reacted with eyes emoji

@brettcannon
Copy link
Member

  1. I should probably document the security considerations in README. It seems like this might be solvable by requiring reviews from code owners, for example.

Just to note, that would be a prettyhuge change in terms of workflow for this repo, sinceCODEOWNERS is used here for much more than just who isrequired to review certain changes.

FYI the SC has explicitly stated individuals cannot act as owners on any one piece of code (i.e. weall own the code), so requiringCODEOWNERS approval is a non-starter IMO.

ambv reacted with thumbs up emojiwebknjaz reacted with eyes emoji

@ambvambv closed thisMar 28, 2023
@ambv
Copy link
Contributor

Alright, so I'm closing this based on the latest feedback. Thanks for putting this together,@webknjaz, and sorry it wasn't a good match for us at this time!

@ambvambv reopened thisApr 26, 2023
@ambv
Copy link
Contributor

Given that our requirements changed, with Auto-merge enabled, and more checks existing now, I would like to reconsider this PR for inclusion.

@webknjaz, would you be so kind as to adapt this to the current state ofmain?

@webknjaz
Copy link
ContributorAuthor

@ambv so I just realized that the docs are its own workflow. The only way this is gonna work is wiring that in as a reusable workflow.

@webknjaz
Copy link
ContributorAuthor

A quick summary of our in-person interaction. Łukasz and I agreed to implement the following:

  • rename thecheck job ID and name
  • convert the docs workflow into a reusable one
  • integrate that into the mainbuild workflow, making use of the dynamic change detection that's already present there
  • move the "allowed failures" declarations to the check

@ambv do we need to do the same to thebuild_msi workflow?

@webknjazwebknjazforce-pushed themaintenance/gha-check branch 2 times, most recently from46004d0 to71f3a64CompareApril 26, 2023 23:41
@webknjazwebknjaz requested a review fromAA-TurnerMay 28, 2023 23:51
@webknjaz
Copy link
ContributorAuthor

@ambv@hugovk I think this is ready.

@webknjazwebknjazforce-pushed themaintenance/gha-check branch from136fda2 to79f84d7CompareJune 26, 2023 16:46
@webknjaz
Copy link
ContributorAuthor

@ambv@hugovk let's see if this is ready now...

hugovk reacted with eyes emoji

@webknjazwebknjazforce-pushed themaintenance/gha-check branch from79f84d7 tod363de3CompareJune 26, 2023 17:22
@AlexWaygoodAlexWaygood removed their request for reviewJune 26, 2023 17:23
This adds a GHA job that reliably determines if all the requireddependencies have succeeded or not.It also allows to reduce the list of required branch protection CIstatuses to just one — `check`. This reduces the maintenance burdenby a lot and have been battle-tested across a small bunch of projectsin its action form and in-house implementations of other people.This action is now in use in aiohttp (and other aio-libs projects),CherryPy, conda, coveragepy, Open edX, Towncrier some of the Ansiblerepositories, pip-tools, all of the jaraco's projects (like`setuptools`, `importlib_metadata`), some of hynek's projects (like`attrs`, `structlog`), some PyCQA, PyCA, PyPA and pytest projects, afew AWS Labs projects. Admittedly, I maintain a few of these but itseems to address some of the pain folks have:jaraco/skeleton#55 (comment).I figured, this might be useful for CPython too, which is why I'msubmitting this patch.The story behind this is explained in more detail athttps://github.com/marketplace/actions/alls-green#why.Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@webknjazwebknjaz requested a review fromhugovkJune 26, 2023 19:34
@webknjazwebknjazforce-pushed themaintenance/gha-check branch frombfa9d60 to0fa6164CompareJune 26, 2023 19:34
Copy link
Member

@hugovkhugovk left a comment

Choose a reason for hiding this comment

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

Thanks! Let's give@ambv some time to check before merging.

webknjaz reacted with thumbs up emoji
@webknjaz
Copy link
ContributorAuthor

@hugovk IIRC Łukasz and I talked about merging this PR but not changing the branch protection settings for a while so the check name would start being reported in the Checks widget on old PR updates, otherwise they'll get blocked until updated.

hugovk reacted with thumbs up emoji

@hugovkhugovk merged commite7cd557 intopython:mainJul 6, 2023
@hugovk
Copy link
Member

Thanks again!

webknjaz reacted with hooray emoji

webknjaz added a commit to webknjaz/cpython that referenced this pull requestJul 23, 2023
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>(cherry picked from commite7cd557)Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
webknjaz added a commit to webknjaz/cpython that referenced this pull requestJul 23, 2023
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>(cherry picked from commite7cd557)Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
@bedevere-bot
Copy link

GH-107114 is a backport of this pull request to the3.12 branch.

@bedevere-bot
Copy link

GH-107115 is a backport of this pull request to the3.11 branch.

ambv pushed a commit that referenced this pull requestJul 23, 2023
ambv pushed a commit that referenced this pull requestJul 23, 2023
webknjaz added a commit to webknjaz/cpython that referenced this pull requestJul 23, 2023
This fixes an incorrect conflict resolution problem that happenedin0cdc3a5 while backportingPRpython#97533 as PRpython#107115 (merged prematurely). This problem causedGitHub Actions CI/CD to crash while attempting to load the workflowfile definition, preventing the jobs that are defined in`.github/workflows/build.yml` from actually starting.
ambv pushed a commit that referenced this pull requestJul 23, 2023
This fixes an incorrect conflict resolution problem that happenedin0cdc3a5 while backportingPR#97533 as PR#107115 (merged prematurely). This problem causedGitHub Actions CI/CD to crash while attempting to load the workflowfile definition, preventing the jobs that are defined in`.github/workflows/build.yml` from actually starting.
@webknjaz
Copy link
ContributorAuthor

UPD: this has been backported to 3.12 and 3.11 and the branch protection changed accordingly.

hugovk reacted with rocket emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@AlexWaygoodAlexWaygoodAlexWaygood left review comments

@hugovkhugovkhugovk approved these changes

@ezio-melottiezio-melottiAwaiting requested review from ezio-melottiezio-melotti is a code owner

@ambvambvAwaiting requested review from ambv

@AA-TurnerAA-TurnerAwaiting requested review from AA-TurnerAA-Turner is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

10 participants
@webknjaz@hugovk@ambv@CAM-Gerlach@zware@brettcannon@AA-Turner@bedevere-bot@AlexWaygood@ezio-melotti

[8]ページ先頭

©2009-2025 Movatter.jp