0

I am trying to integrate IBM Urban Code Deploy in my Jenkins pipeline. Earlier I have integrated UCD using freestyle job using IBM UrbanCode Deploy Plugin. Now When I am trying to do the same using pipeline script, it is giving error. Unable to find many resources on the internet. Here is my Deploy stage.

stage('Deploy') {
        steps {
            UCDeployPublisher (
                siteName: 'udeploy-server',
                component: [
                    componentName: 'DemoApp-APP',
                    delivery: [
                        pushVersion: '${BUILD_NUMBER}',
                        baseDir: '${WORKSPACE}',
                        fileIncludePatterns: '**/*',
                        fileExcludePatterns: '',
                        pushDescription: 'Pushed from Jenkins',
                        pushIncremental: false
                    ]
                ],
                deploy: [
                    deployApp: 'DemoApp',
                    deployEnv: 'Test 1',
                    deployProc: 'DemoApp Process'
                ]
              )
        }
    }

I am getting the following error.

java.lang.NoSuchMethodError: No such DSL method 'UCDeployPublisher' found among steps
Shivansh Kumar
  • 321
  • 1
  • 5
  • 16

1 Answers1

1

UCDeployPublisher is a class, not a step. According to the docs you can use it with general step:

stage('Deploy') {
    steps {
        step([$class: 'UCDeployPublisher',
            siteName: 'udeploy-server',
            // ... and so on
        ])           
    }
}
zett42
  • 25,437
  • 3
  • 35
  • 72
  • Tried the same but still getting error - `java.lang.UnsupportedOperationException: no known implementation of interface jenkins.tasks.SimpleBuildStep is named UCDeployPublisher` – Shivansh Kumar May 13 '20 at 05:02
  • @ShivanshKumar Are plugin and its dependencies correctly installed? – zett42 May 13 '20 at 07:04
  • Yes, as I have integrated UCD using freestyle job using IBM UrbanCode Deploy Plugin, and it is working fine. – Shivansh Kumar May 13 '20 at 09:18
  • @ShivanshKumar Try this: `$class: 'com.urbancode.jenkins.plugins.ucdeploy.UCDeployPublisher'` – zett42 May 13 '20 at 11:13
  • 1
    `$class: 'UCDeployPublisher'` works. Actually, for the freestyle project, I used the plugin `IBM UrbanCode Deploy Plugin` but for pipeline job the plugin needed was `IBM UrbanCode Deploy Pipeline (Build Steps) Plugin`. After installing and configuring this plugin the build was successful and was able to deploy. – Shivansh Kumar May 13 '20 at 11:46