SnazzyBootMan
SnazzyBootMan

Reputation: 739

Use a variable in 'git url' jenkins piplines

So when using a Jenkins pipeline I need to checkout a second git repository in a new folder:

dir('platform') {
        println("\n\n\n=== === ===> gitBranch ${gitbranch} ");

        dir('platform') {
            deleteDir()
        }

        git url: '[email protected]', credentialsId: '1234567890', branch: 'feature/Packer-server-image-builds' // clones repo to subdir
}

When I try to use a variable to set the branch the command fails:

git url: '[email protected]', credentialsId: '1234567890', branch: '${gitbranch}'

What do I need to do to get this working?

Upvotes: 2

Views: 54

Answers (1)

darc
darc

Reputation: 530

use " instead of ' to use variables: "${gitbranch}"

Upvotes: 2

Related Questions