Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Latest commit

 

History

History
86 lines (64 loc) · 2.65 KB

DEVELOPMENT.md

File metadata and controls

86 lines (64 loc) · 2.65 KB

Development

Note: Please take a look at https://fluxcd.io/docs/contributing/flux/ to find out about how to contribute to Flux and how to interact with the Flux Development team.

Installing required dependencies

The dependency libgit2 needs to be installed to be able to run source-controller or its test-suite locally (not in a container).

In case this dependency is not present on your system (at the expected version), the first invocation of a make target that requires the dependency will attempt to compile it locally to hack/libgit2. For this build to succeed; CMake, OpenSSL 1.1 and LibSSH2 must be present on the system.

Triggering a manual build of the dependency is possible as well by running make libgit2. To enforce the build, for example if your system dependencies match but are not linked in a compatible way, append LIBGIT2_FORCE=1 to the make command.

macOS

$ # Ensure libgit2 dependencies are available
$ brew install cmake [email protected] libssh2 pkg-config
$ LIBGIT2_FORCE=1 make libgit2

openssl and pkg-config

You may see this message when trying to run a build:

# pkg-config --cflags  -- libgit2
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'libgit2', not found
pkg-config: exit status 1

On some macOS systems brew will not link the pkg-config file for openssl into expected directory, because it clashes with a system-provided openssl. When installing it, or if you do

brew link [email protected]
Warning: Refusing to link macOS provided/shadowed software: [email protected]
If you need to have [email protected] first in your PATH, run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.profile

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

.. it tells you (in the last part of the message) how to add openssl to your PKG_CONFIG_PATH so it can be found.

Linux

$ # Ensure libgit2 dependencies are available
$ pacman -S cmake openssl libssh2
$ LIBGIT2_FORCE=1 make libgit2

Note: Example shown is for Arch Linux, but likewise procedure can be followed using any other package manager, e.g. apt.

How to run the test suite

Prerequisites:

  • go >= 1.17
  • kubebuilder >= 2.3
  • kustomize >= 3.1

You can run the unit tests by simply doing

make test