2020-08-26 14:06:21 +00:00
# Contributing to Pinniped
2022-07-25 19:07:18 +00:00
Pinniped is better because of our contributors and [maintainers ](MAINTAINERS.md ). It is because of you that we can bring
great software to the community.
2020-08-27 17:14:03 +00:00
Contributions to Pinniped are welcome. Here are some things to help you get started.
2020-08-26 14:06:21 +00:00
2020-10-14 16:54:09 +00:00
## Code of Conduct
Please see the [Code of Conduct ](./CODE_OF_CONDUCT.md ).
## Project Scope
2021-02-18 16:10:35 +00:00
See [SCOPE.md ](./SCOPE.md ) for some guidelines about what we consider in and out of scope for Pinniped.
2020-08-26 14:06:21 +00:00
2021-08-27 22:52:51 +00:00
## Roadmap
The near-term and mid-term roadmap for the work planned for the project [maintainers ](MAINTAINERS.md ) is documented in [ROADMAP.md ](ROADMAP.md ).
2020-10-14 16:54:09 +00:00
## Discussion
2021-08-27 22:52:51 +00:00
Got a question, comment, or idea? Please don't hesitate to reach out
via GitHub [Discussions ](https://github.com/vmware-tanzu/pinniped/discussions ),
GitHub [Issues ](https://github.com/vmware-tanzu/pinniped/issues ),
2022-07-25 19:07:18 +00:00
or in the Kubernetes Slack Workspace within the [#pinniped channel ](https://go.pinniped.dev/community/slack ).
Join our [Google Group ](https://go.pinniped.dev/community/group ) to receive updates and meeting invitations.
2020-10-14 16:54:09 +00:00
## Issues
Need an idea for a project to get started contributing? Take a look at the open
[issues ](https://github.com/vmware-tanzu/pinniped/issues ).
Also check to see if any open issues are labeled with
["good first issue" ](https://github.com/vmware-tanzu/pinniped/labels/good%20first%20issue )
or ["help wanted" ](https://github.com/vmware-tanzu/pinniped/labels/help%20wanted ).
### Bugs
2020-08-26 14:06:21 +00:00
To file a bug report, please first open an
2020-09-17 17:56:54 +00:00
[issue ](https://github.com/vmware-tanzu/pinniped/issues/new?template=bug_report.md ). The project team
2020-08-26 14:06:21 +00:00
will work with you on your bug report.
2020-09-17 17:56:54 +00:00
Once the bug has been validated, a [pull request ](https://github.com/vmware-tanzu/pinniped/compare )
2020-08-27 17:14:03 +00:00
can be opened to fix the bug.
2020-08-26 14:06:21 +00:00
For specifics on what to include in your bug report, please follow the
2020-08-27 17:14:03 +00:00
guidelines in the issue and pull request templates.
2020-08-26 14:06:21 +00:00
2020-10-14 16:54:09 +00:00
### Features
2020-08-26 14:06:21 +00:00
To suggest a feature, please first open an
2020-09-17 17:56:54 +00:00
[issue ](https://github.com/vmware-tanzu/pinniped/issues/new?template=feature-proposal.md )
2020-10-14 16:54:09 +00:00
and tag it with `proposal` , or create a new [Discussion ](https://github.com/vmware-tanzu/pinniped/discussions ).
2021-08-27 22:52:51 +00:00
The project [maintainers ](MAINTAINERS.md ) will work with you on your feature request.
2020-08-26 14:06:21 +00:00
2020-09-17 17:56:54 +00:00
Once the feature request has been validated, a [pull request ](https://github.com/vmware-tanzu/pinniped/compare )
2020-08-27 17:14:03 +00:00
can be opened to implement the feature.
2020-08-26 14:06:21 +00:00
For specifics on what to include in your feature request, please follow the
2020-08-27 17:14:03 +00:00
guidelines in the issue and pull request templates.
2020-08-26 14:06:21 +00:00
2021-08-27 22:52:51 +00:00
### Reporting security vulnerabilities
Please follow the procedure described in [SECURITY.md ](SECURITY.md ).
2020-09-22 19:15:14 +00:00
## CLA
2022-02-16 00:45:49 +00:00
We welcome contributions from everyone, but we can only accept them if you sign
2020-09-22 19:15:14 +00:00
our Contributor License Agreement (CLA). If you would like to contribute and you
have not signed it, our CLA-bot will walk you through the process when you open
a Pull Request. For questions about the CLA process, see the
[FAQ ](https://cla.vmware.com/faq ) or submit a question through the GitHub issue
tracker.
2022-03-18 21:27:33 +00:00
## Learning about Pinniped
New to Pinniped?
- Start here to learn how to install and use Pinniped: [Learn to use Pinniped for federated authentication to Kubernetes clusters ](https://pinniped.dev/docs/tutorials/concierge-and-supervisor-demo/ )
- Start here to learn how to navigate the source code: [Code Walk-through ](https://pinniped.dev/docs/reference/code-walkthrough/ )
- Other more detailed documentation can be found at: [Pinniped Docs ](https://pinniped.dev/docs/ )
2020-08-26 14:06:21 +00:00
## Building
2020-10-02 20:00:23 +00:00
The [Dockerfile ](Dockerfile ) at the root of the repo can be used to build and
2022-02-15 19:19:49 +00:00
package the server-side code. After making a change to the code, rebuild the
docker image with the following command.
2020-08-26 14:06:21 +00:00
2020-08-27 17:14:03 +00:00
```bash
# From the root directory of the repo...
2020-08-26 14:06:21 +00:00
docker build .
```
2022-02-15 19:19:49 +00:00
The Pinniped CLI client can be built for local use with the following command.
```bash
# From the root directory of the repo...
go build -o pinniped ./cmd/pinniped
```
2020-08-26 14:06:21 +00:00
## Testing
### Running Lint
2020-08-27 17:14:03 +00:00
```bash
2020-08-26 14:06:21 +00:00
./hack/module.sh lint
```
### Running Unit Tests
2020-08-27 17:14:03 +00:00
```bash
2020-09-11 15:43:53 +00:00
./hack/module.sh units
2020-08-26 14:06:21 +00:00
```
### Running Integration Tests
2020-09-08 16:29:34 +00:00
1. Install dependencies:
2020-12-17 18:59:23 +00:00
- [`docker` ](https://www.docker.com/ )
- `htpasswd` (installed by default on MacOS, usually found in `apache2-utils` package for linux)
- [`kapp` ](https://carvel.dev/#getting-started )
2020-09-08 16:29:34 +00:00
- [`kind` ](https://kind.sigs.k8s.io/docs/user/quick-start )
2020-12-17 18:59:23 +00:00
- [`kubectl` ](https://kubernetes.io/docs/tasks/tools/install-kubectl/ )
2020-09-08 16:29:34 +00:00
- [`ytt` ](https://carvel.dev/#getting-started )
2021-10-20 11:59:24 +00:00
- [`nmap` ](https://nmap.org/download.html )
2023-08-01 16:04:21 +00:00
- [`openssl` ](https://www.openssl.org ) (installed by default on MacOS)
- [Chrome ](https://www.google.com/chrome/ )
2020-09-08 16:29:34 +00:00
2020-10-13 21:09:13 +00:00
On macOS, these tools can be installed with [Homebrew ](https://brew.sh/ ) (assuming you have Chrome installed already):
2020-09-08 16:29:34 +00:00
```bash
2023-08-01 16:04:21 +00:00
brew install kind vmware-tanzu/carvel/ytt vmware-tanzu/carvel/kapp kubectl nmap & & brew cask install docker
2020-09-08 16:29:34 +00:00
```
2022-02-15 19:19:49 +00:00
1. Create a kind cluster, compile, create container images, and install Pinniped and supporting test dependencies using:
2020-09-08 16:29:34 +00:00
```bash
2021-03-03 20:06:44 +00:00
./hack/prepare-for-integration-tests.sh
2020-09-08 16:29:34 +00:00
```
1. Run the Pinniped integration tests:
```bash
2022-03-18 21:27:33 +00:00
ulimit -n 512 & & source /tmp/integration-test-env & & go test -v -count 1 -timeout 0 ./test/integration
2020-09-08 16:29:34 +00:00
```
2020-09-11 14:29:21 +00:00
2022-03-21 16:33:26 +00:00
To run specific integration tests, add the `-run` flag to the above command to specify a regexp for the test names.
Use a leading `/` on the regexp because the Pinniped integration tests are automatically nested under several parent tests
(see [integration/main_test.go ](https://github.com/vmware-tanzu/pinniped/blob/main/test/integration/main_test.go )).
For example, to run an integration test called `TestE2E` , add `-run /TestE2E` to the command shown above.
2021-03-03 20:06:44 +00:00
1. After making production code changes, recompile, redeploy, and run tests again by repeating the same
commands described above. If there are only test code changes, then simply run the tests again.
2020-10-09 21:25:34 +00:00
To destroy the local Kubernetes cluster, run `./hack/kind-down.sh` .
2020-08-26 14:06:21 +00:00
2020-09-16 00:59:40 +00:00
### Observing Tests on the Continuous Integration Environment
2020-10-14 16:54:09 +00:00
[CI ](https://hush-house.pivotal.io/teams/tanzu-user-auth/pipelines/pinniped-pull-requests )
will not be triggered on a pull request until the pull request is reviewed and
2020-10-02 20:00:23 +00:00
approved for CI by a project [maintainer ](MAINTAINERS.md ). Once CI is triggered,
2020-09-16 00:59:40 +00:00
the progress and results will appear on the Github page for that
2020-09-17 17:56:54 +00:00
[pull request ](https://github.com/vmware-tanzu/pinniped/pulls ) as checks. Links
2020-09-16 00:59:40 +00:00
will appear to view the details of each check.
## Documentation
Any pull request which adds a new feature or changes the behavior of any feature which was previously documented
should include updates to the documentation. All documentation lives in this repository. This project aspires to
follow the Kubernetes [documentation style guide ](https://kubernetes.io/docs/contribute/style/style-guide ).
## Pre-commit Hooks
2020-08-26 14:06:21 +00:00
2020-08-27 17:14:03 +00:00
This project uses [pre-commit ](https://pre-commit.com/ ) to agree on some conventions about whitespace/file encoding.
2020-08-26 14:06:21 +00:00
2020-08-27 17:14:03 +00:00
```bash
2020-08-26 14:06:21 +00:00
$ brew install pre-commit
[...]
$ pre-commit install
pre-commit installed at .git/hooks/pre-commit
```
2020-09-16 00:59:40 +00:00
## Becoming a Pinniped Maintainer
Regular contributors who are active in the Pinniped community and who have contributed at least several
significant pull requests may be considered for promotion to become a maintainer upon request. Please
2020-10-02 20:00:23 +00:00
contact an existing [maintainer ](MAINTAINERS.md ) if you would like to be considered.