Jenkins脚本失败



我正在编写Jenkins管道脚本,但有一个错误:

No such DSL method '$' found among steps

在这一行:

+ mkdir -p /scratch/jenkins-build-results/Release

我搞不清楚问题出在哪里。我想我和params的工作不正确,但在哪里?

脚本摘录:

stage('Build and install')
{
steps
{
script
{
buildAndInstall( preset: 'gcc_release', destPath: getReleaseDestPath() )
}
}
}

def buildAndInstall(params)
{
bash("cmake --preset ${params.preset}", "Configure")
bash("cmake --build --preset ${params.preset}", "Building")

sh(script:"mkdir -p ${params.destPath}", label: "Creating a directory for ${params.preset} installation")

def buildDir = getBuildPath( preset : ${params.preset} )
sh(script:"cmake --install ./${buildDir} --prefix ${params.destPath}", label: "Installation")
}

def bash(String cmd, String label)
{ 
sh(script:"#/usr/bin/env bashnset -euo pipefailn${cmd}", label: label)
}

def getReleaseDestPath()
{
return "/scratch/jenkins-build-results/Release"
}

def getBuildPath( params )
{
// 'build' suffix is hardcoded in the cmake presets
return "build/${params.preset}"
}

问题出在这一行:

def buildDir = getBuildPath( preset : ${params.preset} )

它应该如下:

def buildDir = getBuildPath( preset : params.preset )

最新更新