【发布时间】:2019-05-09 19:48:03
【问题描述】:
我想在我的 jenkins 工作中从 #bash 输出设置当前构建描述
Jenkins 构建输出设置为当前构建描述
例如,从字符串和选择参数设置修订和分支,我这样做:
parameters {
string(defaultValue: "", description: '11.00', name: 'REVISION')
choice(name: 'BRANCH', choices: 'trunk\nupdate', description: 'Branch')
}
stage('Set build') {
steps {
script {
// Set build parameters
currentBuild.description = "$REVISION $BRANCH"
}
}
}
假设我想获取我的磁盘空间 % #bash 执行并将其放在描述中...
stage('bash') {
steps {
script {
sh '''
DISK_SIZE="$(df -h --output='pcent' /mnt | grep -v "Use%")
}
currentBuild.description = "$DISK_SIZE"
}
}
例如,我想在构建描述中放置我的磁盘百分比。在这种情况下,我希望在描述%30
或者放置一些从当前构建中生成的其他人员。
【问题讨论】:
标签: bash jenkins groovy continuous-integration jenkins-pipeline