Skip to content

Building 'drpcli' client binary and agent.

Generally speaking; RackN compiles, tests, and publishes a limited set of Architectures and OSes for the drpcli CLI client binary and Agent/Runner. You should not need to compile the drpcli binary. However, it may be desirable to cross compile it for different Architectures and OSes to run the binary from different platforms.

Please note that the ability to cross compile the binary does not mean that RackN will support alternative Architectures and OSes.

Solution

The Digital Rebar Platform (DRP) endpoint service and most associated tools are built using Golang. Golang supports a broad range of Architectures and Operating Systems for cross compiling binaries. This solution describes the mechanics of building the drpcli binary on different "dists" (as Golang tends to refer to them).

First start by installing the currently supported version of Golang for building RackN tooling. You can find this by checking the go.mod file:

The line go 1.18 (for example) defines the minimum supported Golang version. See the Additional Information for install instructions.

Building for different Golang binary Archictures and OSes is generally done by setting the environment variables GOARCH and GOOS (respectively), otherwise the compile will occur for the current Architecture and OS platform.

The Process

# clone the current stable branch
git clone https://gitlab.com/rackn/provision.git

# change in to the newly cloned git repo
cd provision

# NOTE: it is advisable to check the list of Branches ('git branch -a')
#       and checkout the most current Stable branch to build from
#       ('git checkout v4.9.0-branch')

# build an ARM64 version of drpcli for MacOS X
GOOS=darwin GOARCH=arm64 tools/build-one.sh cmds/drpcli

# newly built binary:
ls -l bin/darwin/arm64/drpcli

You can find a matrix of Golang supported GOOS and GOARCH values at:

You can also get the currently installed go version of supported distributions by doing:

go tool dist list

Additional Information

Additional resources and information related to this Knowledge Base article.

See Also

Versions

All

Keywords

drpcli, agent, runner, cli, build, compile, cross compile

Revision Information

KB Article     :  kb-00074
initial release:  Thu Mar 24 09:45:27 PDT 2022
updated release:  Thu Mar 24 09:45:27 PDT 2022