Skip to main content
Planview Customer Success Center

Modify via Gateway

The Modify via Gateway Integration template is only available in Editions that contain the Gateway add-on. See the Planview Hub Editions table to determine if your edition contains this functionality.

What is a Modify via Gateway Integration?

Modify via Gateway Integration

An integration is quite simply the flow of information between two or more collections. A Modify via Gateway Integration, specifically, locates and modifies existing artifacts in a work item or container collection that connects to a repository, when they are sent to Hub via a gateway collection. A gateway collection accesses event-based information in an external tool, such as Git or Jenkins, via an inbound webhook.

These types of events are “fire and forget” — they can modify something in your repository, but they don’t expect anything back. As such, they don’t mandate a full-blown two way synchronization; a lighter one-way integration can do the trick.  

Here is an example of what you can do with the Modify via Gateway integration template:

Example of Modify via Gateway Integration

When you configure a Modify via Gateway integration, you can customize the field flow and artifact filtering.

Video Tutorial

Check out the video below to learn how to configure the Modify via Gateway Integration template.

Note: This video assumes that you have already configured your repositories, models, and collections as outlined in the Quick Start Guide.

 

Use Case and Business Value

The Modify via Gateway integration creates traceability between artifacts across the software development lifecycle. Already existing artifacts in a repository collection will be located and modified in a specified way when artifacts are sent to Hub via a gateway collection. 

For example, if your development team uses Gerrit for code review and Jira for its agile work management, but would like to know which defects in Jira a given code review affects, or conversely which code reviews are associated with a given defect, you could set up an integration that would find an already-existing defect in Jira anytime a code review is sent in and append one of its fields with that code review’s URL. The integration can even include updating other Jira artifacts to which code reviews might pertain, such as stories and tech debt.

Screenshot 2023-06-29 at 4.41.23 PM.png

 

Template Affordances

The Modify via Gateway Integration Template allows you to update already-existing artifacts in target work item (repository) or container (repository) collection when artifacts are sent to Hub via a gateway collection.

 Template Affordances

Configuring a Modify via Gateway Integration

Configuring your Repository Collection

Before you begin configuring the integration itself, there are some steps that must be taken at the repository collection level:

To specify just how you would like incoming artifacts from your gateway collection to modify already existing artifacts in your repository collection, you need to identify which field(s) on your already-existing artifacts you would like to modify and then configure how the field(s) should be changed. In the example above, the URL to any incoming code reviews from a gateway collection is being added to the review field of the Jira defect.

This means that the Jira collection-to-model mapping is configured as such:

Screenshot 2023-06-29 at 4.47.40 PM.png

And here are how the transformations are configured between these fields:

Screenshot 2023-06-29 at 4.48.23 PM.png

The Append transform means that new values will be added to the field value, rather than overwriting it, leaving the Jira artifact itself looking like this:

Example Jira Artifact

Configuring Your Integration

To configure your integration, select Integrations at the top of the screen, then click New Integration.

Screenshot 2023-06-07 at 11.58.09 AM.png

Select the Modify via Gateway template.

Note: Depending on the edition of Hub you are using, you may not have all options shown here.

Screenshot 2023-06-29 at 4.51.18 PM.png

This will bring you to the New Integration screen:

Screenshot 2023-06-21 at 12.00.05 PM.png

Name your integration and select your repositories and collections:

Screenshot 2023-06-29 at 4.41.23 PM.png

You can click the Overview link on the right side of the Integration Configuration screen to get to the main display page.

Screenshot 2023-06-29 at 4.56.48 PM.png

Screenshot 2023-06-29 at 4.58.16 PM.png

Field Flow

The field flow configured for a given integration specifies which fields should flow in that integration. For Modify via Gateway integrations, you can choose to flow a given field (Update Normally) or to not flow a given field (No Update).

To get to the Field Flow screen, click Field Flow on the right side of the Integration Configuration screen.

Screenshot 2023-06-29 at 4.59.03 PM.png

Specifying your Key

The first thing you will need to do when you get to the Field Flow screen is to specify your key.

Specifying a key will enable Hub to find the existing artifact in your repository collection that is to be modified by the incoming gateway payload(s). The key can be a string or relationship field from the model.

If the key is a string field, then the value sent to that model field from the gateway payload will be used to look up the target artifact by Formatted ID. For this reason, the recommended field to use is the Formatted ID field.

If the key is a relationship field, then the artifact it references in the gateway payload will be used as the target artifact.

Screenshot 2023-06-29 at 5.01.20 PM.png

