This project is licensed under the MIT License.
Guidelines apply from main OpenFaaS repo
See guide for FaaS here.
Unit testing with Golang
Hacking on the faas-cli
Installation / pre-requirements
Install Docker because it is used to build Docker images if you create new functions.
- OpenFaaS - deployed and live
This CLI can build and deploy templated functions, so it's best if you have FaaS started up on your laptop. Head over to http://github.com/openfaas/faas/ and get up and running with a sample stack in 60 seconds.
Here's how to install Go in 60 seconds.
- Grab Go 1.8.3 or 1.9.x from https://golang.org/dl/
Then after installing run this command or place it in your
export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin
- Now clone / build
Migrate all imports/references to OpenFaaS org $ mkdir -p $GOPATH/src/github.com/openfaas/ $ cd $GOPATH/src/github.com/openfaas/ $ git clone https://github.com/openfaas/faas-cli $ cd faas-cli $ go build
- Build multi-arch binaries
To build the release binaries type in:
This creates the faas-cli for Mac, Windows, Linux x64, Linux ARMHF and Linux ARM64.
- Get the vendoring tool called
$ go get -u github.com/golang/dep/cmd/dep
Use the tool if you add new dependencies or want to update the existing ones.
See also: dep docs
How to update the
brew formula for the faas-cli is part of the official homebrew-core repo on Github. It needs to be updated for each subsequent release.
Simple version bumps
If the only change required is a version bump, ie no new tests, or changes to existing tested functionality or build steps, the
brew bump-formula-pr command can be used to do everything (i.e. forking, committing, pushing) required to bump the version.
For example (supplying both the new version tag and its associated Git sha-256).
brew bump-formula-pr --strict faas-cli --tag=<version> --revision=<sha-256>
Changes requiring new/update tests/build steps
If a new release alters behaviour tested in the Brew Formula, adds new testable behaviors or alters the build steps then you will need to manually raise a PR with an updated Formula, the guidelines for updating brew describe the process in more detail:
brew edit run the build and test the results:
$ brew uninstall --force faas-cli ; \ brew install --build-from-source faas-cli ; \ brew test faas-cli ; \ brew audit --strict faas-cli
How to update the
scoop manifest for the faas-cli is part of the official sccop repo on Github. It needs to be updated for each subsequent release.
Simple version bumps
git clone https://github.com/lukesampson/scoop cd scoop ./bin/checkver.ps1 faas-cli -u
Test the updated manifest
scoop install .\bucket\faas-cli.json
Create a new branch and commit the manifest
faas-cli.json, then create a PR to update the manifest in Scoop repository
Update the utility-script
Please raise a PR for the get.sh file held in this repository. It's used when people install via
cli.openfaas.com. The updated file then has to be redeployed to the hosting server.
Developer DCO (re-iteration from referenced CONTRIBUTING guide)
Sign your work
Note: all of the commits in your PR/Patch must be signed-off.
The sign-off is a simple line at the end of the explanation for a patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below (from developercertificate.org):
Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
Then you just add a line to every git commit message:
Signed-off-by: Joe Smith <email@example.com>
Use your real name (sorry, no pseudonyms or anonymous contributions.)
If you set your
user.email git configs, you can sign your
commit automatically with
git commit -s.
- Please sign your commits with
git commit -sso that commits are traceable.
Making a new release of the CLI
Create a GitHub release
- Through GitHub releases page create a new release and increment the version number.
- Mark the release as pre-release to prevent the download script picking up the version
- Wait until the Travis build is completed (which will add binaries to the page if successful)
Finally if the binaries were added successfully you should un-mark the "pre-release" checkbox, the CLI will now be available from our download utility script.
See above for notes on Brew. At present the brew team are auto-releasing PRs to their database when we make releases.
Arch Linux PKGBUILD (see rawkode) [unmaintained] Chocolately (see pkeuter via au-packages) [unmaintained]
Get the changelog tool (requires Ruby)
$ sudo gem install github_changelog_generator
Generate a personal access token in GitHub and use it to update the CHANGELOG.md file:
$ export CHANGELOG_GITHUB_TOKEN=TOKEN_VALUE $ github_changelog_generator
Bash Auto-completion [experimental]
An experimental initial Bash auto-completion script for
faas-cli is available at
Please raise issues with feedback and suggestions on improvements to the auto-completion support.
This may be enabled it as follows.
Enabling Bash auto-completion on OSX
Brew install the
$ brew install bash-completion
Add the following line to your
~/.bash_profile if not already present.
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
Copy the provided
faas-cli bash completion script from this repo.
cp contrib/bash/faas-cli /usr/local/etc/bash_completion.d/
Enabling Bash auto-completion on Linux
Refer to your distributions instructions on installing and enabling
bash-completion, then copy the
faas-cli completion script from
contrib/bash/ into the appropriate completion directory.