Set up your SCM system
If your CI server is set up to work with a Source Control Management (SCM) system, such as Git or Subversion (SVN), ALM Octane can help you track committed changes. For details, see Track commits to your SCM system.
This topic explains how to customize SCM-related functionality.
Enable links to the Git or SVN viewer
For each file displayed in the list of changed files, ALM Octane can provide links to the file view and diff view in your repository viewer. To enable this, configure templates for the HTTP links.
This functionality is provided for repository viewers whose HTTP link templates include the file path and the revision.
To configure templates for links to your repository viewer:
-
In Settings > Spaces, select the workspace that is set up to integrate with your CI server.
-
Click the DevOps tab. On the left side of the pane, select SCM Repositories.
This page lists any Git and SVN repositories that integrate with your CI servers.
Note: A repository is only displayed in this list after a pipeline run includes commits to the repository.
-
For each repository (each row in the grid) enter the following:
• File link template. A template for the HTTP link to the file view of a selected file.
• Diff link template. A template for the HTTP link to the diff view of a selected file version.
• File in branch link template. A template for the HTTP link to the branch view, or the selected file in the branch.
The file and diff templates must include the placeholders
{filePath}
or{revision}
. The branch template should include{branchName}
, and should also include{filePath}
in order to link the selected file in the branch. ALM Octane replaces these with the relevant file's path, revision, and branch when creating the links.
Examples of link templates
The following are examples of templates for the available repository viewers.
-
File link template:
<REPOSITORY_URL>/browse/{filePath}?until={revision}&untilPath={filePath}
-
Diff link template:
<REPOSITORY_URL>/commits/{revision}#{filePath}
-
Branch template:
<REPOSITORY_URL>/browse/{filePath}?at={branchName}
-
File link template:
<REPOSITORY_URL>/blob/{revision}/{filePath}
-
Diff link template:
<REPOSITORY_URL>/commit/{revision}#{filePath}
-
Branch template:
{repoUrl}/tree/{branchName}/{filePath}
-
File link template:
<REPOSITORY_URL>?path={filePath}&_a=contents&{revision}
-
Diff link template:
<REPOSITORY_URL>/commit/{revision}?refName={branchName}&path={filePath}
-
Branch template:
{repoUrl}?version=GB{branchName}/{filePath}
Customize SCM change patterns
You can use message patterns in your branches, commits, and pull requests to associate them with ALM Octane entities.
If the specified pattern appears either in a branch name, commit message, or in the title or description of a pull request, the branch, commit, or pull request will be associated with the corresponding entity in ALM Octane.
To modify default message patterns or define new patterns using Java regular expressions:
-
In Settings > Spaces, select the workspace that is set up to integrate with your CI server.
-
Click the DevOps tab. On the left side of the pane, select SCM Change Patterns.
-
Define the message patterns to use for associating branches, commits, and pull requests with ALM Octane entities.
-
Commits can be associated with user stories, quality stories, and defects.
-
Branches and pull requests can be associated with the above entities, and with features.
Change an existing pattern, or click + to add a new pattern. Using Java regular expressions, design a pattern that contains a single capturing group containing the story ID.
For example, the default pattern
defect\s*#(\d+)
represents the stringdefect<any number of spaces>#<defect id>
.The patterns are not case sensitive.
-
-
Click Validate pattern in the toolbar, to experiment with your patterns and make sure that they match the string that you had in mind.
For example, in the Validate Pattern dialog box, enter an experimental commit message. Click Validate to see the stories that your commit patterns associate with this comment.
Repeat this step to test all of the patterns you defined.
Example: This commit message includes the string
user story #4
. Therefore, it matches the pattern for user stories: -
Make sure to tell your SCM users about the patterns their branch names, commit messages, and pull requests must follow, in order to be associated in ALM Octane with their corresponding entities.
See also: