Pass parameters to Jenkins shared library

1.4k Views Asked by At

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.

0

There are 0 best solutions below