Giter Site home page Giter Site logo

compatip's Introduction

Compatip Build Status codecov

Compatip it's a simple tool to ensure compatibility between microservices.

Description

Compatip has been designed as a part of the checks that you should run in your CI/CD pipeline.

With Compatip you can specify the service you want to check and the version constraints you would like to validate. In case of incompatibility, the application will fail with a recognizable error code.

So far, Compatip supports REST and gRPC+Protobuf communications, Semver semantics (MAJOR.MINOR.PATCH) to ensure the compatibility between services and it's also able to use JSON dot notation to extract the version from the service response.

TL;DR

CMD assert version

Usage

Check Command

Checks the current version of the service.

Example: compatip check --jsonpath app.version http://myservice:8080/version.json

Exit codes:

0: All Ok.
2: Input argument error.
3: Error on server communication.
4: Invalid version response.

Assert Command

Asserts the current version of the service with the specified constraints.

Example: compatip assert grpc://myservice:50051/rpc/versionservice/current ">1.4.10"

Exit codes:

0: All Ok.
1: Incompatible service version.
2: Input argument error.
3: Error on server communication.
4: Invalid version response.

Examples

Check service version

HTTP (GET verb) request to the service:

CMD check version

Extracting the version from json:

Server response:

{
   "app": {
      "version" : "v1.3.24"
   }
}

CMD check version

gRPC request to the service:

CMD check version

Due to the nature the protobuf the service should answer with this very same message format.

message VersionMessage {
  string version = 1;
}

Assert service version

Assert exact version:

CMD assert version

Assert version range:

Greater than 1.2:

CMD assert version

Greater than 1.2 and lower than 1.4:

CMD assert version

Incompatible range:

CMD assert version

Install

To install, use go get:

$ go get -d github.com/jmartin82/jmartin82

Installation

Binary Release (Linux/OSX)

You can manually download a binary release from the release page.

Automated install/update, don't forget to always verify what you're piping into bash:

curl https://raw.githubusercontent.com/jmartin82/compatip/master/scripts/install_compatip.sh | bash

Go

Required go version: 1.12+

go get github.com/jmartin82/compatip

DEB and RPM

You can manually download a DEB and RPM packages release from the release page

sudo dpkg -i compatip_XXX_linux_amd64.deb

OR

sudo rpm –i compatip_XXX_linux_amd64.rpm

Contribution

  1. Fork (https://github.com/jmartin82/compatip/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request

Licence

Copyright © 2019, Jordi Martín (http://jordi.io)

Released under MIT license, see LICENSE for details.

compatip's People

Contributors

jmartin82 avatar

Watchers

 avatar

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.