FireHydrant provides a command line tool, fhcli
, to easily submit changes from your existing CI or orchestration systems. You can use fhcli
to record the creation of Docker images, deploy events in Jenkins, CI build statuses, and so on.
We publish releases at https://github.com/firehydrant/fhcli/releases, and builds are available for MacOS (darwin) and Linux (amd64) with support for more platforms scheduled for future releases.
Configuring the CLI tool
You need a bot token for the controller to use for authentication. We recommend that you generate one specifically for this integration. Put the token in an environment variable in your CI system, or export it in a setup script. If the bot token is stored in FH_API_KEY
, the fhcli
tool will automatically use it.
You can also store your token in ~/firehydrant.cfg
or /etc/firehydrant.cfg
and it will automatically be used. We recommend also storing the environment name there if it's the same across all invocations of fhcli
from this system.
apiKey: fhb-00a0a0a00a0a0a00a0a0a0a0a00a0a0a
environment: production
Using fhcli
You can record the creation of a Docker image in FireHydrant by wrapping your call to docker build
with fhcli
:
fhcli execute --service=railsapp -- docker build -t app .
This is a simple example, but we recommend sending identities for a change like the Git revision or container image URL with the fhcli
call:
fhcli execute --service=railsapp --identities "revision=${CIRCLE_SHA1},git=${CIRCLE_REPOSITORY_URL}:${CIRCLE_SHA1},image=us.gcr.io/${GOOGLE_PROJECT_ID}/${CIRCLE_PROJECT_REPONAME}:${CIRCLE_SHA1}" -- docker build -t app .
This may look complicated, but it's simply adding the above mentioned data (in this case provided by CircleCI):
- Current Git revision
revision=${CIRCLE_SHA1}
- Full path of Git commit
git=${CIRCLE_REPOSITORY_URL}:${CIRCLE_SHA1}
- Docker image
image=us.gcr.io/${GOOGLE_PROJECT_ID}/${CIRCLE_PROJECT_REPONAME}:${CIRCLE_SHA1}
By sending this information, you can link a GitHub pull request to an updated Pod spec in a Kubernetes deployment. Sending this level of detail is not required, but it leads to better visibility into the propagation of changes through your system.