首页 > 移动平台 > 详细

Jenkins 安卓打包在描述处显示二维码

时间:2020-10-17 11:58:13      阅读:40      评论:0      收藏:0      [点我收藏+]
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>"
}
然后设置为描述信息

Jenkins 安卓打包在描述处显示二维码

原文:https://blog.51cto.com/fengwan/2542121

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!