Malinda Peiris
Malinda Peiris

Reputation: 614

Jenkins groovy script parameter get from another job

I have one pipeline and one other job. i want to pass parameter.

This is my groovy script which is inside pipeline job.

pipeline {
    agent any 
    stages {
        stage('release') {
            steps {
                echo 'This is release!' 
                echo branch
                build job: projectname , parameters: [[$class: 'StringParameterValue', name: 'branch', value: branch]]
    }
}

So this branch i want to pass into build job. echo branch also printing perfectly.

And this is how i tried to get my branch name from release job

enter image description here This trigger an error.

org.tmatesoft.svn.core.SVNException: svn: E160005: Target path '/${branch}' does not exist

It does not resolve to the branch name which i want

Upvotes: 0

Views: 702

Answers (1)

Frankenstein
Frankenstein

Reputation: 693

This should work:

build job: projectname , parameters: [string(name: 'branch', value: "${branch}")]

Upvotes: 1

Related Questions