Giter Club home page Giter Club logo

gcb-visualizer's Introduction

Google Cloud Build Pipeline Visualizer

build codecov

For the current version of Google cloud build, it supports the async process with the variable waitFor. With the growth of complexity of your pipeline, it will be hard to maintain the async flow. Unlike Jenkins and CircleCI, there is no visualizer for your pipeline. This application aims at visualize the pipeline and help the developers to debug their cloud build.

Current features

  • YAML format cloud build definition digestion
  • Temporary graph rendering
  • Save graph as dot, png, jpg or jpeg
  • JSON format support

Rule of cloud build async process

From the Google docs, there are a few rules for the async process.

  1. If no values are provided for waitFor, the build step waits for all prior build steps in the build request to complete successfully before running.
  2. A step is dependent on every id in its waitFor and will not launch until each dependency has completed successfully.
  3. By declaring that a step depends only on -, the step runs immediately when the build starts.

How to install

  1. Through go get (Recommended)

    You can install the binary through the following command.

    go get -u github.com/RyanSiu1995/gcb-visualizer
  2. Install the pre-built binary

    You can download the pre-built binary in release page of this repo. Because of the C binding in the Graphviz library, there is a difficulty in building binary based on different common OS and Arch. The current pre-built binaries are built under 64 bit. If you are an user with 32 bits system, please use other approach. If the pre-built binary does not work. Please report on the issue.

  3. Use pre-built docker image

    You can use docker image released to execute the gcb-visualizer without considering the OS and Arch. Please follow this instruction to setup the command alias.

    docker pull ryansiu1995/gcb-visualizer:latest
    alias gcb-visualizer="docker run -v $(pwd):/app ryansiu1995/gcb-visualizer:latest"

    or this command in powershell

    docker pull ryansiu1995/gcb-visualizer:latest
    Set-Alias gcb-visualizer "docker run -v $(pwd):/app ryansiu1995/gcb-visualizer:latest"

    You can put the alias to your profile in order to create a permanent alias.

How to use

You can visualize your pipeline with the following command.

gcb-visualizer visualize <your-cloudbuild-yaml-or-json-file>

If you want to output the graph into other formats, you can use the output flag as the following.

gcb-visualizer visualize --output my-pipeline.jpg <your-cloudbuild-yaml>

The current supported output formats are jpg, jpeg, dot and png.

Example Output

Given an example input of something like the Google Cloud integration test example you should get an output that looks something like this

Go Builder output

Future features

  • Cloudbuild definition linting and checking
  • Multiple OS and Arch binary building
  • Brew, Apt and Chocolatey support
  • Quick installation script
  • More beautiful generated graph

Contributing

Please feel free to submit a pull request or open an issue for the application improvement. Before creating the pull request, please kindly run the follow command to test the program

make tests

License

This project is licensed under the MIT License - see the LICENSE.md file for details

gcb-visualizer's People

Contributors

grevian avatar ryansiu1995 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  avatar  avatar

gcb-visualizer's Issues

Building the multiple OS and Arch binaries

Currently, we build the binary on the fixed OS provided by GitHub Action.
The cross compiling from Golang raised the following error during compiling the graphviz C library binding.

../../../../pkg/mod/github.com/goccy/[email protected]/cdt/cdt.go:6:2: build constraints exclude all Go files in ~/Documents/golang/pkg/mod/github.com/goccy/[email protected]/internal/ccall

We need to fix this in order to build multiple OS and Arch binaries.

Set the default command as visualize

As requested by some folks, it is better if we can set the default command as alias for visualize.
i.e.

gcb-visualizer visualize cloudbuild.yaml == gcb-visualizer cloudbuild.yaml

Integration with package managers

We need to integrate with different package managers in order to have a better release management.
On stage one, the list in the following is the target release platform.

  • brew
  • chocolatey
  • apt

Fix the hard comparison between the YAML and DOT file

Currently, the comparison between YAML and DOT files is using the string comparison.
This will be hard to maintain the test cases.
The library github.com/goccy/go-graphviz is not compatible to the EqualValues function in github.com/stretchr/testify.
We may need to extend the Graph type to do the comparison.
This function is expected to locate in pkg as a public API for others to call.

Quick installation script

We can create a quick installation script so that the user can quickly use curl to get the latest release.
It can be a shell script and a powershell script for windows user.
For the time being, we may just download the pre-built binary based on the OS.
On the future, we may need to integrate with the package managers from issue #9.

Support for JSON format input

We are now supporting the YAML format input only.
We may also support the JSON format of cloud build pipeline definition.

Support on linting cloudbuild format

We can provide the developers with a linting function so they can lint their cloud build pipeline before committing the code.
We have a couple of milestones on this issue.

  • Define the linting rules
  • Define the linter framework
  • Implement the API for the linter
  • Integrate the API with the CLI

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.