From 394526a5ff416f5c89d61d845719ff9d9563f72a Mon Sep 17 00:00:00 2001 From: Miaha <143584635+MiahaCybersec@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:17:35 -0600 Subject: [PATCH] docs: update contributor docs (#633) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miaha Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com> --- CONTRIBUTING.md | 26 ++- website/docs/code-of-conduct.md | 155 ++++++------------ website/docs/contributing.md | 38 ++--- website/docs/faq.md | 4 + website/docs/maintainer-guidelines.md | 2 +- .../version-v0.6.x/maintainer-guidelines.md | 2 +- 6 files changed, 93 insertions(+), 134 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index faf61d81..047babba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,9 +19,24 @@ When opening an issue, please select the most appropriate template for what you' ### Getting Started -Follow the instructions to [setup your dev environment to build copa](./docs/tutorials/dev-setup.md). +Follow the instructions to set up your dev environment to build Copacetic. -For an overview of the project components, refer to the [copa design](./docs/vulnerability-driven-patching.md) document. +For an overview of the project components, refer to the [Copa design](./website/docs/design.md) document. + +### IDE Setup + +Copacetic is written in Go, so any IDE that supports Go may be used. If you have an IDE you prefer, simply search for a guide to set it up with Go. If you don't have a preferred IDE or if you're a new developer, some popular options are listed below: + +* [GoLand](https://www.jetbrains.com/help/go/quick-start-guide-goland.html) +* [VSCode](https://code.visualstudio.com/docs/languages/go) +* [Vim](https://github.com/fatih/vim-go) +* [Zed](https://zed.dev/docs/languages/go) + +After choosing your IDE, we should install [gofumpt](https://github.com/mvdan/gofumpt). It's a stricter formatter than `gofmt` which Copacetic requires to pass all tests. Once installed, you may optionally set it up to run in your IDE of choice by following the instructions about halfway down the page. + +### Docker Setup + +Copacetic requires Docker for patching images. To install Docker, follow the [Docker installation guide](https://docs.docker.com/engine/install/). ### Tests @@ -29,6 +44,7 @@ Once you can successfully `make` the project, any code contributions should also * Pass unit tests via `make test`. * Lint cleanly via `make lint`. +* Be formatted with `gofumpt`. Pull requests will also be expected to pass the PR functional tests specified by `.github/workflows/build.yml`. @@ -43,7 +59,7 @@ If you'd like to start contributing code to the project, you can search for [iss For any changes that may involve significant refactoring or development effort, we suggest that you file an issue to discuss the proposal with the maintainers first as it is unlikely that we will accept large PRs without prior discussion that have: -* Architectural changes (e.g. breaking interfaces or violations of [this project's design tenets](./docs/vulnerability-driven-patching.md#design-tenets)). +* Architectural changes (e.g. breaking interfaces or violations of [this project's design tenets](./website/docs/design.md#design-tenets)). * Unsolicited features that significantly expand the functional scope of the tool. Pull requests should be submitted from your fork of the project with the PR template filled out. This project uses the [Angular commit message format](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format) for automated changelog generation, so it's helpful to be familiar with it as the maintainers will need to ensure adherence to it on accepting PRs. @@ -118,6 +134,4 @@ git push --force-with-lease ## Code of Conduct -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +This project has adopted the [CNCF Code of Conduct](./CODE_OF_CONDUCT) \ No newline at end of file diff --git a/website/docs/code-of-conduct.md b/website/docs/code-of-conduct.md index 1c886abf..b8c925e0 100644 --- a/website/docs/code-of-conduct.md +++ b/website/docs/code-of-conduct.md @@ -2,135 +2,86 @@ title: Code of Conduct --- -# Contributor Covenant Code of Conduct +# CNCF Community Code of Conduct v1.3 -## Our Pledge +### Community Code of Conduct -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, caste, color, religion, or sexual -identity and orientation. +As contributors, maintainers, and participants in the CNCF community, and in the interest of fostering +an open and welcoming community, we pledge to respect all people who participate or contribute +through reporting issues, posting feature requests, updating documentation, +submitting pull requests or patches, attending conferences or events, or engaging in other community or project activities. -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. +We are committed to making participation in the CNCF community a harassment-free experience for everyone, regardless of age, body size, caste, disability, ethnicity, level of experience, family status, gender, gender identity and expression, marital status, military or veteran status, nationality, personal appearance, race, religion, sexual orientation, socioeconomic status, tribe, or any other dimension of diversity. + +## Scope + +This code of conduct applies: +* within project and community spaces, +* in other spaces when an individual CNCF community participant's words or actions are directed at or are about a CNCF project, the CNCF community, or another CNCF community participant. + +### CNCF Events + +CNCF events that are produced by the Linux Foundation with professional events staff are governed by the Linux Foundation [Events Code of Conduct](https://events.linuxfoundation.org/code-of-conduct/) available on the event page. This is designed to be used in conjunction with the CNCF Code of Conduct. ## Our Standards -Examples of behavior that contributes to a positive environment for our -community include: +The CNCF Community is open, inclusive and respectful. Every member of our community has the right to have their identity respected. + +Examples of behavior that contributes to a positive environment include but are not limited to: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall - community +* Focusing on what is best not just for us as individuals, but for the + overall community +* Using welcoming and inclusive language -Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or advances of - any kind +Examples of unacceptable behavior include but are not limited to: + +* The use of sexualized language or imagery * Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, - without their explicit permission +* Public or private harassment in any form +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Violence, threatening violence, or encouraging others to engage in violent behavior +* Stalking or following someone without their consent +* Unwelcome physical contact +* Unwelcome sexual or romantic attention or advances * Other conduct which could reasonably be considered inappropriate in a professional setting -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. +The following behaviors are also prohibited: +* Providing knowingly false or misleading information in connection with a Code of Conduct investigation or otherwise intentionally tampering with an investigation. +* Retaliating against a person because they reported an incident or provided information about an incident as a witness. -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -`project-copacetic@googlegroups.com`. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect +of managing a CNCF project. +Project maintainers who do not follow or enforce the Code of Conduct may be temporarily or permanently removed from the project team. -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. +## Reporting -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. +For incidents occurring in the Kubernetes community, contact the [Kubernetes Code of Conduct Committee](https://git.k8s.io/community/committee-code-of-conduct) via [conduct@kubernetes.io](mailto:conduct@kubernetes.io). You can expect a response within three business days. -### 2. Warning +For other projects, or for incidents that are project-agnostic or impact multiple CNCF projects, please contact the [CNCF Code of Conduct Committee](https://www.cncf.io/conduct/committee/) via [conduct@cncf.io](mailto:conduct@cncf.io). Alternatively, you can contact any of the individual members of the [CNCF Code of Conduct Committee](https://www.cncf.io/conduct/committee/) to submit your report. For more detailed instructions on how to submit a report, including how to submit a report anonymously, please see our [Incident Resolution Procedures](https://github.com/cncf/foundation/blob/main/code-of-conduct/coc-incident-resolution-procedures.md). You can expect a response within three business days. -**Community Impact**: A violation through a single incident or series of -actions. +For incidents occurring at CNCF event that is produced by the Linux Foundation, please contact [eventconduct@cncf.io](mailto:eventconduct@cncf.io). -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or permanent -ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. +## Enforcement -**Consequence**: A permanent ban from any sort of public interaction within the -community. +Upon review and investigation of a reported incident, the CoC response team that has jurisdiction will determine what action is appropriate based on this Code of Conduct and its related documentation. -## Attribution +For information about which Code of Conduct incidents are handled by project leadership, which incidents are handled by the CNCF Code of Conduct Committee, and which incidents are handled by the Linux Foundation (including its events team), see our [Jurisdiction Policy](https://github.com/cncf/foundation/blob/main/code-of-conduct/coc-committee-jurisdiction-policy.md). -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.1, available at -[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. +## Amendments -Community Impact Guidelines were inspired by -[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. +Consistent with the CNCF Charter, any substantive changes to this Code of Conduct must be approved by the Technical Oversight Committee. -For answers to common questions about this code of conduct, see the FAQ at -[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at -[https://www.contributor-covenant.org/translations][translations]. +## Acknowledgements -[homepage]: https://www.contributor-covenant.org -[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html -[Mozilla CoC]: https://github.com/mozilla/diversity -[FAQ]: https://www.contributor-covenant.org/faq -[translations]: https://www.contributor-covenant.org/translations +This Code of Conduct is adapted from the Contributor Covenant +(http://contributor-covenant.org), version 2.0 available at +http://contributor-covenant.org/version/2/0/code_of_conduct/ \ No newline at end of file diff --git a/website/docs/contributing.md b/website/docs/contributing.md index 356353bf..c0ec4b00 100644 --- a/website/docs/contributing.md +++ b/website/docs/contributing.md @@ -25,35 +25,24 @@ When opening an issue, please select the most appropriate template for what you' ### Getting Started -Follow the instructions to either: +Follow the instructions to set up your dev environment to build Copacetic. -* [Setup your dev environment to build copa](./installation.md). -* [Use the copa development container](#visual-studio-code-development-container) in [Visual Studio Code](https://code.visualstudio.com/). +For an overview of the project components, refer to the [Copa design](./design.md) document. -For an overview of the project components, refer to the [copa design](./design.md) document. +### IDE Setup -### Visual Studio Code Development Container +Copacetic is written in Go, so any IDE that supports Go may be used. If you have an IDE you prefer, simply search for a guide to set it up with Go. If you don't have a preferred IDE or if you're a new developer, some popular options are listed below: -[VSCode](https://code.visualstudio.com/) supports development in a containerized environment through its [Remote - Container extension](https://code.visualstudio.com/docs/remote/containers). This folder provides a development container which encapsulates the dependencies specified in the [instructions to build and run copa](./installation.md). +* [GoLand](https://www.jetbrains.com/help/go/quick-start-guide-goland.html) +* [VSCode](https://code.visualstudio.com/docs/languages/go) +* [Vim](https://github.com/fatih/vim-go) +* [Zed](https://zed.dev/docs/languages/go) -#### Prerequisites +After choosing your IDE, we should install [gofumpt](https://github.com/mvdan/gofumpt). It's a stricter formatter than `gofmt` which Copacetic requires to pass all tests. Once installed, you may optionally set it up to run in your IDE of choice by following the instructions about halfway down the page. -1. [Docker](https://docs.docker.com/get-docker/) - > For Windows users, enabling [WSL2 back-end integration with Docker](https://docs.docker.com/docker-for-windows/wsl/) is recommended. -2. [Visual Studio Code](https://code.visualstudio.com/) -3. [Visual Studio Code Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) +### Docker Setup -> **⚠ If running via Docker Desktop for Windows** -> -> Note that the [mounted workspace files appear owned by `root`](https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user) in the dev container, which will cause `git` commands to fail with a `fatal: detected dubious ownership in a repository` error due to [safe.directory](https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory) checks. This can be addressed by changing the mapped ownership of the workspace files in the dev container to the `vscode` user: -> -> ```bash -> sudo chown -R vscode:vscode /workspace/copacetic -> ``` - -#### Personalizing user settings in a dev container - -VSCode supports applying your user settings, such as your `.gitconfig`, to a dev container through the use of [dotfiles repositories](https://code.visualstudio.com/docs/remote/containers#_personalizing-with-dotfile-repositories). This can be done through your own VSCode `settings.json` file without changing the dev container image or configuration. +Copacetic requires Docker for patching images. To install Docker, follow the [Docker installation guide](https://docs.docker.com/engine/install/). ### Tests @@ -61,6 +50,7 @@ Once you can successfully `make` the project, any code contributions should also * Pass unit tests via `make test`. * Lint cleanly via `make lint`. +* Be formatted with `gofumpt`. Pull requests will also be expected to pass the PR functional tests specified by `.github/workflows/build.yml`. @@ -75,7 +65,7 @@ If you'd like to start contributing code to the project, you can search for [iss For any changes that may involve significant refactoring or development effort, we suggest that you file an issue to discuss the proposal with the maintainers first as it is unlikely that we will accept large PRs without prior discussion that have: -* Architectural changes (e.g. breaking interfaces or violations of [this project's design tenets](./design.md)). +* Architectural changes (e.g. breaking interfaces or violations of [this project's design tenets](./design.md#design-tenets)). * Unsolicited features that significantly expand the functional scope of the tool. Pull requests should be submitted from your fork of the project with the PR template filled out. This project uses the [Angular commit message format](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format) for automated changelog generation, so it's helpful to be familiar with it as the maintainers will need to ensure adherence to it on accepting PRs. @@ -150,4 +140,4 @@ git push --force-with-lease ## Code of Conduct -This project has adopted the [Contributor Covenant Code of Conduct](./code-of-conduct.md). \ No newline at end of file +This project has adopted the [CNCF Code of Conduct](./code-of-conduct.md) \ No newline at end of file diff --git a/website/docs/faq.md b/website/docs/faq.md index f690b6e2..9beafcd4 100644 --- a/website/docs/faq.md +++ b/website/docs/faq.md @@ -13,6 +13,10 @@ Copa is not capable of patching vulnerabilities for compiled languages, like Go, To patch vulnerabilities for applications, you can package these applications and consume them from package repositories, like `http://archive.ubuntu.com/ubuntu/` for Ubuntu, and ensure Trivy can scan and report vulnerabilities for these packages. This way, Copa can patch the applications as a whole, though it cannot patch specific modules within the applications. +## My disk space is being filled up after using Copa. How can I fix this? + +If you find that your storage is rapidly being taken up after working with Copa, run `docker system prune`. This will prune all unused images, containers and caches. + ## Can I replace the package repositories in the image with my own? :::caution diff --git a/website/docs/maintainer-guidelines.md b/website/docs/maintainer-guidelines.md index 0f5183fe..a9ed5864 100644 --- a/website/docs/maintainer-guidelines.md +++ b/website/docs/maintainer-guidelines.md @@ -14,7 +14,7 @@ This project uses [go-semantic-release](https://github.com/go-semantic-release/s For contributor PRs, instead of trying to ensure adherence in every commit message, it's easiest to adopt a [squash and merge](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests) strategy so that the PR description is used as the final commit description with the appropriate semantic release format. -In addition to the semantic release types called out in the [contributor pull request guidelines](../CONTRIBUTING.md#pull-requests), there are several other categories supported by the [default changelog generator](https://github.com/go-semantic-release/changelog-generator-default) that maintainers should be aware of: +In addition to the semantic release types called out in the [contributor pull request guidelines](./contributing.md#pull-requests), there are several other categories supported by the [default changelog generator](https://github.com/go-semantic-release/changelog-generator-default) that maintainers should be aware of: - **chore:** Reserved for automated maintenance changes, such as minor version go dependency updates initiated by Dependabot. - **revert:** Maintainers should use this to mark commits that revert a previous commit, followed by the header of the reverted commit. The message body should include the SHA of the reverted commit, as well as a clear description of the reason for the revert. diff --git a/website/versioned_docs/version-v0.6.x/maintainer-guidelines.md b/website/versioned_docs/version-v0.6.x/maintainer-guidelines.md index 0f5183fe..a9ed5864 100644 --- a/website/versioned_docs/version-v0.6.x/maintainer-guidelines.md +++ b/website/versioned_docs/version-v0.6.x/maintainer-guidelines.md @@ -14,7 +14,7 @@ This project uses [go-semantic-release](https://github.com/go-semantic-release/s For contributor PRs, instead of trying to ensure adherence in every commit message, it's easiest to adopt a [squash and merge](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests) strategy so that the PR description is used as the final commit description with the appropriate semantic release format. -In addition to the semantic release types called out in the [contributor pull request guidelines](../CONTRIBUTING.md#pull-requests), there are several other categories supported by the [default changelog generator](https://github.com/go-semantic-release/changelog-generator-default) that maintainers should be aware of: +In addition to the semantic release types called out in the [contributor pull request guidelines](./contributing.md#pull-requests), there are several other categories supported by the [default changelog generator](https://github.com/go-semantic-release/changelog-generator-default) that maintainers should be aware of: - **chore:** Reserved for automated maintenance changes, such as minor version go dependency updates initiated by Dependabot. - **revert:** Maintainers should use this to mark commits that revert a previous commit, followed by the header of the reverted commit. The message body should include the SHA of the reverted commit, as well as a clear description of the reason for the revert.