UrbanCode

 View Only
  • 1.  jenkins plugin UCDeployPublisher

    Posted Mon September 20, 2021 12:38 PM
    Hello I am using Jenkins scripted pipeline  to  call UCD process . I am trying to figure out how can i get the exit status from the called function def deployucd()

    base upon the status would like to fail/pass the jenkins pipeline

    calling function from a groovy file 
    deployucd(NAME)

    Here is the groovy file 

    #!/usr/bin/env groovy

    def deployucd(String Name) {
    stage (" Shakeout ${Name}") {
    step([$class: 'UCDeployPublisher',
    siteName: 'UCD Prod',
    deploy: [
    $class: 'com.urbancode.jenkins.plugins.ucdeploy.DeployHelper$DeployBlock',
    deployApp: APPLICATION_NAME,
    deployEnv: envName,
    deployProc: SHAKEOUTPROCESS,
    skipWait: false,
    deployReqProps: DEPLOYREQPROPS,
    deployVersions: DEPLOYVERSION,
    deployOnlyChanged: false
    ]
    ])
    }
    }

    ------------------------------
    Mehul prajapati
    ------------------------------


  • 2.  RE: jenkins plugin UCDeployPublisher

    User Group Leader
    Posted Tue September 21, 2021 12:48 PM
    Hello,

    Could you detail your question a little bit more as i haven't understood if you want to react on the result of the function call or is the question regarding the class invocation in the function?

    Regarding result of function call it could look like this:
    def returnValue // needs to be a global variable
    pipeline{
    ... your pipeline
    
    stage('DEPLOY')
    {
        steps
        {
            script
            {
                returnValue = deployUCD(NAME)
                echo "The return value is ${returnValue}"
            }
        }
    }
    ...​



    ------------------------------
    Osman Burucu
    Product Manager UrbanCode Family
    IBM
    Vienna
    00431211454746
    ------------------------------



  • 3.  RE: jenkins plugin UCDeployPublisher

    Posted Wed September 29, 2021 10:12 AM
    Hi

    so question was, i am using scripted jenkins pipeline as code 

    1. how can i get the the return value of  a function which is executing the UCDeployPublisher class.
    2. if the UCDeployPublisher is executed successfully what value does it return for success and failure 
    3 When the publisher class is called from deployUCD(NAME) i see this error in the logs 
    Skip artifacts upload to IBM UrbanCode Deploy - build failed or aborted.
    Exception occurred during Deployment of test environment. Aborting the stage.hudson.AbortException: Skip artifacts upload to IBM UrbanCode Deploy - build failed or aborted.- Error signal
    i am unable to understand why should it  try to upload the artifact ? my expectation is this class should deploy the code



    ------------------------------
    Mehul prajapati
    ------------------------------



  • 4.  RE: jenkins plugin UCDeployPublisher

    Posted 11 days ago
    I suspect that the deployment process doesn't have access to the artifacts that were built by Jenkins, and that's why it failed. Generally, there are two options when it comes to using the artifacts in a deployment.

    The first option is to upload the artifact set to UCD as a codestation version. When you run the deployment, you can then select the version that was created, and use the download artifacts step in your component process to place the artifacts on the agent's host. Take a look at this link for some instructions on how to push the artifacts from Jenkins into a component version using a pipeline script. Below is the relevant class. Refer to the linked content for how to use it.

    $class: 'com.urbancode.jenkins.plugins.ucdeploy.DeliveryHelper$Push'

    The second option is to host the artifacts in some repository and download them directly from there during the deployment. Note that you will still need to create the version for the component, but you would not need to upload the files to codestation. Instead of using the download artifacts step to download the artifacts from our codestation repo, you'd use the specific step from the plugin for the repo you are using in order to get the artifacts to the agent host, for example the Artifactory plugin.

    Long story short, in your pipeline script, I see that you are requesting a deployment to an application and telling it to deploy "deployVersions: DEPLOYVERSION", but I don't see where you are actually creating that version for the component that the application will deploy.

    I'd recommend running through the tutorials we have that are intended to upskill users on the functionality of UCD deployment and administration if you haven't already. Trying to use the Jenkins pipeline plugin without having gone through them is like trying to drive a race car after finishing driving school. There's quite a bit of underlying knowledge that would be helpful to know before you add the layer of Jenkins' complexity to the mix.


    ------------------------------
    Glenn Arpin
    ------------------------------