Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43894

Environment variables not resolved in Pipeline SCM -> Advanced clone behaviours -> Path of the reference repo


    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • Jenkins 2.89.3, workflow-job 2.18-SNAPSHOT

      Environment variables are not resolved in 'Advanced clone behaviours' -> 'Path of the reference repo to use during clone' when configuring git reference repository in the Pipeline SCM section.

      Steps to reproduce:

      • Create pipeline project
      • In configure: fill in repository URL, Branch Specifier and Script Path (Jenkinsfile).
      • In 'Additional Behaviours' select 'Advanced Clone Behaviours'. Set 'Path of the reference repo to use during clone' to some value depending on an environment variable, e.g. ${HOME}/jenkins/reference/big-git-repo.git
      • At URL, create a git repository with Jenkinsfile. Put 'node('master') { checkout scm }' in the Jenkinsfile.
      • Run the job. It will report: 
        Cloning repository ...URL...
         > git init ... # timeout=10
        ERROR: Reference path does not exist: ${HOME}/jenkins/reference/big-git-repo.git

      Would be very handy to have this feature. In my case, I want to use the 'checkout scm' shortcut in a pipeline script that runs several builds in parallel on different platforms. So I want to specify where a reference repository exists on a specific node. For instance, on a Windows node I want to put it in D:\jenkins\reference, on a Mac – to /Users/jenkins/reference and, finally, on linux – /home/jenkins/reference. I could set an environment variable ${REFERENCE} to the above values in node configuration and than use it in 'Path of the reference repo to use during clone' as ${REFERENCE}.


            atikhono Anna Tikhonova
            atikhono Anna Tikhonova
            3 Vote for this issue
            11 Start watching this issue