码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2020-10-18 09:32:24      阅读:36      评论:0      收藏:0      [点我收藏+]

标签: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>"
}
然后设置为描述信息

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

标签:return   select   二维码   always   返回   The   sub   lease   php   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!