Giter Site home page Giter Site logo

cloud-build-badge's Introduction

cloud-build-badge

Add cloud build badges in 2 minutes.

  1. Create a cloud storage bucket (tutorial here).
  2. Create a folder in the bucket named build.
  3. Download failure and success badges (follow links and save).
  4. Upload both badges to the google storage bucket/folder created in the previous step (e.g. YOUR_BUCKET/build/success.svg).
  5. Create a placeholder for your badge (e.g. YOUR_BUCKET/build/BADGE_ID.svg (make permissions public).
  6. Set ENV Variables.
export REPO="YOUR_REPO" // e.g. github_sbsends_cloud_build_badge
export BRANCH="YOUR_BRANCH" // e.g. master
export BUCKET="YOUR_BUCKET" // e.g. my-gcp-bucket
export BADGE="PATH_TO_PUBLIC_BADGE" // e.g. cbb-master-badge
  1. Clone this repository into any directory.

git clone https://github.com/sbsends/cloud-build-badge.git

cd cloud-build-badge

  1. Use regular expressions to alter the index.js file (the cloud function).

sed -i.tmp -e "s/\${repo}/$REPO/" -e "s/\${branch}/$BRANCH/" -e "s/\${bucket}/$BUCKET/" -e "s/\${badge}/$BADGE/" index.js && rm index.js.tmp

  1. Deploy the cloud function as the badge name and set the function trigger to the cloud-builds pubsub topic.

gcloud functions deploy $BADGE --runtime nodejs6 --trigger-resource cloud-builds --trigger-event google.pubsub.topic.publish

  1. Add badge to README.md
# README.md
[![cloud build status](https://storage.googleapis.com/<BUCKET>/build/<BADGE>.svg)](https://github.com/sbsends/cloud-build-badge)

cloud-build-badge's People

Contributors

samsends avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cloud-build-badge's Issues

TypeError: Cannot read property 'repoName' of undefined

I tried following your instructions but I seem to have an error in StackDriver that says:

TypeError: Cannot read property 'repoName' of undefined

Is it possible to have more verbose instructions so that people can easily follow? Thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.