我想弯曲一个URL并将响应捕获到一个变量中。
当我弯曲一个命令并回送它的输出时,我得到如下正确的响应
sh 'output=`curl https://some-host/some-service/getApi?apikey=someKey`;echo $output;'
我希望将相同的响应捕获到变量中,并使用该响应进行进一步的操作
下面是我的Jenkinsfile
pipeline {
agent {
label "build_2"
}
stages {
stage('Build') {
steps {
checkout scm
sh 'npm install'
}
}
stage('Build-Image') {
steps {
echo '..........................Building Image..........................'
script {
def response = sh 'curl https://some-host/some-service/getApi?apikey=someKey'
echo '=========================Response===================' + response
}
}
}
}
}
你能告诉我在我的詹金斯档案里需要做什么修改吗