Skip to content

dmmcquay/calicoctl

 
 

Repository files navigation

Build Status CircleCI branch

Slack Status IRC Channel

calicoctl

This repository is the home of calicoctl.

Note that the documentation in this repo is targeted at Calico contributors.

For information on calicoctl usage, see the calicoctl reference information

Developing

Print useful actions with make help.

Building calicoctl

There are two ways to build calicoctl: natively, and dockerized

Dockerized Builds

For simplicity, calicoctl can be built in a Docker container, eliminating the need for any dependencies in your host developer environment, using the following command:

make build

The binary will be put in ./dist/ and named calicoctl-<os>-<arch>, e.g.:

$ ls -1 ./dist/
calicoctl-linux-amd64
calicoctl-linux-arm64
calicoctl-linux-ppc64le
calicoctl-linux-s390x
calicoctl-darwin-amd64
calicoctl-windows-amd64.exe

To build for a different OS or ARCH, simply define it as a var to make, e.g.:

$ make build ARCH=arm64
$ make build OS=darwin ARCH=amd64

To list all possible targets, run make help.

Native Builds
  1. Assuming you have already installed go version 1.7.1+, ensure you've cloned this repository into your Go project path.

    git clone https://github.com/projectcalico/calicoctl.git $GOPATH/src/github.com/projectcalico/calicoctl
    
  2. Install Glide.

  3. Populate the vendor/ directory in the project's root with this project's dependencies:

    glide install -strip-vendor
    
  4. Build the binary:

    make binary
    

Tests

Tests can be run in a container to ensure all build dependencies are met.

To run the tests

make test

Note: Tests depend on the test image calico/test, which is available only on amd64. The actual image used as set by the make variable TEST_CONTAINER_NAME. If you have a local build of that image or one for a different architecture, you can override it by setting the variable, e.g.:

$ make test TEST_CONTAINER_NAME=some/container:tag

Packages

No packages published

Languages

  • Go 51.8%
  • Python 43.6%
  • Makefile 4.0%
  • Shell 0.6%