Developing the CLI¶
Prerequisites¶
In order to develop code that interacts with the CLI or to use our client API library, you need to have the following packages installed:
- git, the version control system. All of our source code is maintained in a set
of Git repositories available under
https://gitlab.com/rackn. If you intend to submit changes back to RackN, you will need to create an account in Gitlab, fork the repository you intend to develop in, do your work in the fork, and then submit a merge request to merge your changes into our repositories. - Go, the programming language. The overwhelming majority of our client facing source code is written in Go. We recommend using the latest stable release of Go and keeping up with minor and patch releases as they occur.
- A sufficiently Unix build environment. We recommend either your Linux distribution of choice, MacOS,
or a Linux running under WSL on Windows. While it is possible in theory to build in a pure Windows
environment, all of our scripting and most of our build process assumes you have
bashand the standard suite of Unix utilities.
Fetching the CLI Source Code.¶
The source code for drpcli is contained in the provision Git repository.
You can make a clone of this repository by running git clone https://gitlab.com/rackn/provision, and keep it
up to date using the standard git commands for working with source code trees. This guide does not
go into the general principles of working with git -- we recommend consulting the git documentation
for more information on how to use Git.
Building drpcli¶
From the directory you cloned the provision repository into, run tools/build.sh.
This script will build the cp-fix utility, the drpcli command line tool, and the incrementer example plugin provider
for all supported architecture and OS combinations. The final binaries for drpcli will be placed in the
bin/<os>/<arch>/drpcli. These binaries do not have any external dependencies, and can be copied
onto the systems they are needed on and run directly from there.
Running Client¶
Once you have built drpcli using tools/build.sh, the binary appropriate for your arch and OS combination
can be run directly. For most developers, this will be bin/linux/amd64/drpcli if you are developing on
Linux or WSL2 in Windows, bin/darwin/amd64/drpcli for Mac users on Intel CPUs, and bin/darwin/arm64/drpcli
for Mac users on Apple CPUs. If you do not have a dr-provision endpoint to talk to, you can install one following the
getting started instructions.