Skip to content

Commit

Permalink
Add contribution guide for CPS flink connector (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-kwong authored Jun 10, 2024
1 parent 116046e commit 3865990
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 6 deletions.
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ Want to contribute? Great! First, read this page (including the small print at t

### Before you contribute
Before we can use your code, you must sign the
[Google Individual Contributor License Agreement]
(https://cla.developers.google.com/about/google-individual)
[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
(CLA), which you can do online. The CLA is necessary mainly because you own the
copyright to your changes, even after your contribution becomes part of our
codebase, so we need your permission to use and distribute your code. We also
Expand All @@ -16,12 +15,15 @@ us first through the issue tracker with your idea so that we can help out and
possibly guide you. Coordinating up front makes it much easier to avoid
frustration later on.

### Review Our Community Guidelines
This project follows
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).

### Code reviews
All submissions, including submissions by project members, require review. We
use Github pull requests for this purpose.

### The small print
Contributions made by corporations are covered by a different agreement than
the one above, the
[Software Grant and Corporate Contributor License Agreement]
(https://cla.developers.google.com/about/google-corporate).
[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
101 changes: 101 additions & 0 deletions flink-connector/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# How to Contribute

We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Before You Begin

Please review the repo-level
[CONTRIBUTING](https://github.com/GoogleCloudPlatform/pubsub/blob/master/CONTRIBUTING.md)
for legal requirements and our community guidelines. The rest of this page
describes the contribution process for the `flink-connector` project.

## Contribution Process

### Discuss Your Changes (optional)

Before you start working on a contribution, consider getting in touch with us
first by
[creating an issue](https://github.com/GoogleCloudPlatform/pubsub/issues/new)
with the label "flink connector" to discuss your idea. This is especially
important for large, significant, or speculative changes. Starting a discussion
and getting consensus up front can avoid a lot of frustration during code
review.

### Building and Running Tests

Build, package, and run tests.

```sh
mvn clean verify

# Skip integration tests.
mvn clean verify -pl '!flink-connector-gcp-pubsub-e2e-tests'
```

Run integration and unit tests.

```sh
mvn clean test
```

Run only unit tests.

```sh
mvn clean test -pl '!flink-connector-gcp-pubsub-e2e-tests'
```

#### Running Integration Tests

Integration tests connect to a local instance of the
[Cloud Pub/Sub emulator](https://cloud.google.com/pubsub/docs/emulator). By
default, integration tests start a test container that hosts the emulator. The
container is cleaned up after the test finishes.

In addition to connecting to test containers, integration tests can connect to
emulators started outside of the test process. If the environment variable
`PUBSUB_EMULATOR_HOST` is set, integration tests skip starting a test container
and try to connect to the specified endpoint.

Start a Cloud Pub/Sub emulator.

```sh
# The emulator listens on port 8085 by default.
gcloud beta emulators pubsub start
```

Run integration tests against the local emulator.

```sh
PUBSUB_EMULATOR_HOST=localhost:8085 mvn test
```

### Code Reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

These guidelines will help get your contributions merged smoothly and quickly.

- Create **small PRs** that are narrowly focused on **addressing a single
concern**. Create more PRs to address different concerns.

- Features and behavior changes should generally include builder options that
allow other connector users to disable them. These type of changes should be
disabled by default, unless there is a compelling reason to enable these by
default.

- Provide a good **PR description** as a record of **what** change is being
made and **why** it was made. Link to a GitHub issue if it exists.

- If you are adding a new file, make sure it has the copyright message
template at the top as a comment. You can copy over the message from an
existing file and update the year.

- Maintain **clean commit history** and use **meaningful commit messages**.
PRs with messy commit history are difficult to review. Push changes that
address PR review feedback as a separate or multiple commits (avoid vague
messages like `addressed pr feedback`). Commits will be squashed into one
when merging PRs.
18 changes: 16 additions & 2 deletions flink-connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Learn more about Flink at [https://flink.apache.org/](https://flink.apache.org/)

## Using the Connector

We are in the process of uploading the connector to a public respository. In the
We are in the process of uploading the connector to a public repository. In the
meantime, you can build the connector JAR file from source to be packaged with
your Flink deployment.

Expand Down Expand Up @@ -137,7 +137,7 @@ data flows through Pub/Sub and the example Flink job as expected.
Flink job successfully used Pub/Sub as both a source and sink

The following commands set variables for your GCP project name, Pub/Sub topic
names, and Pub/Sub subcription names. These variables are referenced in this
names, and Pub/Sub subscription names. These variables are referenced in this
section's commands. The placeholder value for `PROJECT_NAME` must be updated to
your GCP project name. The other placeholder values can be used as is or updated
to your liking.
Expand Down Expand Up @@ -276,3 +276,17 @@ Stop the example Flink job.
```sh
flink cancel {Flink JobID output when it started}
```

## Contributing

Contributions to this library are always welcome and highly encouraged.

See
[CONTRIBUTING](https://github.com/GoogleCloudPlatform/pubsub/blob/master/flink-connector/CONTRIBUTING.md)
for more information on how to get started.

## License

Apache 2.0 - See
[LICENSE](https://github.com/GoogleCloudPlatform/pubsub/blob/master/LICENSE) for
more information.

0 comments on commit 3865990

Please sign in to comment.