GithubHelp home page GithubHelp logo

notifier's Introduction

Notifier

Utility that allows to publish events into Google Pub/Sub from one side and receive events from the other side by triggering Gitlab CI/CD pipeline with a variable. A content of an event will be passed to a variable.

GoDoc build status

Features

  • Publish messages with any content
  • Subscribe and listen messages
  • Trigger pipeline with a content of message

Build

git clone https://github.com/devopsext/notifier.git
cd notifier/
go build

Example

To try this example it's neccesary to prepare Google Pub/Sub to allow Notifier publish and receive messsages. To do so, create Service Account (under Google Gloud Console) with proper rights (read and write), download it in Json format to account.json as well as to make a topic and subscription in Pub/Sub. Gitlab repository should also have trigger token and branch.

Export environment variable

export NOTIFIER_PUBSUB_CREDENTIALS=account.json
export NOTIFIER_PUBSUB_PROJECT_ID=some-pubsub-project-id

Run in Sub mode

./notifier sub --pubsub-subscription some-pubsub-subscription \
               --gitlab-base-url some-gitlab-base-url --gitlab-variable some-gitlab-variable \
               --gitlab-project-id some-gitlab-project-id --gitlab-project-ref some-gitlab-project-ref \
               --gitlab-trigger-token some-gitlab-trigger-toke \
               --log-format stdout --log-level debug --log-template '{{.msg}}' 

Run in Pub mode

./notifier pub --pubsub-topic some-pubsub-topic --pubsub-payload some-pubsub-payload \
               --log-format stdout --log-level debug --log-template '{{.msg}}' 

Usage

Notifier command

Usage:
  notifier [flags]
  notifier [command]

Available Commands:
  help        Help about any command
  pub         Pub command
  sub         Sub command
  version     Print the version number

Flags:
      --gitlab-base-url string        Gitlab base URL
      --gitlab-project-id string      Gitlab project ID
      --gitlab-project-ref string     Gitlab project ref
      --gitlab-token string           Gitlab token
      --gitlab-trigger-token string   Gitlab trigger token
      --gitlab-variable string        Gitlab variable
  -h, --help                          help for notifier
      --log-format string             Log format: json, text, stdout (default "text")
      --log-level string              Log level: info, warn, error, debug, panic (default "info")
      --log-template string           Log template (default "{{.func}} [{{.line}}]: {{.msg}}")
      --prometheus-listen string      Prometheus listen (default "127.0.0.1:8080")
      --prometheus-url string         Prometheus endpoint url (default "/metrics")
      --pubsub-credentials string     Pub/Sub credentials
      --pubsub-project-id string      Pub/Sub project ID

Environment variables

For containerization purpose all command switches have environment variables analogs.

  • NOTIFIER_LOG_FORMAT
  • NOTIFIER_LOG_LEVEL
  • NOTIFIER_LOG_TEMPLATE
  • NOTIFIER_PROMETHEUS_URL
  • NOTIFIER_PROMETHEUS_LISTEN
  • NOTIFIER_PUBSUB_CREDENTIALS
  • NOTIFIER_PUBSUB_PROJECT_ID
  • NOTIFIER_PUBSUB_PAYLOAD
  • NOTIFIER_PUBSUB_TOPIC
  • NOTIFIER_PUBSUB_SUBSCRIPTION
  • NOTIFIER_GITLAB_TOKEN
  • NOTIFIER_GITLAB_BASE_URL
  • NOTIFIER_GITLAB_PROJECT_ID
  • NOTIFIER_GITLAB_PROJECT_REF
  • NOTIFIER_GITLAB_VARIABLE
  • NOTIFIER_GITLAB_TRIGGER_TOKEN

notifier's People

Contributors

tsvtitan avatar

Stargazers

 avatar

Watchers

 avatar  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.