Skip to content

Commit ff45dd2

Browse files
authored
doc: update CONTRIBUTING.md (#13379)
Update CONTRIBUTING.md per go/cloud-sdk-contributing-guidelines.
1 parent 6d61480 commit ff45dd2

1 file changed

Lines changed: 294 additions & 42 deletions

File tree

CONTRIBUTING.md

Lines changed: 294 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,289 @@
1-
Contributing
2-
============
1+
# How to Contribute
32

4-
We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow before opening an issue or a PR:
5-
1. Ensure the issue was not already reported.
6-
2. Open a new issue if you are unable to find an existing issue addressing your problem. Make sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
7-
3. Discuss the priority and potential solutions with the maintainers in the issue. The maintainers would review the issue and add a label "Accepting Contributions" once the issue is ready for accepting contributions.
8-
4. Open a PR only if the issue is labeled with "Accepting Contributions", ensure the PR description clearly describes the problem and solution. Note that an open PR without an issue labeled with "Accepting Contributions" will not be accepted.
3+
We'd love to accept your patches and contributions to this project. There are
4+
just a few small guidelines you need to follow.
5+
6+
## Contributor License Agreement
7+
8+
Contributions to this project must be accompanied by a Contributor License
9+
Agreement. You (or your employer) retain the copyright to your contribution;
10+
this simply gives us permission to use and redistribute your contributions as
11+
part of the project. Head over to
12+
[https://cla.developers.google.com/](https://cla.developers.google.com/) to see
13+
your current agreements on file or to sign a new one. You generally only need
14+
to submit a CLA once, so if you've already submitted one (even if it was for a
15+
different project), you probably don't need to do it again.
16+
17+
## Code Reviews
18+
19+
All submissions, including submissions by project members, require review. We
20+
use GitHub pull requests for this purpose. Submissions by non-Googlers require
21+
two reviewers. Consult [GitHub
22+
Help](https://help.github.com/articles/about-pull-requests/) for more
23+
information on using pull requests.
24+
25+
### Multi-Approvers Check
26+
27+
Each pull request must be approved by two Googlers. This is enforced by an
28+
automated multi-approvers check. This check may not automatically re-run after
29+
the second approval is added. If it remains in a failed state, you can manually
30+
re-trigger it by:
31+
- Clicking "View details" on the failed workflow to bring you to the "Actions"
32+
page.
33+
- Clicking "Re-run failed jobs".
34+
35+
For more information, see
36+
[Re-running failed jobs in a workflow](https://docs.github.com/en/actions/how-tos/managing-workflow-runs-and-deployments/managing-workflow-runs/re-running-workflows-and-jobs#re-running-failed-jobs-in-a-workflow).
37+
38+
## Community Guidelines
39+
40+
This project follows
41+
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
42+
43+
## Before contributing code
44+
45+
Before doing any significant work, open an issue to propose your idea and
46+
ensure alignment. You can either
47+
[file a new issue](https://github.com/googleapis/google-cloud-java/issues/new/choose), or comment on an
48+
[existing one](https://github.com/googleapis/google-cloud-java/issues).
49+
50+
A pull request (PR) that does not go through this coordination process may be
51+
closed to avoid wasted effort. Make sure your code follows the
52+
[style guidelines](https://google.github.io/styleguide/javaguide.html).
53+
54+
## Using the issue tracker
55+
56+
We use GitHub issues to track tasks, bugs, and discussions. Use the issue
57+
tracker as your source of truth.
58+
59+
## Filing a new issue
60+
61+
All changes, except trivial ones, should start with a GitHub issue.
62+
63+
This process gives everyone a chance to validate the design, helps prevent
64+
duplication of effort, and ensures that the idea fits inside the goals for the
65+
language and tools. It also checks that the design is sound before code is
66+
written; the code review tool is not the place for high-level discussions.
67+
Always include a clear description in the body of the issue. The description
68+
should provide enough context for any team member to understand the problem or
69+
request without needing to contact you directly for clarification.
70+
71+
## Leaving a TODO
72+
73+
When adding a TODO to the codebase, always include a link to an issue, no
74+
matter how small the task.
75+
76+
Use the format:
77+
78+
```
79+
// TODO(https://github.com/googleapis/google-cloud-java/issues/<number>): explain what needs to be done
80+
```
81+
82+
This helps provide context for future readers and keeps the TODO relevant and
83+
actionable as the project evolves.
84+
85+
## Sending a pull request
86+
87+
All code changes must be submitted via a pull request. If you are a first-time
88+
contributor, please review the
89+
[GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow)
90+
before starting.
91+
92+
Before sending a pull request, make sure it includes tests if there are logic
93+
changes, copyright headers in every file, and a commit message following the
94+
conventions in the
95+
[Commit messages](#commit-messages)
96+
section below.
97+
98+
### Open pull requests from a personal fork
99+
100+
Open pull requests from a personal fork. When opening your pull request, enable
101+
"Allow edits from maintainers" to allow others to help you with minor tweaks or
102+
merge conflicts directly.
103+
104+
For a step-by-step guide, see the official documentation on
105+
[creating a pull request from a fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork).
106+
107+
### Keep pull requests up to date with base branch
108+
109+
The repository is configured to not require branches to be up to date before
110+
merging. This means that you do not have to have the latest changes from the
111+
base branch integrated, unless GitHub detects merge conflicts. To minimize the
112+
risk of the pull request getting out of date with the base branch, enable
113+
[auto-merge](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request)
114+
so that the pull request submits as soon as it is approved and the checks pass.
115+
116+
## Commit messages
117+
118+
Commit messages should follow the conventions below:
119+
120+
Here is an example:
121+
122+
```
123+
feat(storage): add new storage bucket feature
124+
125+
A new feature is added to storage.
126+
127+
Fixes \#238
128+
```
129+
130+
### First line
131+
132+
The first line of the change description is a short one-line summary of the
133+
change, following the structure `<type>(<package>): <description>`:
134+
135+
#### type
136+
137+
A structural element defined by the conventions at
138+
[https://www.conventionalcommits.org/en/v1.0.0/\#summary](https://www.conventionalcommits.org/en/v1.0.0/#summary).
139+
140+
Conventional commits are parsed by release tooling to generate release notes.
141+
142+
#### package
143+
144+
The name of the package affected by the change, and should be provided in
145+
parentheses before the colon. (For example, storage or pubsub).
146+
147+
### description
148+
149+
A short one-line summary of the change, that it should be written so to
150+
complete the sentence "This change modifies the codebase to ..." That means it
151+
does not start with a capital letter, is not a complete sentence, and actually
152+
summarizes the result of the change. Note that the verb after the colon is
153+
lowercase, and there is no trailing period. The first line should be kept as
154+
short as possible (many git viewing tools prefer under ~76 characters).
155+
156+
Follow the first line by a blank line.
157+
158+
### Main content
159+
160+
The rest of the commit message should provide context for the change and
161+
explain what it does. Write in complete sentences with correct punctuation.
162+
Don't use HTML, Markdown, or any other markup language.
163+
164+
### Referencing issues
165+
166+
The special notation "Fixes \#12345" associates the change with issue 12345 in
167+
the issue tracker. When this change is eventually applied, the issue tracker
168+
will automatically mark the issue as fixed. If the change is a partial step
169+
towards the resolution of the issue, write "For \#12345" instead. This will
170+
leave a comment in the issue linking back to the pull request, but it will not
171+
close the issue when the change is applied. Please don’t use alternate
172+
GitHub-supported aliases like Close or Resolves instead of Fixes.
173+
174+
## The review process
175+
176+
This section explains the review process in detail and how to approach reviews
177+
after a pull request has been sent for review.
178+
179+
### Getting a code review
180+
181+
Before creating a pull request, make sure that your commit message follows the
182+
suggested format. Otherwise, it can be common for the pull request to be sent
183+
back with that request without review. After creating a pull request, request
184+
a specific reviewer if relevant, or leave it for the default group.
185+
186+
### Merging a pull request
187+
188+
Pull request titles and descriptions must follow the
189+
[commit messages](#commit-messages)
190+
conventions. This enables approvers to review the final commit message. Once
191+
the pull request has been approved and all checks have passed, click the
192+
[Squash and Merge](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits)
193+
button. The resulting commit message will be based on the pull request's title
194+
and description.
195+
196+
### Reverting a pull request
197+
198+
If a merged pull request needs to be undone, for reasons such as breaking the build, the standard process is to
199+
[revert it through the GitHub interface](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/reverting-a-pull-request).
200+
201+
To revert a pull request:
202+
- Navigate to the merged pull request on GitHub.
203+
- Click the Revert button. This action automatically creates a new branch and a
204+
pull request containing the revert commit.
205+
- Edit the pull request title and description to comply with the
206+
[commit message guidelines](#commit-messages).
207+
- The newly created revert pull request should be reviewed and merged following
208+
the same process as any other pull request.
209+
210+
Using the GitHub "Revert" button is the preferred method over manually creating
211+
a revert commit using git revert.
212+
213+
### Keeping the pull request dashboard clean
214+
215+
We aim to keep the pull requests page clean so that we can quickly notice and
216+
review incoming changes that require attention. Given that goal, please do not
217+
open a pull request unless you are ready for a code review. Draft pull requests
218+
and ones without author activity for more than one business day may be closed
219+
(they can always be reopened later). If you're still working on something,
220+
continue iterating on your branch without creating a pull request until it’s
221+
ready for review.
222+
223+
### Addressing code review comments
224+
225+
Creating additional commits to address reviewer feedback is generally preferred
226+
over amending and force-pushing. This makes it easier for reviewers to see what
227+
has changed since their last review. Pull requests are always squashed and
228+
merged. Before merging, please review and edit the resulting commit message to
229+
ensure it clearly describes the change.
230+
231+
After pushing,
232+
[click the
233+
button](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review#requesting-reviews-from-collaborators-and-organization-members)
234+
to ask a reviewer to re-request your review.
235+
236+
## Expectations for the team
237+
238+
A lot of our communication will happen on GitHub issues. Team members are
239+
expected to configure their inboxes to receive GitHub notifications alerts for
240+
all issues and pull requests to ensure effective communication. If a pull
241+
request becomes inactive or misaligned with current priorities, we may close it
242+
to respect contributor and reviewer time. If you’d like to revisit it, just
243+
comment and reopen the conversation. If your pull request or issue is stuck,
244+
feel free to follow up over chat. We encourage it!
245+
246+
### Reviewing a pull request
247+
248+
When reviewing a pull request:
249+
- Start by reading the PR description to understand the purpose and context. If
250+
the commit message doesn’t follow the
251+
[commit message guidelines](#commit-messages),
252+
request changes.
253+
- Use Approve or Request changes explicitly. Avoid leaving ambiguous feedback.
254+
- Focus on what is in scope. If unrelated issues arise, suggest filing a
255+
separate PR or issue.
256+
- If you’ve requested changes, approve the PR once the updates are
257+
satisfactory, even if the author forgot to click the re-request review.
258+
- If a review has stalled or the context has shifted, leave a comment to
259+
clarify expectations, or close the PR. Keeping the dashboard clean is
260+
encouraged.
261+
262+
### Addressing Urgent Issues
263+
264+
We categorize issues into two primary levels of urgency:
265+
- critical 🚨: requires immediate fix, should be treated as a p0 issue
266+
- needs fix soon ❗: high priority issue, can be fixed during business hours
267+
268+
When an issue is labeled critical 🚨, the priority is to stabilize the system
269+
enough to downgrade the severity to needs fix soon ❗.
270+
271+
### Maintaining a Healthy Main Branch
272+
273+
All pull requests require passing CI checks to be merged.
274+
275+
The main branch must always be stable, and tests should never fail at HEAD. A
276+
red build on the main branch is a critical issue that must be fixed
277+
immediately. If tests become flaky or the main branch is not consistently
278+
green, the team's top priority should shift to restoring stability. All feature
279+
development should be deprioritized until green builds can be guaranteed. When
280+
you see a red x next to a commit on main, file an issue on your GitHub issue
281+
tracker, and label it critical 🚨. Create a PR to temporarily skip the test,
282+
and verify that you have a green checkmark next to the commit on your main
283+
branch. The issue can now be downgraded to needs fix soon ❗.
284+
285+
## Repository Structure
9286

10-
Repository Structure
11-
--------------------
12287
* `google-cloud-java` (`/pom.xml`)
13288
* The root aggregator POM that lists all of the modules.
14289
* Does not get released.
@@ -24,12 +299,11 @@ Repository Structure
24299
* `gapic-libraries-bom`
25300
* A BOM for all non-preview libraries in the monorepo.
26301
* `java-*`
27-
* Individual client libraries.
302+
* Individual client libraries.
28303

29-
Using maven for build/test
30-
--------------------------
304+
## Using maven for build/test
31305

32-
To run the tests, you must have application default credentials in a JSON file on your development machine.
306+
To run the tests, you must have application default credentials in a JSON file on your development machine.
33307
[Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts)
34308
in the cloud console and download they key to a secure location on your development box.
35309
Then set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the location of the JSON file.
@@ -45,7 +319,7 @@ Integration tests run tests against real services and take a long time to run.
45319
Consider `mvn install -DskipITs` to skip them when installing.
46320
Maven 3.0+ is required.
47321

48-
It's also important to test that changes don't break compatibility with App/Compute Engine and when running elsewhere.
322+
It's also important to test that changes don't break compatibility with App/Compute Engine and when running elsewhere.
49323
To run tests on different platforms, try deploying the apps available on the [google-cloud-examples](https://github.com/googleapis/google-cloud-examples) repository.
50324
End-to-end tests should ensure that google-cloud-java works when running on the
51325

@@ -60,44 +334,22 @@ Known issue: If you have installed the Google Cloud SDK, be sure to log in (usin
60334

61335
**Please, do not use your production projects for executing integration tests.** While we do our best to make our tests independent of your project's state and content, they do perform create, modify and deletes, and you do not want to have your production data accidentally modified.
62336

63-
Adding Features
64-
---------------
337+
## Adding Features
338+
65339
In order to add a feature to google-cloud-java:
66340

67341
The feature must be fully documented using Javadoc and examples should be provided.
68342
The feature must work fully on Java 7 and above.
69343
The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective,
70344
but new dependencies should be discussed).
71345

72-
Adding Support for a New Service
73-
--------------------------------
346+
## Adding Support for a New Service
347+
74348
See [SUPPORTING_NEW_SERVICES](./SUPPORTING_NEW_SERVICES.md) for guidelines on how to add support for a new Google Cloud service to `google-cloud-java`.
75349

76-
Coding Style
77-
------------
350+
## Coding Style
351+
78352
Maintain the coding style in the project and in particular the modified files.
79353
Follow the Google Java [style](https://google.github.io/styleguide/javaguide.html).
80354

81355
In pull requests, please run `mvn com.spotify.fmt:fmt-maven-plugin:format` to format your code diff.
82-
83-
## Contributor License Agreements
84-
85-
Before we can accept your pull requests you'll need to sign a Contributor
86-
License Agreement (CLA):
87-
88-
- **If you are an individual writing original source code** and **you own the intellectual property**,
89-
then you'll need to sign an [individual CLA][indvcla].
90-
- **If you work for a company that wants to allow you to contribute your work**,
91-
then you'll need to sign a [corporate CLA][corpcla].
92-
93-
You can sign these electronically (just scroll to the bottom). After that,
94-
we'll be able to accept your pull requests.
95-
96-
## Code of Conduct
97-
98-
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information.
99-
100-
[gcloudcli]: https://developers.google.com/cloud/sdk/gcloud/
101-
[indvcla]: https://developers.google.com/open-source/cla/individual
102-
[corpcla]: https://developers.google.com/open-source/cla/corporate
103-
[code-of-conduct]:https://github.com/googleapis/google-cloud-java/blob/master/CODE_OF_CONDUCT.md

0 commit comments

Comments
 (0)