我必须尝试现在将Service与jenkins集成。我已经在我的环境中安装了Service Now插件https://github.com/jenkinsci/service-now-plugin/blob/master/README.md。我需要使用詹金斯管道脚本获取事故单
import groovy.json.JsonSlurper
pipeline{
agent any
stages {
stage("BUILD"){
steps{
node('master') {
script {
def response = serviceNow_getCTask serviceNowConfiguration: [instance: 'dev7xx0'], credentialsId: '105ff3e8-7c1a-49c7-a514-4727xxx7f8c', serviceNowItem: [sysId: '965c9e5347c12200e0ef563dbbxxxx6'],vaultConfiguration: [url: 'https://dev79850.service-now.com']
echo response.content
def ctaskResponse = new JsonSlurper().parseText(response.content)
echo ctaskResponse.result[0]
def ctaskNumber = ctaskResponse.result[0].number
}
}
}
}
}
}