据我所知,你不能在Jenkins中有一个交互式命令提示符。但是,你可以使用 input 步骤获取反馈并在整个管道中使用它,如下所示:
input
def keys = sh(script: 'consul kv get -keys --http-addr=X key/path/ | awk -F / \'{print $(NF-1)}\'', returnStdout: true).trim().tokenize('\n') def choice = input message: 'Please choose a sub-key', parameters: [choice(choices: keys, description: '', name: 'Subkeys')] println "You chose $choice"