标签:return select 二维码 always 返回 The sub lease php
pipeline {
agent {
label ‘Linux‘
}
parameters {
gitParameter branch: ‘‘, branchFilter: ‘.*‘, defaultValue: ‘origin/master‘, description: ‘代码分支‘, name: ‘project‘, quickFilterEnabled: false, selectedValue: ‘NONE‘, sortMode: ‘NONE‘, tagFilter: ‘*‘, type: ‘PT_BRANCH_TAG‘
}
stages {
stage(‘Checkout Code‘) {
steps {
checkout([$class: ‘GitSCM‘, branches: [[name: ‘${project}‘]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: ‘xxxxxxxxxxxxxxxxxxxxxx‘, url: ‘ssh://git@github.com/xxxx/xxxx.git‘]]])
}
}
stage(‘构建APK‘){
steps {
sh label: ‘‘, script: ‘‘‘
/usr/local/gradle-5.1.1/bin/gradle assembleRelease
‘‘‘
}
}
stage(‘上传APK‘){
steps {
sh label: ‘‘, script: ‘‘‘
cd app/build/outputs/apk/release
cp -rf *.apk app-release.apk
qrcode=$(curl -s -k -F "file=@app-release.apk" http://app.t.isjue.cn/upload.php)
echo ${qrcode}>qrcode
‘‘‘
script {
QRCODE = sh(returnStdout: true, script: ‘cd app/build/outputs/apk/release && cat qrcode‘)
VERSION = sh(returnStdout: true, script: "echo $project")
buildDescription "构建分支:${VERSION}<br><img src=${QRCODE}></img>"
}
}
}
}
post {
always {
echo ‘One way or another, I have finished‘
deleteDir() /* clean up our workspace */
}
success {
// buildDescription("<img src=${qrcode}></img>")
echo ‘I succeeeded!‘
}
unstable {
echo ‘I am unstable :/‘
}
failure {
echo ‘I failed :(‘
}
changed {
echo ‘Things were different before...‘
}
}
}
重点就是这句:
通过shell返回的结算,赋值为变量
script {
QRCODE = sh(returnStdout: true, script: ‘cd app/build/outputs/apk/release && cat qrcode‘)
VERSION = sh(returnStdout: true, script: "echo $project")
buildDescription "构建分支:${VERSION}<br><img src=${QRCODE}></img>"
}
然后设置为描述信息
标签:return select 二维码 always 返回 The sub lease php
原文地址:https://blog.51cto.com/fengwan/2542121