Note: Some repositories require extra information in order to uniquely identify a single artifact across multiple projects. One prime example is ALM. To ensure that enough information is sent in via your gateway collection to allow Hub to find the specific artifact you would like to modify, please take these steps:

  1. Add a field in your model of type relationship.
    • Screenshot 2023-06-29 at 5.03.55 PM.png
  2. In your gateway collection, notice that for the new field you are prompted to pick a target repository. Select the repository you'd like to target in this gateway integration.
    • Screenshot 2023-06-29 at 5.13.13 PM.png
  3. When you save, note that the example payload will be updated to include the pieces of information we need for that field to uniquely find artifacts.
    • Screenshot 2023-06-29 at 5.14.46 PM.png
  4. Finally, in your integration select that field as your key on the Field Flow screen.
    • Screenshot 2023-06-29 at 5.17.27 PM.png

Configure Field Flow

Once you have specified your key, you can configure your field flow. For each field, you can choose to flow information ('update normally') or not flow information ('no update'). You'll notice that field flow goes in one direction only — from the gateway collection into the repository or database collection.

You can see the names of the mapped artifact fields for each collection on the far left and far right, with the model fields displayed in the middle. By default, model fields without mapped repository fields are hidden. You can see all model fields by checking the Show unmapped fields checkbox. Constant values will be identified by a grey box and the constant value icon.

Screenshot 2023-06-29 at 5.18.58 PM.png

Field Flow Icons

On the Field Flow page, you will see a number of icons, which will help you understand any special properties or requirements for each field. If you hover your mouse over an icon, you will see a pop-up explaining what the icon means. You can also review their meanings in the legend below:

Icon Meaning

101397148.png

A constant value will be sent.

Note that:

  • If the icon is on the side of the collection, this means that a constant value will be sent to your model. This means that any time this collection is integrated with another collection, the other collection will receive this constant value for the field in question.
  • If the icon is on the side of the model, this means a constant value will be sent to your collection. This means that any time this collection is integrated with another collection, that this collection will receive this constant value for the field in question.

101397147.png

Collection field is read-only and cannot receive data.

101397146.png

101397145.png

To create artifacts in your collection, this field must be mapped to your model.

101397144.png

This is a required field in your model; it must be mapped to your collection.

101397143.png

This field will not be updated as part of your integration, due to how you have configured it. This field flow configuration can be changed if you'd like.

101397142.png

This field will not be updated as part of your integration because the mapping would be invalid. You do not have the option of changing this.

101397141.png

This field will update normally as part of your synchronize integration; this means it will be updated whenever it is modified on the corresponding artifact.

Artifact Filtering

Artifact Filtering enables you to set filters on an integration in order to limit which artifacts are eligible to flow in your integration.

To use a field for artifact filtering, it must:

  • Be a part of your model, and be mapped to the collection you are filtering from
  • Be one of the following field types:
    • Single Select
      • Note that in cases where 'allow unmapped values to flow' is enabled in the model, only fields that are already a part of the model will be considered for artifact filtering
    • Multi-Select
      • Note that in cases where 'allow unmapped values to flow' is enabled in the model, only fields that are already a part of the model will be considered for artifact filtering
    • Date
    • Date/Time
    • Duration
    • String

To configure Artifact Filtering, select Create filters (optional) from the Integration Configuration Overview screen, or select Artifact Filtering from the right pane of the Integration Configuration screen.

Screenshot 2023-06-29 at 4.59.13 PM.png

This will lead you to the Artifact Filtering Configuration screen, where you can configure one or more criteria for artifact filtering.

Note: You can click the Collapse All button to view an easy-to-read summary of your artifact filtering statements.

Screenshot 2023-06-29 at 5.23.22 PM.png

Running your Integration

Note: Please be aware that integrations will trigger changes in your end repositories and that misconfiguration can cause items to be duplicated or modified in unexpected ways. Additionally, there is no 'undo' in Hub or the repositories. If you have any questions, please contact customer care.

There are two ways to start or stop your integration:

From the Integration Configuration Screen

Simply click the Run button to run the integration, and the Stop button to stop the integration.

Screenshot 2023-06-29 at 5.24.27 PM.png

Screenshot 2023-06-29 at 5.24.41 PM.png

From the Integrations List Screen

Click Run or Stop next to each integration you would like to update. You can also use the Bulk Actions button to run or stop all integrations.

Screenshot 2023-06-29 at 5.28.37 PM.png

Screenshot 2023-06-29 at 5.28.51 PM.png

Viewing Your Integrations

See the Planview Hub Editions table to determine if your edition contains Integration Landscape View functionality.

When viewing your integrations, you have the option of viewing them in either Landscape or List mode.

Screenshot 2023-06-29 at 3.57.45 PM.png

Screenshot 2023-06-30 at 9.47.26 AM.png

Landscape View

