2

I have a groovy file which I need to use pipeline parameter in the shell script:

def call() {
    echo "current build number: ${currentBuild.number}"
    def pipelineValue = "${currentBuild.number}"
    sh '''
        cd /jenkins/jenkins/workspace/Run_Distribution_Self_Service/
        mkdir -p builds/{pipelineValue }/libs/jfrog_distribution_shared_lib/resources/com/amdocs/python_distribution_util
'''

How can I get the pipelineValue in the shell script and use it?

arielma
  • 1,308
  • 1
  • 11
  • 29

2 Answers2

1

Correct syntax:

mkdir -p builds/'''+pipelineValue+'''/libs/jfrog_distribution_shared_lib/resources/com/amdocs/python_distribution_util

the below link helped me: Pass groovy variable to shell script

arielma
  • 1,308
  • 1
  • 11
  • 29
0
def call() {
echo "current build number: ${currentBuild.number}"
def pipelineValue = "${currentBuild.number}"
sh '''
    cd /jenkins/jenkins/workspace/Run_Distribution_Self_Service/
    mkdir -p builds/${pipelineValue}/libs/jfrog_distribution_shared_lib/resources/com/amdocs/python_distribution_util
'''
yorammi
  • 6,272
  • 1
  • 28
  • 34