SCM data
This topic describes how you use the SCM data resource to send SCM data (repository, branch, commits) to the ALM Octane server.
Overview
The SCM data synchronous resource sends SCM information to the ALM Octane server.
You must log in to the server using the authentication API before using this resource. When authenticating, you must have sharedspace admin permissions. For details on authenticating, see Authenticating.
URI
.../api/shared_spaces/<space_id>/scm_commits
Supported HTTP methods
This resource supports only the PUT operation if it finds a matching pipeline run.
To determine the PUT, ALM Octane checks the remote ID defined in the external static code analysis tool, and provided in the payload.
The unique commit identifier is parentRevId. If the revision ID is found in the context but for a different repository/branch, the commit will be linked to the other repository .
The request
The request syntax for injecting SCM information is:
PUT .../api/shared_spaces/space_id/workspaces/<workspace_id>/scm-commits?instance-id='<instance_id>'&job-ci-id='<path_to_file>'&build-ci-id='<build_id>'
When PUTing, specify:
-
A query for identifying the pipeline run.
-
A request body containing the JSON payload that conforms to this syntax.
-
The Content-Type header field, set to application/json.
-
Optionally, the content can be compressed in gzip format. In this case, the Content-Encoding header field must be set to application/gzip.
The following table describes how to identify the corresponding pipeline run in request:
Item | Field |
---|---|
CI server ID |
instance-id |
Job name, such as Jenkins | job-ci-id |
Build ID |
build-ci-id |
The JSON payload in the request body
The payload in the request body describes the pipeline run that you want to update with SCM data.
You can specify more than one commit in the payload.
The payload uses the standard ALM Octane REST API syntax. Here is an example:
[{ "repository": { "type": "git", "url": " https://github.com/repository.git", "branch": "refs/remotes/origin/master" }, "commits": [{ "user": "user", "userEmail": "user@mail.com", "time": "1586269223000", "parentRevId": "e5358a5f1456aebbf5c436790179fe6b218def89", "comment": "some comment", "revId": "7583cc0704efd0ef96bbb4689a401d252adea821", "changes": [{ "type": "edit", "file": "src/…filePath/Example1.java", "renameToFile": null, "commitId": null } ] }, { "user": "user", "userEmail": "user@mail.com", "time": "1586269223000", "parentRevId": "e5358a5f1456aebbf5c436790179fe6b218def81", "comment": "some comment", "revId": "7583cc0704efd0ef96bbb4689a401d252adea822", "changes": [{ "type": "edit", "file": "src/…filePath/Example2.java", "renameToFile": null, "commitId": null } ] } ] }]
Field | Description |
---|---|
Repository | One element. |
type | Tool type: “svn","git","starteam". Free text string. |
url | URL to the SCM repository. |
branch |
Branch where commits were done. |
Commits | Array. |
parentRevId | Commit parentRevId, received from SCM tool. |
revId | Commit revId, received from SCM tool. |
comment | Commit comment, received from SCM tool. |
time | Commit time, received from SCM tool. |
userEmail | Email of the workspace user responsible for the vulnerability. ALM Octane uses this field to identify the user. Optional. |
user | User name. |
Changes | Array. |
type | “edit”, “add”, “delete”. Free text string. |
file | Changed file name. |
See also: