Closed CC007 closed 3 years ago
Hi @CC007
We do not have any customers asking for CircleCI / ORB support at the moment, so unfortunately can't direct our time to create this.
The idea sounds interesting, do you want to take it on yourself and report back on Slack with your findings?
Alex
I am going to experiment with the implementation without an orb first. Once I get that working, I'll see if I can create the orb and create a repo for you to fork. It should be low maintenance once it is actually setup.
I have not looked into how to publish the orb to CircleCI yet, but since you are the people behind openfaas, I don't expect any issues for you to get it published.
Would you be interested in contributing a page to our docs in the CI/CD section for CircleCI with the non-orb approach?
Of course if we get customers needing this we would reconsider. Thank you again for your input and for contributing.
Sure, I'll share my findings. I feel that is a good way to return the favor of OpenFaaS providing such an easy platform to write FaaS functions with on k8s. I tried the Fn project before and ran into problems, whereas with OpenFaaS it worked out of the box.
I'm glad you had that experience.
To be fair, a way to return the favour (one we need right now) is to become a GitHub Sponsor and if you're using OpenFaaS at work, to chat to your manager about an org-level sponsorship, which is a new feature.
Right now I am using OpenFaaS for a personal project that will not be used commercially. Also, at work we are only just transitioning to cloud with a mix of microservices and monolithic applications and are not ready yet for the transition to a FaaS architecture.
I hope that you don't mind that I'm only going to provide a code and documentation donation for now.
In CircleCI in your build configuration you can import what they call orbs, which provide common functionality. For instance the kubernetes orb provides functionality to install kubectl, create/delete a deployment, wait until a deployment succeeded, etc.
It would be nice if faas-netes provided a similar orb
Expected Behaviour
The idea is to provide the following steps:
Possible Solution
faas-cli-install
I think that using arkade might be the easiest, or with
curl -sSL https://cli.openfaas.com | sudo sh
faas-cli-login
Can be implemented with
echo << parameters.password >> | faas-cli login -u << parameters.username >> -s -g << parameters.gateway-url >>
fn-build
Can be implemented with
faas-cli build -f ./<< parameters.configfile >>
. Any other parameters could also be added, but this is the minimum for a fn-build step.fn-unit-test
The idea is that the function can be unit tested, without deploying the function. The implementation is dependent on what template is used, so you need to detect the template, or have the user provide a parameter, specifying which template is used. After that, the correct function can be run to unit test the code. (for instance for pyhton:
python -m unittest tests/test_handler.py
or something similar)fn-push-to-registry
Can be implemented with
faas-cli push -f ./<< parameters.configfile >>
fn-deploy
Can be implemented with
faas-cli deploy -f ./<< parameters.configfile >>
, with an optional watch-out-status parameter, similar to how the kubernetes orb implemented it.fn-undeploy (or fn-remove)
Can be implemented with
faas-cli remove -f ./<< parameters.configfile >>
fn-watch-rollout-status
Can be implemented in a similar way to how the kubernetes implemented it.
Context
Right now you have to do all these steps manually with a run step in CircleCI, which becomes very repetative and error-prone.
Your Environment
CircleCI (config version 2.1) Kubernetes (version 1.18.x) Faas-cli (version 0.12.21)