Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43256

SSE event subscription should be organization aware

    • Blue Ocean - 1.1-beta-1, Blue Ocean - 1.1-beta2, Blue Ocean 1.1-beta4

      BlueOcean UI subscribes to SSE event without providing organization in the subscription filter.

      There are couple of places it needs to add jenkins_org in the sse subscription filter:

      For example:

      this.jobListener = this.connection.subscribe('job', (event) => {
                      this._handleJobEvent(event);
                  }, {
          jenkins_org: 'org-1'
      });
      

      See tfennelly comments for detail.

          [JENKINS-43256] SSE event subscription should be organization aware

          Tom FENNELLY added a comment -

          The jenkins org is set as a property on all events (see screenshot), so should just be a case of tweaking the SSE subscription in the UI code to specify the org as a filter.

          Tom FENNELLY added a comment - The jenkins org is set as a property on all events (see screenshot), so should just be a case of tweaking the SSE subscription in the UI code to specify the org as a filter .

          Tom FENNELLY added a comment - - edited

          So as an example:

          var sse = require('@jenkins-cd/sse-gateway');
          
          var connection = sse.connect();
          
          // Add a filter as the last parameter ...
          var jobSubs = connection.subscribe('job', function (event) {
              // the events coming through here are only from the "org-1" Jenkins org
          }, {
              jenkins_org: 'org-1'
          });
          

          So in the Blue 0cean code, we need to find out where the subscriptions are setup and then add that filter to them.

          Tom FENNELLY added a comment - - edited So as an example: var sse = require( '@jenkins-cd/sse-gateway' ); var connection = sse.connect(); // Add a filter as the last parameter ... var jobSubs = connection.subscribe( 'job' , function (event) { // the events coming through here are only from the "org-1" Jenkins org }, { jenkins_org: 'org-1' }); So in the Blue 0cean code, we need to find out where the subscriptions are setup and then add that filter to them.

            vivek Vivek Pandey
            jamesdumay James Dumay
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: