Blame CONTRIBUTING.md

Packit Service 4d2de5
# Contributing to osbuild-composer
Packit Service 4d2de5
Packit Service 4d2de5
First of all, thank you for taking the time to contribute to osbuild-composer.
Packit Service 4d2de5
In this document you will find information that can help you with your
Packit Service 4d2de5
contribution.
Packit Service 4d2de5
Packit Service 4d2de5
### Running from sources
Packit Service 4d2de5
Packit Service 4d2de5
We recommend using the latest stable Fedora for development but latest minor
Packit Service 4d2de5
release of RHEL/CentOS 8 should work just fine as well. To run osbuild-composer
Packit Service 4d2de5
from sources, follow these steps:
Packit Service 4d2de5
Packit Service 4d2de5
1. Clone the repository and create a local checkout:
Packit Service 4d2de5
Packit Service 4d2de5
```
Packit Service 4d2de5
$ git clone https://github.com/osbuild/osbuild-composer.git
Packit Service 4d2de5
$ cd osbuild-composer
Packit Service 4d2de5
```
Packit Service 4d2de5
Packit Service 4d2de5
2. To install the build-requirements for Fedora and friends, use:
Packit Service 4d2de5
Packit Service 4d2de5
```
Packit Service 4d2de5
$ sudo dnf group install 'RPM Development Tools'   # Install rpmbuild
Packit Service 4d2de5
$ sudo dnf builddep osbuild-composer.spec          # Install build-time dependencies
Packit Service 4d2de5
$ sudo dnf -y install cockpit-composer             # Optional: Install cockpit integration
Packit Service 4d2de5
$ sudo systemctl start cockpit.socket              # Optional: Start cockpit
Packit Service 4d2de5
```
Packit Service 4d2de5
Packit Service 4d2de5
3. Finally, use the following to compile the project from the working
Packit Service 4d2de5
directory, install it, and then run it:
Packit Service 4d2de5
Packit Service 4d2de5
```
Packit Service 4d2de5
$ rm -rf rpmbuild/
Packit Service 4d2de5
$ make rpm
Packit Service 4d2de5
$ sudo dnf -y install rpmbuild/RPMS/x86_64/*
Packit Service 4d2de5
$ sudo systemctl start osbuild-composer.socket
Packit Service 4d2de5
```
Packit Service 4d2de5
Packit Service 4d2de5
You can now open https://localhost:9090 in your browser to open cockpit console
Packit Service 4d2de5
and check the "Image Builder" section.
Packit Service 4d2de5
Packit Service 4d2de5
Alternatively you can use `composer-cli` to interact with the Weldr API. We
Packit Service 4d2de5
don't have any client for the RCM API, so the only option there is a
Packit Service 4d2de5
plain `curl`.
Packit Service 4d2de5
Packit Service 4d2de5
When developing the code, use `go` executable to build, run, and test you
Packit Service 4d2de5
code [1]:
Packit Service 4d2de5
Packit Service 4d2de5
```
Packit Service 4d2de5
$ go test ./...
Packit Service 4d2de5
$ go build ./...
Packit Service 4d2de5
$ go run ./cmd/osbuild-pipeline/
Packit Service 4d2de5
```
Packit Service 4d2de5
Packit Service 4d2de5
### Testing
Packit Service 4d2de5
Packit Service 4d2de5
See [test/README.md](test/README.md) for more information about testing.
Packit Service 4d2de5
Packit Service 4d2de5
### Planning the work
Packit Service 4d2de5
Packit Service 4d2de5
In general we encourage you to first fill in an issue and discuss the feature
Packit Service 4d2de5
you would like to work on before you start. This can prevent the scenario where
Packit Service 4d2de5
you work on something we don't want to include in our code.
Packit Service 4d2de5
Packit Service 4d2de5
That being said, you are of course welcome to implement an example of what you
Packit Service 4d2de5
would like to achieve.
Packit Service 4d2de5
Packit Service 4d2de5
### Creating a PR
Packit Service 4d2de5
Packit Service 4d2de5
The commits in the PR should have these properties:
Packit Service 4d2de5
Packit Service 4d2de5
* Preferably minimal and well documented
Packit Service 4d2de5
  * Where minimal means: don't do unrelated changes even if the code is
Packit Service 4d2de5
    obviously wrong
Packit Service 4d2de5
  * Well documented: both code and commit message
Packit Service 4d2de5
  * The commit message should start with the module you work on,
Packit Service 4d2de5
    like: `weldr: `, or `distro:`
Packit Service 4d2de5
* The code should compile and the composer should start, so that we can run
Packit Service 4d2de5
  `git bisect` on it
Packit Service 4d2de5
* All code should be covered by unit-tests
Packit Service 4d2de5
Packit Service 4d2de5
### Notes:
Packit Service 4d2de5
Packit Service 4d2de5
[1] If you are running macOS, you can still compile osbuild-composer. If it
Packit Service 4d2de5
    doesn't work out of the box, use `-tags macos` together with any `go`
Packit Service 4d2de5
    command, for example: `go test -tags macos ./...`