-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Update .asf.yaml to protect release branches #14226
Conversation
.asf.yaml
Outdated
- CI - Cancel duplicate workflows | ||
- CI - CPP, Python Tests | ||
- CI - CPP build on CentOS 7 | ||
- CI - CPP build on Windows | ||
- Auto Labeling | ||
- CI - Go Functions style check | ||
- CI - Go Functions Tests | ||
- CI - Integration - Backwards Compatibility | ||
- CI - Integration - Cli | ||
- CI - Integration - Function & IO | ||
- CI - Integration - Messaging | ||
- CI - Integration - Process | ||
- CI - Integration - Pulsar-IO Sinks and Sources | ||
- CI - Integration - Pulsar-IO Oracle Source | ||
- CI - Integration - Schema | ||
- CI - Integration - Sql | ||
- CI - Integration - Standalone | ||
- CI - Integration - Thread | ||
- CI - Integration - Tiered FileSystem | ||
- CI - Integration - Tiered JCloud | ||
- CI - Integration - Transaction | ||
- CI - Misc | ||
- CI - Maven Dependency Cache Update | ||
- CI - Pulsar Website build | ||
- Pulsar Bot | ||
- CI - Python - Build 3.9 client | ||
- CI - Shade - Test | ||
- CI - Unit | ||
- CI - Unit - Brokers - Broker Group | ||
- CI - Unit - Brokers - Client Api | ||
- CI - Unit - Brokers - Client Impl | ||
- CI - Unit - Broker - JDK8 | ||
- CI - Unit - Brokers - Other | ||
- CI - Unit - Proxy |
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.
Please let me know if any of these CI jobs are not supposed to be required. Thanks!
.asf.yaml
Outdated
- CI - CPP build on CentOS 7 | ||
- CI - CPP build on Windows | ||
- Auto Labeling |
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.
I think this can be removed, it's not a check.
.asf.yaml
Outdated
- CI - Pulsar Website build | ||
- Pulsar Bot |
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.
Those three can remove I think
btw. it's possible to find out currently protected branches with this GitHub API call
|
Getting current required status checks:
GitHub API docs: https://docs.github.com/en/rest/reference/branches#get-branch-protection |
.asf.yaml
Outdated
# found in the "name:" field of ./github/workflows/*.yaml files | ||
# Note: here is the list of intentionally excluded contexts: |
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.
This isn't correct information. See #14226 (comment) for the current information. The contexts gets passed as-is in the asfgit python code. I'll check where to get the correct context names.
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.
list of context names: #14226 (comment) .
The context name is the name of the job in the workflow yaml file. It's not the name of the workflow.
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.
Thank you for finding this. I struggled to find documentation on this piece, and determined it was the name based on the the way the GitHub UI takes input. This makes much more sense.
Here's a list of the correct context names for
Some workflows have duplicate names. I guess that's fine, but the only issue it causes it that you cannot distinguish a specific workflow. |
Listing job names, requires yq (
The name of the job is the id if the name is empty or unspecified. for example
and in comparison
matrix jobs are an exception. if the name isn't specified, the matrix variable will be part of the name, for example for file .github/workflows/ci-unit-broker-broker-gp.yaml, the generated names are:
|
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.
a11f086
to
c1e877e
Compare
@lhotari - this could be a feature in the sense that all duplicate names get the same treatment. For example, if all "unit tests" are named the same, they'll all be required. In the GitHub UI, they are visibly different because the top level |
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.
I'm told that while wildcards are not possible globs may be possible, but I think that would need to be tested with the GitHub API
@dave2wave - that makes sense to me. I'd expect to just need |
@dave2wave - as far as I can tell, it's not possible to set wildcard protections using the REST API. It's only possible with the GraphQL API. @lhotari found the GitBox code https://github.com/apache/infrastructure-puppet/blob/deployment/modules/gitbox/files/asfgit/asfyaml.py#L278-L302, and it looks to me like it currently uses the REST API. Source: https://github.saobby.my.eu.orgmunity/t/rest-api-v3-wildcard-branch-protection/13593/13 EDIT: add wildcard in first sentence. |
@michaeljmarshall The API used by .asf.yaml very likely predates the GraphQL. Changing the API would be a larger project and impacts every project that uses .asf.yaml which is a large proportion of ASF projects. If anyone is interested in helping ASF Infra I can connect you. (Note that one given is that everything with Infra must be Python and for templates EZT is preferred.) |
@dave2wave - sorry, I forgot a word in my last message. I meant to say it's not possible to set wildcard permissions via the REST API. This will work as is. We will just have to update the release process to include adding branch protections to new branches. |
Sure. If a volunteer wished to implement wildcard branch protection update then you would start by rewriting https://github.com/apache/infrastructure-puppet/blob/deployment/modules/gitbox/files/asfgit/asfyaml.py#L257-L391 |
@lhotari - can you take another look? Thanks. |
This addition ensures that `branch-2.10` is protected from force pushes. See #14226 for more information.
* Update .asf.yaml to protect release branches * Remove protections and required runs based on review * Fix context names and document changes
This addition ensures that `branch-2.10` is protected from force pushes. See apache#14226 for more information.
Motivation
Many of our current Pulsar branches are not protected. They are vulnerable to accidental force pushes. We should not allow for any modification of history on our release branches.
Further, it is important to update this check because we currently have several status checks that are not required. If a committer were not paying close attention, they could accidentally merge a PR that is not passing all tests. Here is an example: #14158 (comment).
I followed the instructions here https://cwiki.apache.org/confluence/display/INFRA/Git+-+.asf.yaml+features#Git.asf.yamlfeatures-BranchProtection when drafting this PR.
Modifications
.asf.yaml
file.** There are instructions here: https://cwiki.apache.org/confluence/display/INFRA/Git+-+.asf.yaml+features#Git.asf.yamlfeatures-BranchProtection
Verifying this change
I opened this ASF Infra Jira ticket https://issues.apache.org/jira/browse/INFRA-22833 to discuss the current protections for our branches.
Checking with ASF infra is important because otherwise we could overwrite current protections:
Does this pull request potentially affect one of the following parts:
This PR only affects the GitHub repo management.
Documentation
We don't need documentation for this feature. The git history should be sufficient.