Work with CI servers, pipelines, and builds

You can use API resources to collect information from your CI server and use it in ALM Octane.

For full functionality, work with CI Servers and pipelines using the ALM Octane UI and its associated plugins. For details about the overall process, including measuring your release and product quality and following your build progress, see the DevOps main flow in the ALM Octane User Guide.

The limited functionality that is available with the REST API is useful for those who cannot use the HPE ALM Octane CI plugin. See the information about the CI server versions that are supported by the plugin in the ALM Octane User Guide.

Here are the basic methods for working with CI servers, pipelines, and builds using the REST API.

Tip: There are many ways to use the REST API to work with CI servers, pipelines, and builds. We recommend you use the interactive API client to explore the syntax for other options. For details, see Interactive API Client  .

Add a CI server (POST)

Create a CI Server entity as a top-level context of CI data submitted. This is done once.

*** Request ***
POST .../api/shared_spaces/2002/workspaces/1003/ci_servers
Accepts:        application/json
Produces:       application/json
	{
		"data": [{
		    "name": "The server name, for display purposes",                 
		    "instance_id": "12345-123",        
		    "url": "http://some.url:8383",                                
		    "server_type": "teamcity"                                     
		}]
	}	
*** Response ***
	{
	    "total_count": 1,
	    "data": [
	        {
	            "type": "ci_server",
	            "creation_time": "2016-03-29T15:25:57Z",
	            "is_connected": false,
	            "instance_id": "12345-123",
	            "version_stamp": 1,
	            "name": "The server name, for display purposes",
	            "id": "6005",
	            "last_modified": "2016-03-29T15:25:57Z",
	            "url": "http://some.url:8383",
	            "server_type": "teamcity"
	        }
	    ]

}

See the results in the ALM Octane UI

After posting a CI server, you can check that it exists in the ALM Octane UI.

Note: When creating CI servers directly from within the ALM Octane UI, plug-ins make sure that the CI server is "connected." Because this CI server was created with the REST API, it is shown as NA. This is not a problem when working with the REST API for limited functionality. Continue working as usual.

Back to top

Examples

Back to top

Add a pipeline (POST)

Create a pipeline as it reflects the build flow to be tracked and visualized. This pipeline becomes the basic context for the tests to be submitted. This is done once.

Back to top

POST .../api/shared_spaces/<shared_space_id>/workspaces/1001/pipelines
Accept:     application/json
Produces:   application/json
*** Request ***
{
  "data": [
    {
      "jobs": [
        {
          "jobCiId": "MyRootJob",
          "name": "The name of the root job"
        },
        {
          "jobCiId": "MyNextJob",
          "name": "The name of the next job"
        }
      ],
      "name": "MyPipelineIDName",
      "root_job_ci_id": "MyRootJob",
      "server_ci_id": "MyInstanceID"
    }
  ]
}
*** Response ***
{
  "total_count": 1,
  "data": [
    {
      "type": "pipeline",
      "creation_time": "2016-06-27T10:27:40Z",
      "root_job": {
        "type": "ci_job",
        "id": "1079"
      },
      "version_stamp": 1,
      "name": "MyPipelineIDName",
      "ci_server": {
        "type": "ci_server",
        "id": "1004"
      },
      "current_release": null,
      "id": "1007",
      "last_modified": "2016-06-27T10:27:40Z",
      "root_node": {
        "type": "pipeline_node",
        "id": "1131"
      },
      "current_model": {
        "type": "pipeline_model",
        "id": "1007"
      }
    }
  ],
  "exceeds_total_count": false
}

See the results in the ALM Octane UI

After posting a pipeline and its jobs, you can check that they exist in the ALM Octane UI.

Back to top

Examples

Back to top

Update build statuses (PUT)

Add a build to a pipeline and update the status of the pipeline jobs. Each build is equivalent to an event in the pipeline. This is done on an ongoing basis.

PUT .../api/shared_spaces/<shared_space_id>/workspaces/1001/analytics/ci/builds
*** Request ***
{
	"serverCiId": "MyInstanceID",                      
	"jobCiId": "MyRootJob1",                                     
	"buildCiId": "MyBuildID1",                        
	"buildName": "Short name for build",        
	"startTime": 1456679398786,                                 
	"duration": 120490,                                         
	"status": "finished",                                       
	"result": "success",                                        
}

See the results in the ALM Octane UI

After updating a build, you can check it in the ALM Octane UI.

Back to top

View test results (test_results resource)

View test results in the context of the CI server, pipeline, and build. This is done on an ongoing basis. For details, see Push test results to ALM Octane.

Back to top

See also: