CI/CD with OpenFaaS¶
Due to the fact that OpenFaaS functions are built into portable Docker images you can use any container builder to build your functions. The
faas-cli can be used to
deploy your functions.
Use the native
It is recommended to use the
faas-cli binary for building and deploying your functions whether that is to Kubernetes or Docker Swarm.
Build only & push:
faas-cli build faas-cli push
To combine build, push and deploy:
You can also use
--parallel or /
--filter when you have multiple functions in your
faas-cli buildcommand invokes the
dockerCLI with the various flags and parameters required. If you want to use an alternative builder you can use the
--shrinkwrapflag to generate a folder named
./build/<function>which can then be used with any other container builder such as BuildKit or Kaniko.
faas-cli build reference.
GitLab is both a source-control management system and a CI tool.
You can find a pipeline example on the GitLab CI/CD page.
For GitHub you can build with any suitable CI tool such as:
- Travis CI
- Drone CI
- Circle CI
- GitHub Actions (beta)
- Tekton pipelines (experimental)
It's really up to you.
Git examples with Jenkins Pipeline¶
Examples with Docker-in-Docker: Jenkins Pipeline examples
OpenFaaS Cloud can integrate with a public GitHub account or organisation or self-hosted GitLab instance to provide automatic CI/CD without any additional maintenance.
See also: OpenFaaS Cloud
- GitHub Actions for OpenFaaS by Lucas Roesler