Automic Continuous Delivery Automation

 View Only
  • 1.  Jenkins - Create CDA Package (Amend)

    Broadcom Employee
    Posted Nov 25, 2019 08:42 AM
    Hi Team,
     
    I have a scenario where - my CDA Application has multiple components, hence the package should have all the Component-Artifacts links.

    In my environment - One Jenkins job contains only one Artifact, Hence I have 4 Jenkins job for all the 4 artifacts which needs to be packaged.
    Currently, I'm getting an error if I use "Create CDA Package" in all the 4 Jenkins jobs with the same package name (different components).


    Is there any way I can invoke the "Create CDA Package" to amend the "Artifact" on the same package ? (similar to "fail if exists flag in API)


    Thanks 

    Jagan


  • 2.  RE: Jenkins - Create CDA Package (Amend)
    Best Answer

    Broadcom Employee
    Posted Nov 27, 2019 07:41 AM

    Hi @Jagan Sivanesan

    I assume you have already designed your application with components in CDA.

    I would do the following as part of your build process. Each Jenkins-job using REST POST method to create an CDA-artifact ​and assign it to the corresponding CDA-component.
    e.g.
    curl.exe -X POST %CDAUrl%/api/data/v1/artifacts --user %owner%:%password% --header "Content-Type: application/json" --data "{\"name\": \"%component_database%_build.%BUILD_NUMBER%\",\"artifact_source\":{\"name\":\"Artifact-Repo\"}, \"components\":[{\"application_name\": \"%app_name%\",\"component_name\": \"%component_database%\"}]}"

    This assigns the newly created artifact named %component_database%_build.%BUILD_NUMBER% to the CDA-component named %component_database% of the %app_name%.

    Before you start the deployment you have to create an CDA-Deployment Package (after all Jenkins builds finished successfully).
    e.g.
    curl.exe -X POST %CDAUrl%/api/data/v1/packages --user %owner%:%password% --header "Content-Type: application/json" --data "{\"name\": \"%app_name%_build.%BUILD_NUMBER%\",\"folder\":{\"name\":\"%package_folder%\"},\"custom_type\":{\"name\":\"%package_type%\"},\"application\":{\"name\":\"%app_name%\"}}"
    This assigned all the CDA-application's components with their latest assigned CDA-artifacts to the newly create Deployment Package named %app_name%_build.%BUILD_NUMBER%.

    In order to update an existing CDA-Deplyoment Package via REST you need the unique ID of it. You can retrieve this by using REST. This JSON-output can be modified e.g. adding CDA-artifact "reference" and used to update the Package via REST.



    ------------------------------
    Engineering Program Manager
    Broadcom
    ------------------------------



  • 3.  RE: Jenkins - Create CDA Package (Amend)

    Broadcom Employee
    Posted Nov 27, 2019 08:46 PM
    Hi Micheal,

    This is good, Guess I can achieve the use case by directly calling the API.

    At the moment, i use Jenkins/CDA integration to Artifact and I manually create/update Package via CDD (REST API) - via the unique Package Name.


    Maybe in the future, if the Jenkins plugin can facilitate this would be helpful.

    Thanks.






  • 4.  RE: Jenkins - Create CDA Package (Amend)

    Broadcom Employee
    Posted Sep 07, 2020 11:05 AM
    Hi,

    We are adding to the CDA plugin to CDD the option to create a package. This will allow you to automate the process you described above. 
    Every Jenkins job will send a notification to CDD once the build is done (and the artifact has been created), and CDD will send the create the package command to CDA from all the Jenkins' Jobs and run the application workflow.

    This will allow to fully automate the entire flow and to combine it with other release tasks, as test executions, build promotions, etc. 
    Please let me know if you need further information. 
    You can also contact me with CDD questions or request - assaf.shlomi@broadcom.com

    Thanks,
    Assaf

    ------------------------------
    ​Assaf Shlomi
    Principal Product Manager| Continues Delivery Director
    Broadcom

    assaf.shlomi@broadcom.com
    ------------------------------