Coder Social home page Coder Social logo

umb's Introduction

umb

  • To run locally use podman/docker to build image
docker build -t <image-name> .

  • umb brokers deployed behind the vpn to test this up use network host instead
docker run -it --network=host <image-name> /bin/bash

(app-root) python app.py  <-c optional config path >

Producer service

  • You can find implementation code under producer section

  • As of now we support route produce

    1. will help user to produce messages to required topic. (POST)
  • Now you can deploy this services on any openshift cluster deployed behind the vpn! (psi)

Pre-requistes

  • setup configmaps & secrets prior
oc apply -f configs/configmap.yaml

oc apply -f configs/secrets.yaml

Consumer service

oc apply -f consumer/openshift/imagestream.yaml

oc apply -f consumer/openshift/build-config.yaml

oc apply -f consumer/openshift/deployment-config.yaml

oc rollout status dc/umb-consumer

Producer service

oc apply -f producer/openshift/imagestream.yaml

oc apply -f producer/openshift/build-config.yaml

oc apply -f producer/openshift/deployment-config.yaml

oc rollout status dc/umb-producer

oc apply -f producer/openshift/service.yaml

oc get route umb-service --template='http://{{.spec.host}}'

  • Now user should be able to post message json or text message to any topic
 curl -X POST -H 'Content-Type: application/json' <umb-service-route-url>/produce -d '{"topic": "topic://VirtualTopic.qe.ci.product-scenario.test.complete", "message": {}}'               

Response: 

{
    "Message": "message sent successfully! to topic topic://VirtualTopic.qe.ci.product-scenario.test.complete"
}

UMB notifications

You can easily produce a message to UMB topic to notify if your pipeline has failed or run sucessfully. There is a script in misc/send-umb-interop-notifier.py or misc/send-umb-iib-notifier.py that can help you with that, with the help of the finally tasks in your pipeline.

At the end of your pipeline add this block :

  finally:
  - name: finally
    workspaces:
    - name: kubeconfig
      workspace: kubeconfig
    params:
    - name: artifacts
      value: $(tasks.echo-artifacts.results.artifacts)
    taskSpec:
      workspaces:
      - name: kubeconfig
      params:
      - name: artifacts
        description: artifatcs of previous taskruns
      steps:
        - name: send-umb-notification
          env:
            - name: UMB_WEBHOOK_URL
              value: "http://umb-service-umb.apps.cicd.tekton.codereadyqe.com/produce"
            - name: PIPELINERUN
              valueFrom:
                fieldRef:
                  fieldPath: metadata.labels['tekton.dev/pipelineRun'] 
            - name: LOG_URL
              value: "openshift"
            - name: VERSION
              value: $(tt.params.layered_product_version)
            - name: XUNIT_URLS
              value: $(params.artifacts)
            - name: KUBECONFIG
              value: $(workspaces.kubeconfig.path)/kubeconfig  
          image: quay.io/praveen4g0/umb-notifier:latest
          command: ["/code/send-umb-interop-notifier.py"]
          # command: ["/code/send-umb-iib-notifier.py"]

How to use?

  • Here is, sample resources to guide you, how to settup pipelines by consuming umb services.

  • Apply trigger resources

oc apply -f https://raw.githubusercontent.com/praveen4g0/umb/v0.0.1/demo/dummy-resources/eventlistener.yaml

oc apply -f https://raw.githubusercontent.com/praveen4g0/umb/v0.0.1/demo/dummy-resources/triggerbinding.yaml

oc apply -f https://raw.githubusercontent.com/praveen4g0/umb/v0.0.1/demo/dummy-resources/triggertemplate.yaml

oc expose svc el-demo-interop-listener

sink_url=$(oc get route el-demo-interop-listener  --template='http://{{.spec.host}}')
  • now $sink_url will be your sink url to configure in consumer service to receive configured messages from umb topic see sample configration here to receive notifications from umb consumer service.

umb's People

Contributors

praveen4g0 avatar

Watchers

James Cloos 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.