See the Planview Hub Editions table to determine if your edition contains Integration Landscape View functionality.

Learn more about the Integration Landscape view in the video below:

Hub will default to the Landscape view, which enables you to visualize your entire integration landscape and see how your integrations relate to one another. Use our built-in filters to see as little or as much information as you'd like!

Here's a simplified view:

Screenshot 2023-06-29 at 3.57.45 PM.png

If you'd like to see additional information, you can utilize the filters, or click on a repository node to modify which information is shown.

Some examples of additional information you can see are:

  • Models
  • Artifact Types
  • Artifact Creation Directionality Arrows
  • List of all relevant integrations (see this by clicking on the repository node)
    • Indicator of whether each integration is running or not
  • Collections
  • Projects

Here's an example of a more detailed view:

Screenshot 2023-06-29 at 4.00.04 PM.png

List View

If you'd like, you can toggle to List view, which will show you a list of all integrations you have created.

You can use this view to:

  • Start an Integration
  • Stop an Integration
  • Delete an Integration
  • Click into an Integration and modify its configuration

Screenshot 2023-06-30 at 9.47.26 AM.png

Example Use Case

This is an example of how we at Planview utilize the Modify via Gateway template. Our integration flows changeset links and other information from Gerrit to a field on already-existing artifacts (such as stories, epics, and defects) in Jira.

Here's how the integration configuration screen looks for that integration:

screencapture-2023-06-30-09_56_27.png

The image below illustrates how the changeset is sent to Hub after the developers’ normal workflow:

Example Workflow

This is an example of the script that we use to automate the changesets being sent to Hub:

Example Script
#!/usr/bin/ruby
 
require 'rubygems'
require 'logger'
require 'net/http'
require 'openssl'
require 'json'

def getOption(name)
  return ARGV[ARGV.index("--"+name)+1]
end

def sendToLink(data)
  request = Net::HTTP::Post.new(LINK_URL)
  request.body = JSON.generate(data)
  request.content_type = 'application/json'
  request.basic_auth "tasktop", "tasktopSecret"
  uri = URI.parse(LINK_URL)
  response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https', :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
      http.request(request)
  end
  if ! response.kind_of? Net::HTTPSuccess
    LOGGER.warn "Error sending to link: #{response.body}"
  end
end

LINK_URL = "https://tt-data350:8443/api/v1/artifacts/changesets"
TASK_ID_PATTERN =  /Task-Url:\s*https:\/\/tasktop.atlassian.net\/browse\/([^\s]*)/
REVIEW_URL_PATTERN = /.*Reviewed-on:\s+([^\s]*)/m
LOGGER = Logger.new('/shared/gerrit/tasktop-site/logs/hook-change-merged.log','monthly')
ENABLED_PROJECT_KEYS = ["APPS", "SYN", "SDK", "PLAT", "OPS", "CON", "DEV", "QA", "RLIASE"]

project = getOption('project')
commit = getOption('commit')
branch = getOption('branch')

LOGGER.debug("Processing merge for commit #{commit} on project #{project}")

gitPath = ENV['GIT_DIR']
message = `git --git-dir #{gitPath} show -s --format=%B  #{commit}`
taskIdMatch = TASK_ID_PATTERN.match(message)
if taskIdMatch
  taskKey = taskIdMatch.captures[0]
  LOGGER.debug("Detected taskKey: #{taskKey}")
  taskKeyMatches = ENABLED_PROJECT_KEYS.any? { |project| taskKey.start_with?(project + "-")} 
  if ! taskKeyMatches
    LOGGER.info("#{taskKey} project not enabled, skipping");
    exit()
  end
  reviewUrlMatch = REVIEW_URL_PATTERN.match(message)
  webUrl = nil
  if reviewUrlMatch
    webUrl = reviewUrlMatch.captures[0]
  else
    LOGGER.error("Could not get webUrl from commit #{commit}")
    webUrl = "commit #{commit}"
  end
  firstLineOfMessage = message.lines.first.chomp
  firstLineOfMessage = firstLineOfMessage.gsub(/#{taskKey}:? /,'')
  sendToLink({"formatted_id" => taskKey, "info" => "#{webUrl} [#{branch}] (#{firstLineOfMessage})"})
else
  LOGGER.debug("No task key found")
end 

This image more clearly highlights how these changesets are reflected on the Jira artifacts:

Synchronized Changesets and Jira Artifacts

 

Viewing Associated Configuration Elements

To view associated configuration elements (such as collections or models that utilize the integration you are viewing), click the Associated Elements tag in the upper right corner of the screen.

Screenshot 2023-06-29 at 5.31.41 PM.png

Screenshot 2023-06-29 at 5.31.57 PM.png