How Can We Help?

Search for answers or browse our knowledge base.

Recent Comments

    Archives

      Solutions

      Docs

      Contact

      SYNCNOW

      SyncNow logo SyncNow – connect teams , tools and processes

      Update Entity from Any System (Generic Connector)

      < All Topics

      Overview

      SyncNow enables information from any system to be published easily into work systems entities such as epic, feature, story or any other entity

      The following article elaborates the process of Setting generic system adapter notifications.

      Usage Examples

      1. Publish build information such build version into work system entities
      2. Link entities to build URL or mention the build URL in comments
      3. Publish security of code, work progress to work systems entities
      4. Update security status to entities mentioned in comments or a specific entity
      5. Create a security bug in the developer management work system
      6. Create a live and monitor live incidents from production systems

      Step By Step Instructions

      1. Create a generic connector – Set the connector name ,image and base URL
      1. It is recommended to set an IP address to restrict connector webhooks into SyncNow only from IP | IP Range
      2. Create a DevOps Gate process for SonarQube Scan Status with configuration like on images below
      3. Set map for SyncNow virtual entity which will represent the generic data to an entity in target system, map can be different for every entity type.
      An example of Jenkins Generic Adapter
      An example of build version publication into an work system entity

      And the for example the Jenkins groovy function to assist with sending the information in SyncNow API

      @NonCPS
      def getCommentsString() {
          def list = []
          def changeLogSets = currentBuild.changeSets               
          for (int i = 0; i < changeLogSets.size(); i++) {
              def entries = changeLogSets[i].items
              for (int j = 0; j < entries.length; j++) {
                  def entry = entries[j]
                  if (entry.msg != null) {
                     list.add("""${entry.commitId} on ${new Date(entry.timestamp)}: ${entry.msg.replaceAll("[\n\r]", " ")}""")
                  } 
              } 
          } 
          return list.join(',') 
      } 
      
      def PublishBuildInformation(){
      //publish Build URL into comments
            def commits = getCommentsString() 
            def payload = """
                               [                         
                                  {                               
                                      "eventRelativeURL": "/job/${JOB_NAME}/${env.BUILD_ID}",                                                             
                                      "comments": "${commits}",
                                      "commentLinkTitle": "Item Published in Build '${JOB_NAME}', version ${env.VERSION}.${env.BUILD_ID}"
                                  } 
                              ]  
                           """ 
                               
                           string responseComment = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', httpMode: 'POST', authentication: 'SyncNow', requestBody: "${payload}", url: "https://<SyncNowServer>/api/v1.0/app/DevOpsGate/Enrich/<DevOpsGateProcessID>?action=comment"                                        
                            
                           println("Commment Entity Status:  ${responseComment.status}")
                           println("Commment Entity Content: ${responseComment.content}")     
                           
      //publish Build version number into a field in work system entity
      def payloadVer = """
                               [                         
                                  {
                                      "fields": [ 
                                          {
                                              "key": "Param1", 
                                              "value": "${env.VERSION}.${env.BUILD_ID} "
                                          }                                     
                                      ],                                                          
                                      "comments": "${commits}"                                
                                  } 
                              ]  
                           """  
                          //Publish build version 
                           
                          string responseVer = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', httpMode: 'POST', authentication: 'SyncNow', requestBody: "${payloadVer}", url: "https://<SyncNowURL>/api/v1.0/app/DevOpsGate/Enrich/<DevOpsGateProcessID>?action=update"                                        
                            
                           println("Commment Entity Status:  ${responseVer.status}")
                           println("Commment Entity Content: ${responseVer.content}")       
                                           
         
      }
      
      1. Create custom parameter for example Param1, this parameter needs to be set a value in the post API payload in order to update | create | comment | Link to an entity.
      2. Navigate to the Configuration page and press the Create | Update an Entity button. Copy SyncNow API URL :

      To Create an entity in target system the URL should be

      {SyncNowBackend}/api/v1.0/app/DevOpsGate/Enrich/{DevOpsGateProcessID}?action=create

      To Update and entity the URL should be

      {SyncNowBackend}/api/v1.0/app/DevOpsGate/Enrich/{DevOpsGateProcessID}?action=update

      To add a comment with a link The URL Should be in the following format

      {SyncNowBackend}/api/v1.0/app/DevOpsGate/Enrich/{DevOpsGateProcessID}?action=comment

      To link a relative URL from the generic connector to the to an entity

      {SyncNowBackend}/api/v1.0/app/DevOpsGate/LinkIt/{DevOpsGateProcessID}
      1. Verify that the script is running and data is published to SyncNow
      Was this article helpful?
      0 out of 5 stars
      5 Stars 0%
      4 Stars 0%
      3 Stars 0%
      2 Stars 0%
      1 Stars 0%
      5
      How can we improve this article?
      Please submit the reason for your vote so that we can improve the article.
      Table of Contents
      Skip to content