GithubHelp home page GithubHelp logo

mski-iksm / ksnotify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hirosassa/ksnotify

0.0 0.0 0.0 56 KB

A CLI command to parse kubectl diff result and notify it to GitLab

License: MIT License

Rust 100.00%

ksnotify's Introduction

ksnotify

build codecov License: MIT

A CLI command to parse kubectl diff result and notify it to GitLab

What ksnotify does

  1. Parse the execution result of kubectl diff
  2. Notify it to GitLab

The comment posted by ksnotify is as follows:


Plan result

CI link

  • updated
    • apps.v1.Deployment.test.test-app
Details (Click me)

apps.v1.Deployment.jasmine.test-app

 @@ -5,7 +5,6 @@
     deployment.kubernetes.io/revision: "3"
+  labels:
+    app: test-app
   name: test-app
   namespace: test
 spec:
@@ -27,7 +26,6 @@
       creationTimestamp: null
       labels:
         app: test-app
-        skaffold.dev/run-id: 1234
     spec:
       containers:
       - args:

Install

GitHub Releases

Download the prebuilt binary from GitHub Releases and install it to $PATH.

aqua

Install ksnotify with aqua, which is a declarative CLI Version Manager.

$ aqua g -i hirosassa/ksnotify

Usage

prerequisites

Create and export GitLab access token to environmental variables as follows:

export KSNOTIFY_GITLAB_TOKEN="xxxxxx"

ref: Project access tokens | GitLab

Post diff results to GitLab

Basic usage is as follows:

skaffold render -p dev | kubectl diff -f - 2> /dev/null | | ksnotify --notifier gitlab --ci gitlab

If you want to update existing comment instead of create a new comment, you should add --patch flag like

skaffold render -p dev | kubectl diff -f - 2> /dev/null | | ksnotify --notifier gitlab --ci gitlab --patch

To suppress skaffold labels like skaffold.dev/run-id: 1234 automatically added by skaffold, you should add --suppress-skaffold flag like

skaffold render -p dev | kubectl diff -f - 2> /dev/null | | ksnotify --notifier gitlab --ci gitlab --suppress-skaffold

The concrete example of GitLab CI configuration is shown in example.

For developers

To run ksnotify locally, use local option for debug. For local mode, ksnotify just renders contents on stdout.

skaffold render -p dev | kubectl diff -f - 2> /dev/null | ~/Dev/ksnotify/ksnotify --ci local --notifier gitlab --suppress-skaffold

> ## Plan result
> [CI link](  )
>
> * updated
> blah
> blah

ksnotify's People

Contributors

hirosassa avatar kitagry avatar suzuki-shunsuke 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.