DevOps Automation

DevOps Automation

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Urban Code Deploy - calling a custom application/process from Jenkins

    Posted Mon July 11, 2022 02:10 PM
    I need to create a Jenkins pipeline which can invoke a custom application created in UCDeploy. This application is not a routine deployment operation. I can find abundant examples of Jenkins pipeline code which can upload and deploy artifacts and software. Code like this:

    step([
       $class: 'UCDeployPublisher',
       siteName: "${siteName}",
       deploy: [
          $class: 'com.urbancode.jenkins.plugins.ucdeploy.DeployHelper$DeployBlock',
          deployApp: "${app}", ...​


    I have references to a GitHub repo for the Jenkins plugin: https://github.com/UrbanCode/jenkins-pipeline-ucd-plugin . However, I cannot even tell if this is official. It is forked from another repo, has all broken documentation links and does not accept Issues. I guess I could study the source code and try to reverse engineer what I need. Everyone knows that Jenkins is the hardest interface in the world and I have not succeeded in ever understanding the source code of a plugin for it. I think one must first be an expert in Jenkins.

    Assistance, documentation, code samples would all be appreciated.



    ------------------------------
    Kevin Buchs
    ------------------------------


  • 2.  RE: Urban Code Deploy - calling a custom application/process from Jenkins

    Posted Tue July 12, 2022 06:17 AM
    I have updated the documentation and added the referenced article as a blog here: https://community.ibm.com/community/user/wasdevops/blogs/osman-burucu/2022/07/12/jenkins-pipeline-plug-in-tutorial-component-versio

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



  • 3.  RE: Urban Code Deploy - calling a custom application/process from Jenkins
    Best Answer

    Posted Tue July 12, 2022 03:02 PM
    It turns out, the Jenkins pipeline for this is just like deploy pipeline.

    For this example, my custom UCDeploy application is called "my-custom-app", the environment is "staging", the process is "glFetch". That process takes two arguments, appShort and assetId. My UCD site is named: "my site". Here is a partial pipeline:

    pipeline {
    
      parameters {
        string(name: 'appShort')
        string(name: 'assetId')
      }
    
      environment {
        appShort = "${params.appShort}"
        assetId = "${params.assetId}"
      }
    
      stages {
        stage ('Run UCD') {
          steps {
            step([
              $class: 'UCDeployPublisher',
              siteName: 'my site',
              deploy: [
                $class: 'com.urbancode.jenkins.plugins.ucdeploy.DeployHelper$DeployBlock',
                deployApp: 'my-custom-app',
                deployEnv: 'staging',
                deployProc: 'gitFetch',
                deployReqProps: "appShort=${appShort}\nassetId=${assetId}"
              ]
            ])
          }
        }
      }
    }​


    ------------------------------
    Kevin Buchs
    ------------------------------