我想在我通过“构建”命令触发的其他任务中使用工作流任务中的工作区。我需要使其灵活,因为我希望能够从具有不同工作区的各种工作流中触发这些作业,这就是为什么我不能提供硬编码的工作区路径的原因。
这是一些代码:
node {
git branch: branchName, credentialsId: '1337', url: 'https://i-didnt-provide-this.but-this-is-working.git'
def buildType = 'xxx'
def buildFlavor = 'yyy'
def hockeyAppId = 'zzz'
def buildTypeParam = new hudson.model.StringParameterValue('buildType', buildType)
def buildFlavorParam = new hudson.model.StringParameterValue('buildFlavor', buildFlavor)
def hockeyAppIdParam = new hudson.model.StringParameterValue('hockeyAppId', hockeyAppId)
def outputApkFilenameParam = new hudson.model.StringParameterValue('fileName', '*-{buildFlavor}-{buildType}.apk')
def proguardMappingParam = new hudson.model.StringParameterValue('mappingFile', '{buildFlavor}/{buildType}/mapping.txt')
build job: 'android_compile', parameters: [buildTypeParam, buildFlavorParam] //This needs the same workspace
build job: 'android_lint', parameters: [buildTypeParam, buildFlavorParam] //same here
build job: 'android_upload_hockey', parameters: [hockeyAppIdParam, outputApkFilenameParam, proguardMappingParam] //and here
}
提前感谢您的帮助