/of_badge_gen

faas function to generate status badge for function deployed in opendfaas-cloud

Primary LanguageGo

of_badge_gen - status badge for opendfaas-cloud

OpenFaaS Status

openfaas live demo status : Status

About

of_badge_gen is a faas function to generate status badge for function deployed in opendfaas-cloud

badge status
success_DEPLOY Successfully Deployed
pending_BUILD Pending at Build
failure_BUILD Failed to Build
pending_DEPLOY Pending at Deploy
failure_DEPLOY Failed to Deploy
Unknown Internal Issue / Unknown

Deploying in your openfaas-cloud

  1. Fork this repo
  2. Install your openfaas-cloud github app on the forked repo
  3. Change the customer_url, it should be same that is used for openfaas-cloud.
      of_badge_gen use it to validate user
    environment:
       content_type: "image/svg+xml"
       validate_customers: "true"
       customers_url: "https://raw.githubusercontent.com/openfaas/openfaas-cloud/master/CUSTOMERS"
    
  4. Use the badge for a repo as:
    [![Status](http://your.openfaas.cloud/function/of_badge_gen?user=<repo_user_or_org>&repo=<repo_name>&branch=master)](repo_url)
    

Deploy as a FaaS anywhere

of_badge_gen is not necessarily need to run with openfaas-cloud or need to query openfaas-cloud gateway. It fetch the build status from repo itself using:

https://api.github.com/repos/?user/?repo/commits/?branch/status

and verify if the status generated by an openfaas-cloud

  1. Clone the repo
    git clone https://github.com/s8sg/of_badge_gen.git
  2. Build and deploy using faas-cli
    $ cd faas-cli
    $ faas-cli build -f stack.yml
    $ faas-cli deploy -f stack.yml --gateway http://your.openfaas.gateway
  3. Use the badge in a repo as:
    [![Status](http://your.openfaas.gateway/function/of_badge_gen?user=<repo_user_or_org>&repo=<repo_name>&branch=master)](repo_url)
    

Constraint

  • Repo must be public
  • Currently only failure deploy, deployed and unknown is supported.  Other will be available once openfaas-cloud support the status