Release Automation

 View Only
  • 1.  API REST to run a deployment like Jenkins plugin

    Posted Jul 25, 2017 01:07 PM

    I’m trying to create the same flow of the Jenkins plugin with REST API.

    I think it uses run-deployment-plan and create-artifact-version or create-artifact-package-xml but is not clear how and in which order.

    For example I have this flow. Which API I have to call to reproduce it?

     



  • 2.  Re: API REST to run a deployment like Jenkins plugin
    Best Answer

    Posted Jul 25, 2017 06:06 PM

    Marco, you can achieve the desired behavior by leveraging the CA RA REST API.

     

    One simple option to do it in one REST Call is to use the run-deployment-plan operation.

     

    From the official documentation:

     

    run-deployment-plan

    Creates a deployment plan from an existing deployment template.

    An existing artifact package (by name) or a new one (supplied by XML) could be assigned to the deployment plan.

    The deployment plan is also assigned an artifact package, when supplied the artifact package name.

    The deployment plan can also load a manifest file when supplied one.

    Keep in mind that while this small description does not mention it clearly, you can provide a list of environments to run this newly created deployment plan on.

     

    Example

     

    Request:
    {   "deploymentPlan": "deployREST151",   "build": "buildREST2",   "project": "newVersion",   "deploymentTemplate": "deploymentTemplate",   "templateCategory": "newTmp",   "application": "Parameters test",   "deployment": "run_deployment61",   "environments": [     "Environment for Default Architecture"   ],   "deploymentStageToPerform": "none" }

    Response: 

    {   "result": true,   "deploymentResults": [     {       "envName": "Environment for Default Architecture",       "envId": "4",       "id": "9",       "description": "Successfully created deployment [run_deployment61] with id [9] on environment [Environment for Default Architecture] with id [4]",       "result": true     }   ],   "deploymentPlanDescription": "Successfully created a deployment plan [deployREST151] with id [74]",   "deploymentPlan": "deployREST151",   "deploymentPlanId": "74" }

     

    Detailed information regarding this operation is available here:

    /run-deployment-plan - CA Release Automation - 6.4 - CA Technologies Documentation 

     

    Please also see detailed information regarding the request and response parameters/JSON

    RunDeploymentPlanApiDto - CA Release Automation - 6.4 - CA Technologies Documentation - Request

    DeploymentPlanResponseApiDto - CA Release Automation - 6.4 - CA Technologies Documentation - Response

     

    General information regarding the CA RA RESTful API is available at:

    REST API Reference - CA Release Automation - 6.4 - CA Technologies Documentation 

     

    As a reminder, you can also use the CARA provided CLI for integrations if you're more comfortable with CLI than REST, more details here:

    Release Operations Center CLI Commands - CA Release Automation - 6.4 - CA Technologies Documentation 



  • 3.  Re: API REST to run a deployment like Jenkins plugin

    Posted Jul 26, 2017 03:38 AM

    Thanks. The parameters for run-deployment-plan on the CLI document are better documented than in the API. 

    But BEFORE to run the plan I've to create the package with create-artifact-package-xml or create-artifact-version. Or both? Not clear. The second one has the reference to the sw repository, which I need.



  • 4.  Re: API REST to run a deployment like Jenkins plugin

    Posted Jul 26, 2017 10:47 AM

    You have a couple different options, 

     

    Through run-deployment-plan you can pass an existing artifact package or provide an artifact package (in XML format - if not sure how it looks like, check an existing artifact package for its XML content)

     

    see the artifactPackageAsXML parameter



  • 5.  Re: API REST to run a deployment like Jenkins plugin

    Broadcom Employee
    Posted Aug 16, 2017 10:19 AM

    Hi Marco,

    Did the answer from Rafael answered your question? If it did please mark it as the right answer.
    When your question is not answered or you still have additional questions please let us know.

    With Kind Regards

    Dirk



  • 6.  Re: API REST to run a deployment like Jenkins plugin

    Broadcom Employee
    Posted Aug 18, 2017 03:33 AM

    Hi Marc

     

    I believe your questions has been answered, I will mark this as the correct answer.
    When your question is not answered or you still have additional questions please let us know.

     

    With Kind Regards

    Dirk