Exercise 6.1 - SysML GitHub Reference Connection.
Objectives
The new learning objectives of this exercise are
to create a reference connection between an existing SysML element in Rhapsody and an existing element in GitHub,
to use it to open the GitHub repository from the connected element in Rhapsody,
to compare across the connection to see whether a later version of the GitHub element is available.
Preparation
This exercise assumes the student has
IBM Rational Rhapsody 8.2, 8.4, or 9.0 installed correctly on his or her machine with a valid license for use, and
Syndeia 3.4, 3.5, or 3.6 installed as a plugin for Rhapsody with a valid license for use
Syndeia GitHub interface, correctly installed with a valid license for user.
A Github repository network connection in the Syndeia Repository Manager
The user can use any GitHub repository network connection they have available, with access to at least on Git repository, with at least one branch with one or more files and one or more commits. It is generally advisable to carry out these exercises in a non-production repository, a "sandbox", set up for training and practice purposes.
Caution: Rhapsody has, by default, restrictions on the naming of SysML elements, which can create problems when Syndeia tries to create Rhapsody model elements that violate these restriction, e.g. beginning a SysML block name with a number. We recommend modifying any Rhapsody models you create to relax these restrictions. Modify the properties of the top-level package of the model under General::Model::NamesRegExp with the following string and save.
^(([a-zA-Z0-9_][a-zA-Z0-9_ ():-]*)|(operator.+))$
Exercise
GitHub is a Git-based software configuration management system (also called application lifecycle manager or ALM). The Syndeia 3.6 interface allows the user to create a Reference Connection between a Rhapsody element and GitHub branch, commit, tag or file.
Figure 1 Syndeia dashboard, Connection Manager tab, for creating Reference connection to Commit
Open the Syndeia Tutorial Testbed.rpy (Get it here - SysML Models, Profiles and Mappings.) model provided in Rhapsody. Open the Syndeia dashboard by right-clicking the Git Tutorial package and selecting Syndeia → Dashboard. Select a Syndeia Cloud project for the exercise, if necessary.
Switch to the Connection Manager tab, open the SysML model in the left column and your GitHub repository in the right. It should be expanded to show the repositories for which you have access, and some of the projects, branches, commits, folders, files, tags, and issues. The final result should look something like Figure 1.
Create a Reference connection between the SysML element Git Test Block and a commit in the Master branch of a project by selecting Reference Connection in the center panel and dragging Git Test Block onto the desired GitHub Commit (or vice versa), as shown by the arrow in Figure 1. In our example, we connect to a commit labeled 77180…
Check the connection created in the Connection Browser or Connection Search tab (be sure to Refresh/Get All to see the latest). See Figure 2.
Figure 2 Syndeia dashboard, Connection Browser tab, after completing reference connection
In Rhapsody, right-click Git Test Block in the Entire Model View browser and select Syndeia → Open Connected Artifacts. This should open GitHub in your default web browser to the Commit the block has been connected to, as in Figure 3. GitHub may require you to sign in, first, before showing the Commit.
Figure 3 GitHub web interface opened to Initial Commit via Open Connected Artifacts command
The same functionality is available for creating reference connections from SysML elements to files managed in GitHub. In Figure 4, we will drag Git Test Block to the README file under Files in the Master branch under Dirk-Sandbox.
Figure 4 Syndeia dashboard, Connection Manager tab, for creating Reference connection to file
On the Syndeia dashboard, Connection Browser, refresh and see that a second connection has been created from Git Test Block, this one to a GitHub file. Right-click it and select Compare Source & Target (see Figure 5).
Figure 5Â Syndeia dashboard, Connection Browser tab, showing Sync command
The Comparison Result tab should show something like Figure 6. The result is red, showing a difference. Git Test Block is connected to a file (starting fd4ee…), which has been modified in a later commit on the Master branch. The Latest Target column points to the newest version on the same branch (starting 80d8f…). The Compare Source & Target operation in the case of a Reference connection does not look at the contents of the two models, only whether there is a later version of the same target element in a configuration-managed repository.
Figure 6 Syndeia dashboard, Comparison Results tab, after completing Compare operation
To change the Reference connection from Git Test Block to the latest version of the file on the same branch, go to the Syndeia dashboard, Connection Browser, right-click the connection from Git Test Block and select Sync Source → Target. Now use Compare Source & Target to check that the SysML block is connected to the latest version of this file on this branch.
Note: Compare Source & Target will not act in the same way for the connection to a GitHub Commit. Commit is not a versioned artifact; effectively it is a version of a Branch.
Â