0

I just simply want to pass the repo name cloud-nates in shared pipeline, so i've passed the parameter deployName from jenkinsfile to shared library. below is the Jenkinsfile

@Library("minePipelines@auto") _
    if (env.BRANCH_NAME in ["auto", "stage"]) {
        reloadDeploy {
            deployName = "cloud-nates" 
        }
    }

And below is the shared-pipeline reloadDeploy.groovy code :

def call(body) {
    def config = [:]
    body.resolveStrategy = Closure.DELEGATE_FIRST
    body.delegate = config
    body()

    properties([disableConcurrentBuilds()])
   
    node("ops") {
        timeout(unit: 'SECONDS', time: 60) {
            stage("Reload Deployment") {
                echo params.deployName
            }
        }
    }
}

This prints null in console o/p. i've googled it but no luck :(

please feel free to ask any doubts.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Andrew
  • 124
  • 1
  • 12
  • 1
    The `deployName` parameter is available via the `config` map, not threw the `params` map, so just try: `echo config.deployName` and it should work. – Noam Helmer May 08 '22 at 12:35

0 Answers0