Open ljvmiranda921 opened 3 years ago
Comment written by Joe Narvaez on 02/17/2019 05:47:58
I made my own badges and used python:
import base64
from google.cloud import storage
import json
client = storage.Client()
bucket = client.get_bucket('momentum-storage')
passing_blob = bucket.blob('passing.svg')
failing_blob = bucket.blob('failing.svg')
def status(data, context):
string_data = base64.b64decode(data['data']).decode('utf-8')
status = json.loads(string_data)['status']
if status == 'SUCCESS' or status == 'QUEUED' or status == 'WORKING':
bucket.copy_blob(passing_blob, bucket, 'status.svg')
else:
bucket.copy_blob(failing_blob, bucket, 'status.svg')
Written on 12/18/2018 16:00:13
URL: https://ljvmiranda921.github.io/notebook/2018/12/21/cloud-build-badge/