Building and Starting Flux

This guide provides a step-by-step explanation of building and starting the Flux project.

Prerequisites

  • Go: Ensure you have Go installed.
  • Docker: Flux uses Docker for building images and running the environment tests.

Building Flux

  1. Clone the repository:

    git clone https://github.com/fluxcd/flux2.git
    cd flux2
    
  2. Build the project:

    make build 
    

    This will build the Flux binary and place it in the _output/bin directory.

Starting Flux

  1. Install Flux (if needed):

    make install-dev
    

    This command installs the latest development version of Flux to your system.

Running Tests

  1. Run unit tests:

    make test
    
  2. Run end-to-end tests:

    make e2e
    

    These tests require a Kubernetes cluster and Kind for setting up the environment.

  3. Run environment tests:

    make envtest
    

    These tests are designed to validate Flux’s behavior in different environments.

Contributing to Flux

If you are interested in contributing to Flux, consider the following:

  1. Code style:

    make fmt
    
  2. Code linting:

    make vet 
    
  3. Clean up dependencies:

    make tidy 
    
  4. Install environment test dependencies:

    make install-envtest
    

Running Flux with Kind

  1. Setup Kind environment:

    make setup-kind
    
  2. Setup Kind environment with image automation:

    make setup-image-automation
    
  3. Run tests with Kind:

    make test-with-kind
    
  4. Clean up Kind environment:

    make cleanup-kind
    

These steps will guide you through building, testing, and running Flux. For more information on contributing to Flux, please refer to the Flux documentation: https://fluxcd.io/docs/.