我想将git diff shell脚本的输出保存到变量中,并在其上运行用户定义函数。我该如何声明要编写的这些函数,以及如何使用它们?
pipeline{
agent any
parameters {
string(name: 'branchA', defaultValue: 'master', description: 'Comapare which branch?')
string(name: 'branchB', defaultValue: 'dev', description: 'Compare with which branch?')
}
stages {
stage('Build') {
steps{
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanBeforeCheckout']],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'gitCreds', url: "https://github.com/DialgicMew/example.git"]]])
sh "git diff --name-only remotes/origin/${params.branchA} remotes/origin/${params.branchB}"
}
stage('Functions on the result') {
steps{
echo "Functions to be used here"
}
}
}
}
```