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