2022-04-13 12:08:51 +00:00
# Contributing to Podman Desktop
2022-03-16 14:07:17 +00:00
< p align = "center" >
2022-04-13 12:08:51 +00:00
< img alt = "Podman Desktop" src = "https://raw.githubusercontent.com/containers/podman-desktop/media/screenshot.png" >
2022-03-16 14:07:17 +00:00
< / p >
We'd love to have you join the community! Below summarizes the processes
that we follow.
## Topics
2023-06-14 07:59:27 +00:00
- [Reporting Issues ](#reporting-issues )
- [Working On Issues ](#working-on-issues )
- [Contributing ](#contributing )
- [Continuous Integration ](#continuous-integration )
- [Submitting Pull Requests ](#submitting-pull-requests )
- [Communication ](#communication )
- [Code Architecture ](#code-architecture )
2022-03-16 14:07:17 +00:00
## Reporting Issues
2022-10-14 15:18:04 +00:00
Before opening an issue, check the backlog of
2022-04-13 12:08:51 +00:00
[open issues ](https://github.com/containers/podman-desktop/issues )
2023-06-14 07:59:27 +00:00
to see if someone else has already reported it.
2022-10-14 15:18:04 +00:00
If so, feel free to add
2022-03-16 14:07:17 +00:00
your scenario, or additional information, to the discussion. Or simply
"subscribe" to it to be notified when it is updated.
If you find a new issue with the project we'd love to hear about it! The most
important aspect of a bug report is that it includes enough information for
us to reproduce it. So, please include as much detail as possible and try
to remove the extra stuff that doesn't really relate to the issue itself.
The easier it is for us to reproduce it, the faster it'll be fixed!
Please don't include any private/sensitive information in your issue!
## Working On Issues
2023-06-14 07:59:27 +00:00
Often issues will be assigned to someone, to be worked on at a later time.
2022-10-14 15:18:04 +00:00
2023-06-14 07:59:27 +00:00
If you are a member of the [Containers ](https://github.com/containers ) organization,
2022-10-14 15:18:04 +00:00
self-assign the issue with the `status/in-progress` label.
If you can not set the label: add a quick comment in the issue asking that
the `status/in-progress` label to be set and a maintainer will label it.
2022-03-16 14:07:17 +00:00
## Contributing
2022-04-13 12:08:51 +00:00
This section describes how to start a contribution to Podman Desktop.
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
### Prerequisites: Prepare your environment
2022-11-18 14:24:18 +00:00
You can develop on either: `Windows` , `macOS` or `Linux` .
2023-06-14 07:59:27 +00:00
Requirements:
2023-06-19 12:52:32 +00:00
- [Node.js 18+ ](https://nodejs.org/en/ )
2023-06-14 07:59:27 +00:00
- [yarn ](https://yarnpkg.com/ )
2022-10-14 15:18:04 +00:00
2022-11-18 14:24:18 +00:00
Optional Linux requirements:
2023-06-14 07:59:27 +00:00
- [Flatpak builder, runtime, and SDK, version 22.08 ](https://docs.flatpak.org/en/latest/first-build.html )
2022-11-17 20:52:51 +00:00
```sh
2022-11-18 14:24:18 +00:00
flatpak remote-add --if-not-exists flathub --user https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user flathub org.flatpak.Builder org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08
2022-11-17 20:52:51 +00:00
```
2023-06-14 07:59:27 +00:00
- GNU C and C++ compiler
2023-04-11 07:05:32 +00:00
Fedora/RHEL
```sh
dnf install gpp-c++
```
Ubuntu/Debian
```sh
apt-get install build-essential
```
2022-11-17 20:52:51 +00:00
2022-10-14 15:18:04 +00:00
### Step 1. Fork and clone Podman Desktop
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
Clone and fork the project.
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
Fork the repo using GitHub site and then clone the directory:
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
```sh
git clone https://github.com/< you > /podman-desktop & & cd podman-desktop
2022-03-16 14:07:17 +00:00
```
2022-10-14 15:18:04 +00:00
### Step 2. Install dependencies
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
Fetch all dependencies using the command `yarn` :
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
```sh
yarn install
```
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
### Step 3. Start in watch mode
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
Run the application in watch mode:
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
```sh
yarn watch
```
2022-03-16 14:07:17 +00:00
2023-06-14 07:59:27 +00:00
The dev environment will track all files changes and reload the application respectively.
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
### Step 4. Write and run tests
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
Write tests! Please try to write some unit tests when submitting your PR.
2022-03-16 14:07:17 +00:00
2023-06-14 21:53:32 +00:00
Run the unit and component tests using `yarn` :
2023-06-14 07:59:27 +00:00
2022-10-14 15:18:04 +00:00
```sh
2023-06-14 21:53:32 +00:00
yarn test:unit
2022-10-14 15:18:04 +00:00
```
2023-06-14 07:59:27 +00:00
2023-04-11 07:05:32 +00:00
Depending on to what part of project you contribute to, you can specify to run tests for the given module only, ie., if you are working on extensions, you can run the tests for extensions and have faster feedback:
2023-06-14 07:59:27 +00:00
2023-04-11 07:05:32 +00:00
```sh
yarn test:extensions
```
2023-06-14 07:59:27 +00:00
2023-04-11 07:05:32 +00:00
or if you are contributing to a particular extension, you can call:
2023-06-14 07:59:27 +00:00
2023-04-11 07:05:32 +00:00
```sh
yarn test:extensions:compose
```
2023-06-14 07:59:27 +00:00
2023-04-11 07:05:32 +00:00
This will show a test results for restricted amount of tests:
2023-06-14 07:59:27 +00:00
2023-04-11 07:05:32 +00:00
```
✓ src/os.spec.ts (3)
✓ src/detect.spec.ts (10) 518ms
✓ src/compose-github-releases.spec.ts (10)
✓ src/compose-extension.spec.ts (16)
✓ src/compose-wrapper-generator.spec.ts (4)
Test Files 5 passed (5)
Tests 43 passed (43)
Start at 17:17:07
Duration 1.27s (transform 562ms, setup 0ms, collect 1.25s, tests 587ms)
```
2023-06-14 07:59:27 +00:00
Check the npm script tasks in our `package.json` for more options.
2023-04-11 07:05:32 +00:00
2023-06-14 21:53:32 +00:00
### Step 5. Run E2E tests
In case of adding new feature, it is always suitable to make sure we do not bring any new regression. For this purpose we are using the E2E tests. They can be run using `yarn` :
2023-06-16 11:32:01 +00:00
2023-06-14 21:53:32 +00:00
```sh
yarn test:e2e:smoke
```
Although, there are requirements that need to be fulfilled before running the tests in order to make them pass:
2023-06-16 11:32:01 +00:00
2023-06-14 21:53:32 +00:00
- remove `settings.json` from `~/.local/share/containers/podman-desktop/configuration/` or if you do not want to lose your settings, remove the objects from the file with keys `"welcome.version"` and `"telemetry.*"`
### Step 6. Code coverage
2023-04-11 07:05:32 +00:00
Part of every test is also a code coverage report which can be obtain from the test run output (using simple text reporter)
found in project root `./test-resources/coverage/*` . Depending if you have run all or just a part of the tests, you will have partial test coverage report generated, example:
2023-06-14 07:59:27 +00:00
2023-04-11 07:05:32 +00:00
```
% Coverage report from c8
------------------------------|---------|----------|---------|---------|-------------------
2023-06-14 07:59:27 +00:00
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
2023-04-11 07:05:32 +00:00
------------------------------|---------|----------|---------|---------|-------------------
2023-06-14 07:59:27 +00:00
All files | 75.1 | 97.22 | 93.75 | 75.1 |
cli-run.ts | 0 | 0 | 0 | 0 | 1-119
compose-extension.ts | 100 | 100 | 100 | 100 |
compose-github-releases.ts | 100 | 100 | 100 | 100 |
compose-wrapper-generator.ts | 100 | 100 | 100 | 100 |
detect.ts | 100 | 100 | 100 | 100 |
extension.ts | 0 | 0 | 0 | 0 | 1-54
os.ts | 100 | 100 | 100 | 100 |
2023-04-11 07:05:32 +00:00
------------------------------|---------|----------|---------|---------|-------------------
```
2023-06-14 07:59:27 +00:00
2023-04-11 07:05:32 +00:00
For a detailed information about the code coverage you can search the mentioned folder and find `html` lcov report:
`test-resources/coverage/extensions/compose/lcov-report/index.html`
2022-03-16 14:07:17 +00:00
2023-04-11 07:05:32 +00:00
When contribuing the new code, you should consider not lowering overall code coverage.
2023-06-16 11:32:01 +00:00
2023-06-14 21:53:32 +00:00
### Step 7. Code formatter / linter
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
We use `prettier` as a formatter and `eslint` for linting.
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
Check that your code is properly formatted with the linter and formatter:
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
Checking:
```sh
yarn lint:check & & yarn format:check
```
Fix:
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
```sh
yarn lint:fix & & yarn format:fix
```
2023-06-14 21:53:32 +00:00
### Step 8. Compile production binaries (optional)
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
You may want to test the binary against your local system before pushing a PR, you can do so by running the following command:
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
```sh
yarn compile:current
```
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
This will create a binary according to your local system and output it to the `dist/` folder.
2022-03-16 14:07:17 +00:00
2023-04-03 15:58:41 +00:00
> **_NOTE:_** macOS and Windows create binaries while Linux will create a `.flatpak`. Make sure your flatpak dependencies are installed for successful compiling on Linux.
2022-10-14 15:18:04 +00:00
## Submitting Pull Requests
### Process
Whether it is a large patch or a one-line bug fix, make sure you explain in detail what's changing!
Make sure you include the issue in your PR! For example, say: `Closes #XXX` .
2022-03-16 14:07:17 +00:00
PRs will be approved by an [approver][owners] listed in [`CODEOWNERS` ](CODEOWNERS ).
2023-06-14 07:59:27 +00:00
We typically require one approval for code as well as documentation-related PR's. If it is a large code-related PR, proof of review / testing (a video / screenshot) is required.
2023-01-23 14:27:51 +00:00
2022-10-14 15:18:04 +00:00
Some tips for the PR process:
2023-06-14 07:59:27 +00:00
- No PR too small! Feel free to open a PR against tests, bugs, new features, docs, etc.
- Make sure you include as much information as possible in your PR so maintainers can understand.
- Try to break up larger PRs into smaller ones for easier reviewing
- Any additional code changes should be in a new commit so we can see what has changed between reviews.
- Squash your commits into logical pieces of work
2022-10-14 15:18:04 +00:00
### Use the correct commit message semantics
We follow the [Conventional Commits ](https://www.conventionalcommits.org/en/v1.0.0/ ) specification.
Some examples for correct titles would be:
2022-03-16 14:07:17 +00:00
2023-06-14 07:59:27 +00:00
- `fix: prevent racing of requests`
- `chore: drop support for Node 6`
- `docs: add quickstart guide`
2022-03-16 14:07:17 +00:00
2022-10-14 15:18:04 +00:00
For Podman Desktop we use the following types:
2023-06-14 07:59:27 +00:00
- `fix:` A bug fix
- `chore:` Very small change / insignificant impact
- `docs:` Documentation only changes (ex. website)
- `build:` Changes that affect the build system
- `ci:` Changes to the CI (ex. GitHub actions)
- `feat:` A new feature
- `perf:` A code change that improves performance
- `refactor:` A code change that neither fixes a bug nor adds a feature
- `style:` Changes that affect the formatting, but not the ability of the code
- `test:` Adding missing tests / new tests
2022-10-14 15:18:04 +00:00
2023-06-14 07:59:27 +00:00
Title formatting:
2022-03-16 14:07:17 +00:00
```
< type > [optional scope]: < description >
[optional body]
[optional footer(s)]
```
### Sign your PRs
The sign-off is a line at the end of the explanation for the patch. Your
signature certifies that you wrote the patch or otherwise have the right to pass
2023-06-14 07:59:27 +00:00
it on as an open-source patch.
2022-03-16 14:07:17 +00:00
Then you just add a line to every git commit message:
Signed-off-by: Joe Smith < joe.smith @ email . com >
2022-10-14 15:18:04 +00:00
Legal name must be used (no pseudonyms or anonymous contributions)
2022-03-16 14:07:17 +00:00
If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s` .
2023-03-07 11:32:18 +00:00
### Review process
1. Submit your PR
2. Reviewers are assigned by GitHub to two Podman Desktop developers
3. PR's require 1 LGTM / Approval (2 if it's a large code change)
> **_NOTE:_** If your PR hasn't been merged in an appropriate amount of time, ping the two developers assigned to the issue with `@`
2022-03-16 14:07:17 +00:00
## Continuous Integration
All pull requests and branch-merges automatically run:
2023-06-14 07:59:27 +00:00
- Format and lint checking
- Cross-platform builds (Windows, macOS, Linux)
2023-06-14 21:53:32 +00:00
- Unit test (Linux)
- E2E tests (Linux, triggered by PR check, do not prevent merging of the PR in case of instability)
2022-03-16 14:07:17 +00:00
2022-04-13 12:08:51 +00:00
You can follow these jobs in Github Actions https://github.com/containers/podman-desktop/actions
2022-03-16 14:07:17 +00:00
## Communication
2022-04-13 12:08:51 +00:00
For bugs/feature requests please [file issues ](https://github.com/containers/podman-desktop/issues/new/choose )
2022-03-16 14:07:17 +00:00
2022-04-13 12:08:51 +00:00
Discussions are possible using Github Discussions https://github.com/containers/podman-desktop/discussions/
2023-01-12 13:49:21 +00:00
## Code Architecture
2023-01-13 07:20:56 +00:00
### Frameworks and tooling
Within Podman Desktop, we use the following frameworks and tools to build the desktop application:
2023-06-14 07:59:27 +00:00
- [Electron ](https://www.electronjs.org/ ): In order to deploy cross-platform to multiple operating systems.
- [Svelte ](https://svelte.dev/ ): The reactive UI/UX framework for building the interface.
- [Tailwind CSS ](https://tailwindcss.com/ ): A utility-first CSS framework for the UI/UX framework.
- [Vite ](https://vitejs.dev/ ): Dev tooling for rapid development, debugging and deployment.
> **_NOTE:_** We also use TypeScript instead of JavaScript for strongly typed programming language development.
2023-01-13 07:20:56 +00:00
2023-03-07 12:37:19 +00:00
### Testing
Within Podman Desktop, we use the following for testing:
2023-06-14 07:59:27 +00:00
- [Vitest ](https://vitest.dev/ ): Unit tests - Written as `spec.ts` files.
- [Testing Library ](https://testing-library.com/ ): Component tests - Utilities and best practices for writing component tests.
2023-06-14 21:53:32 +00:00
- [Playwright ](https://playwright.dev/ ): Integration and E2E tests.
2023-01-13 07:20:56 +00:00
### Folders
2023-01-12 13:49:21 +00:00
Below are brief descriptions on the architecture on each folder of Podman Desktop and how it's organized.
If you're unsure where to add code (renderer, UI, extensions, plugins) see the below TLDR:
2023-06-14 07:59:27 +00:00
- `__mocks__/` : Mock packages for Vitest.
- `buildResources` : Podman Desktop logo location / build resources for electron
- `extensions` : We separate functionality into separate "extensions" to keep Podman Desktop modular. Here you'll find extensions such as Kubernetes, CRC, Podman and Docker functionality that Podman Desktop interacts with and integrates into the API (see `packages/extension-api` ). Examples include `extensions/crc` , `extensions/podman` , `extensions/docker` .
- `packages/extension-api` : The extension API for extensions such as `extensions/podman` to interact with the Podman Desktop GUI. This API acts as a "middleware" to the main Electron functionality such as displaying notifications, progress messages, configuration changes, etc.
- `packages/main` : Electron process code that is responsible for creating the app's main windows, setting up system events and communicating with other processes
- `packages/preload` : Electron code that runs before the page gets rendered. Typically has access to APIs and used to setup communication processes between the main and renderer code.
- `packages/preload-docker-extension` : Electron preload code specific to the Docker Desktop extension.
- `packages/renderer` : Electron code that runs in the renderer process. The renderer runs separate to the main process and is responsible for typically rendering the main pages of Podman Desktop. Typically, this is where you find the `.svelte` code that renders the main Podman Desktop UI.
- `scripts` : Scripts Podman Desktop requires such as `yarn watch` functionality and updating Electron vendorered modules.
- `tests` : Contains e2e tests for Podman Desktop.
- `types` : Additional types required for TypeScript.
- `website` : The documentation as well as [Podman Desktop website ](https://podman-desktop.io ) developed in [Docusaurus ](https://docusaurus.io ).
- `node_modules` : Location for Node.JS packages / dependencies.
2023-01-13 07:20:56 +00:00
2023-01-18 08:35:33 +00:00
> **_NOTE:_** Each `extension` folder is a separately packaged module. If there are any issues with loading, make sure your module is packaged correctly.
### Extensions
2023-05-04 14:29:57 +00:00
Podman Desktop is moduralized into extensions for each 'Provider'. You can also create and add your own extension.
2023-01-18 08:35:33 +00:00
2023-06-14 07:59:27 +00:00
See our [EXTENSIONS.md ](/EXTENSIONS.md ) document for more details.