This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Contributing

Contributing to Spin Operator

    We are delighted that you are interested in making spin-operator better! Thank you! This document will guide you through making your first contribution to the project. We welcome and appreciate contributions of all types - opening issues, fixing typos, adding examples, one-liner code fixes, tests, or complete features.

    First, any contribution and interaction on any Fermyon project MUST follow our Code of Conduct. Thank you for being part of an inclusive and open community!

    If you plan on contributing anything complex, please go through the open issues and PR queue first to make sure someone else has not started working on it. If it doesn’t exist already, please open an issue so you have a chance to get feedback from the community and the maintainers before you start working on your feature.

    Making Code Contributions to spin-operator

    The following guide is intended to make sure your contribution can get merged as soon as possible.

    If you have nix installed, all dependencies aside from docker will be available after running nix develop.

    Otherwise you’ll need to install:

    • go version v1.22.0+
    • docker version 17.03+.
    • kubectl version v1.11.3+.
    • Access to a Kubernetes v1.11.3+ cluster (microk8s or k3s are commonly used by the maintainers)
    • make
    • please ensure you configure adding a GPG signature to your commits as well as appending a sign-off message (git commit -S -s)

    Once you have set up the prerequisites and identified the contribution you want to make to spin-operator, make sure you can correctly build the project:

    # clone the repository
    $ git clone https://github.com/spinkube/spin-operator && cd spin-operator
    # add a new remote pointing to your fork of the project
    $ git remote add fork https://github.com/<your-username>/spin-operator
    # create a new branch for your work
    $ git checkout -b <your-branch>
    
    # build spin-operator
    $ make
    
    # make sure compilation is successful
    $ ./bin/manager --help
    
    # run the tests and make sure they pass
    $ make test
    

    Now you should be ready to start making your contribution. To familiarize yourself with the spin-operator project, please read the README. Since most of spin-operator is written in Go, we try to follow the common Go coding conventions. If applicable, add unit or integration tests to ensure your contribution is correct.

    NOTE: Run make --help for more information on all potential make targets.

    Before You Commit

    • Run the lint task (make lint or make lint-fix)
    • Build the project and run the tests (make test)

    spin-operator enforces lints and tests as part of continuous integration - running them locally will save you a round-trip on your pull request!

    If everything works locally, you’re ready to commit your changes.

    Committing and Pushing Your Changes

    We require commits to be signed both with an email address and with a GPG signature.

    Because of the way GitHub runs enforcement, the GPG signature isn’t checked until after all tests have run. Be sure to GPG sign up front, as it can be a bit frustrating to wait for all the tests and then get blocked on the signature!

    $ git commit -S -s -m "<your commit message>"
    

    Some contributors like to follow the Conventional Commits convention for commit messages.

    We try to only keep useful changes as separate commits - if you prefer to commit often, please cleanup the commit history before opening a pull request.

    Once you are happy with your changes you can push the branch to your fork:

    # "fork" is the name of the git remote pointing to your fork
    $ git push fork
    

    Now you are ready to create a pull request. Thank you for your contribution!