Skip to content

Commit

Permalink
feat(1.34): add build parameters
Browse files Browse the repository at this point in the history
1. Minimum Jenkins requirement: 2.164.1
2. Add `isUploadPgyer` build parameter
3. Add `uploadPgyerTimeout` build parameter
4. Upgrade pgyer api, add `channelShortcut` parameter
5. Change the default value of `installType` to 1
6. Optimize parameters verification
7. Upgrade Gson 2.8.6
8. Upgrade Ant 1.10.8
9. Upgrade OkHttp3 3.14.9
10. Optimize code to improve stability
  • Loading branch information
myroid committed Aug 15, 2020
1 parent 72d35e6 commit 6439339
Show file tree
Hide file tree
Showing 39 changed files with 793 additions and 442 deletions.
105 changes: 44 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,72 @@
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](http://opensource.org/licenses/MIT)  
[![upload-pgyer](https://img.shields.io/badge/upload--pgyer-1.24-brightgreen.svg)](https://github.com/myroid/jenkins-upload-pgyer-plugin)  
[![downloads](https://img.shields.io/badge/downloads-%3C1K-orange.svg)](https://github.com/myroid/jenkins-upload-pgyer-plugin)  
[![blog](https://img.shields.io/badge/blog-dafan.tech-red.svg)](http://dafan.tech)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](http://opensource.org/licenses/MIT)
![Jenkins Plugins](https://img.shields.io/jenkins/plugin/v/upload-pgyer)
![Jenkins Plugin installs](https://img.shields.io/jenkins/plugin/i/upload-pgyer)

### A simple introduction

[中文文档](./README_cn.md)

Pgyer's official website is [https://www.pgyer.com/](https://www.pgyer.com/)
[蒲公英官网文档](https://www.pgyer.com/doc/view/jenkins_plugin)

Pgyer can upload the application to the site, generate installation link and qr code user to open the installation link, or scan code qr code, can start installation.

### Install plugin

`Manage Jenkins` -> `Manage Plugins` -> `Available` -> `Search ` -> *enter* `Upload to pgyer` -> `install`

### Build parameters

In version 1.34, two build parameters were added, namely `isUploadPgyer` and `uploadPgyerTimeout`.

1. `isUploadPgyer` Used to control whether to upload the apk/ipa file to payer.

![isUploadPgyer](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/isUploadPgyer.png)

2. `uploadPgyerTimeout` Used to control the upload timeout, the unit is seconds, the default is 300 seconds.

![uploadPgyerTimeout](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/uploadPgyerTimeout.png)

### User's guidance
So this plugin can be uploaded to the pgyer platform!**And it can put the fields returned by pgyer into an environment variable, which you can use in other build steps**, You can select `upload to pgyer` by adding build steps or adding post-build steps.

### Screenshot
![](https://blog-1251473749.cos.ap-beijing.myqcloud.com/jenkins_upload_pgyer/upload-pgyer-1.png)
![](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/uploadPgyerInstruction.png)

### Introduction to parameters
field|explanation
----:|:----------
pgyer uKey|`(APIV1 Required, APIV2 NO)` User Key, used to identify the current user's identity, <br/>for the same pgyer registered users, the value of the fixed!<br/>[Click to get pgyer uKey](https://www.pgyer.com/account/api)
pgyer api_key|`(Required)` API Key, used to identify the identity of the API caller, <br/>if not specified, each interface needs to contain this parameter.<br/>For the same pgyer registered users, this value is fixed.<br/>[Click to get pgyer api_key](https://www.pgyer.com/account/api)
scandir|`(Required)` need to upload ipa or apk file base dir path!<br/> The default is ${WORKSPACE}, It means the path of the current project!<br/>It is using ant's DirectoryScanner class, [click to see DirectoryScanner class](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html)<br/>**It is equivalent to the parameters of the basedir method in the DirectoryScanner class!** [click to see basedir method](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#basedir)
file wildcard|`(Required)` need to upload ipa or apk file name, Support wildcards,<br/>like this: **/Test?/*.apk<br/>It is using ant's DirectoryScanner class, [click to see DirectoryScanner class](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html)<br/> **It is equivalent to the parameters of the includes method in the DirectoryScanner class!** [click to see includes method](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#includes)
installType|`(Optional)` application installation, the value is (1,2,3).<br/>1: public, <br/>2: password installed, <br/>3: invitation to install.<br/>The default is 1 public!
password|(Optional) set the App installation password, if you do not want to set the password, please pass empty string, or not pass.
updateDescription|`(Optional)` version update description, please pass empty string, or not pass.
scandir|`(Required)` Need to upload ipa or apk file base dir path!<br/> The default is ${WORKSPACE}, It means the path of the current project!<br/>It is using ant's DirectoryScanner class, [click to see DirectoryScanner class](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html)<br/>**It is equivalent to the parameters of the basedir method in the DirectoryScanner class!** [click to see basedir method](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#basedir)
file wildcard|`(Required)` Need to upload ipa or apk file name, Support wildcards,<br/>like this: \*\*/\*.apk<br/>like this: \*\*/Test?/\*_sign.apk<br/>It is using ant's DirectoryScanner class, [click to see DirectoryScanner class](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html)<br/> **It is equivalent to the parameters of the includes method in the DirectoryScanner class!** [click to see includes method](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#includes)
installType|`(Optional)` Application installation, the value is (1,2,3).<br/>1: public, <br/>2: password installed, <br/>3: invitation to install.<br/>The default is 1 public!
password|(Optional) Set the App installation password, if you do not want to set the password, please pass empty string, or not pass.
updateDescription|`(Optional)` Version update description, please pass empty string, or not pass.
channelShortcut|`(Optional)` The download short link of the specified channel that needs to be updated, only one channel can be specified, string type, such as: abcd.
qrcodePath|`(Optional)` If you need to download the qrcode, please enter the save path of the qrcode!otherwise, not download!
envVarsPath|`(Optional)` if you need to save info, please enter save file path! otherwise, not save!

### Running log
![](https://blog-1251473749.cos.ap-beijing.myqcloud.com/jenkins_upload_pgyer/jenkins_log.png)
![](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/upload_pgyer_running_log.png)

When it runs successfully, you can use the environment variables that are used! for example:

![](https://blog-1251473749.cos.ap-beijing.myqcloud.com/jenkins_upload_pgyer/upload-pgyer-3.png)

### Pgyer apiV1 returns a description of the field
environment variables|explanation
----:|:----------
appKey|App Key
appType|Application type (1:iOS; 2: Android)
appIsLastest|Is it the latest version (1: yes; 2: no)
appFileSize|App file size
appName|App Name
appVersion|App Version
appVersionNo|For Android version Numbers, iOS is always 0
appBuildVersion|pgyer builds build Numbers that distinguish historical versions
appIdentifier|Application package name, iOS for BundleId, Android for package name
appIcon|Application the icon of the key, get the address http://o1wh05aeh.qnssl.com/image/view/app_icons/[appIcon]
appDescription|Introduction to the Application
appUpdateDescription|Application update description
appScreenshots|Application the screenshot of the key, get the address http://o1whyeemo.qnssl.com/image/view/app_screenshots/[appScreenshots]
appShortcutUrl|Application short links
appCreated|Application upload time
appUpdated|Application update time
appQRCodeURL|Application the qr code address
appPgyerURL|Application pgyer url
appBuildURL|Application build pgyer url

### Pgyer apiV2 returns a description of the field
environment variables|explanation
----:|:----------
buildKey | Build Key is the only index ID that identifies the application
buildType | Application Type(1:iOS; 2:Android
buildIsFirst | Is it the first App? (1: Yes; 2: No;)
buildIsLastest | Is it the newest? (1: Yes; 2: No;)
buildFileSize | The size of App
buildName | App Name
buildVersion | The default is 1.0 (is the logo that to advertise the application, for example: 1.1, 8.2.1, etc.).
buildVersionNo | The version number of the uploaded package, the default is 1 (that is, the compiled version number, in general, the compiler will change once the version number. For iOS, is a string type; for Android it is an integer. For example: 1001 , 28 etc.)
buildBuildVersion | pgyer builds build Numbers that distinguish historical versions
buildIdentifier | Application package name, iOS for BundleId, Android for package name
buildIcon | Icon Key of application, URL is https://www.pgyer.com/image/view/app_icons/[Icon Key of application]
buildDescription | Application Description
buildUpdateDescription | Application Update Description
buildScreenShots | Application screenshots key, the address is https://www.pgyer.com/image/view/app_screenshots/[Application screenshots key]
buildShortcutUrl | App Download Url
buildCreated | App Upload time
buildUpdated | App Update time
buildQRCodeURL | App QR code Url
appPgyerURL|Application pgyer url
appBuildURL|Application build pgyer url
![](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/upload_pgyer_use_env.png)

### Change Log

Version 1.34(2020-08-15)

- **Minimum Jenkins requirement: [2.164.1](http://mirrors.jenkins.io/war-stable/2.164.1)**
- Add `isUploadPgyer` build parameter
- Add `uploadPgyerTimeout` build parameter
- Upgrade pgyer api, add `channelShortcut` parameter
- Change the default value of `installType` to 1
- Optimize parameters verification
- Upgrade Gson 2.8.6
- Upgrade Ant 1.10.8
- Upgrade OkHttp3 3.14.9
- Optimize code to improve stability

Version 1.33(2019-09-07)

- Fixed [SECURITY-1044](https://issues.jenkins-ci.org/browse/SECURITY-1044)
Expand Down
104 changes: 45 additions & 59 deletions README_cn.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,73 @@
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](http://opensource.org/licenses/MIT)&#8194;&#8194;
[![upload-pgyer](https://img.shields.io/badge/upload--pgyer-1.24-brightgreen.svg)](https://github.com/myroid/jenkins-upload-pgyer-plugin)&#8194;&#8194;
[![downloads](https://img.shields.io/badge/downloads-%3C1K-orange.svg)](https://github.com/myroid/jenkins-upload-pgyer-plugin)&#8194;&#8194;
[![blog](https://img.shields.io/badge/blog-dafan.tech-red.svg)](http://dafan.tech)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](http://opensource.org/licenses/MIT)
![Jenkins Plugins](https://img.shields.io/jenkins/plugin/v/upload-pgyer)
![Jenkins Plugin installs](https://img.shields.io/jenkins/plugin/i/upload-pgyer)

### 简单介绍

蒲公英官方网址 [https://www.pgyer.com/](https://www.pgyer.com/)
[蒲公英官网文档](https://www.pgyer.com/doc/view/jenkins_plugin)

蒲公英平台可以让开发者和企业将应用上传到网站,生成安装链接和二维码用户在手机上打开安装链接,或扫码二维码,即可开始安装!

因此,这款upload-pgyer的Jenkins插件可以让开发者将apk/ipa文件上传到蒲公英平台!**并且这款插件可以将蒲公英平台返回的应用信息解析后注入到Jenkins的全局变量中,这样你就可以很方便的在其他构建步骤中使用这些返回的信息**,你可以在Jenkins的job配置页面的`构建``构建后操作`这两个操作中点击添加构建步骤选择`upload to pgyer with apiVx`。然后你就可以看到类似下面图片的操作界面:
因此,这款upload-pgyer的Jenkins插件可以让开发者将apk/ipa文件上传到蒲公英平台!**并且这款插件可以将蒲公英平台返回的应用信息解析后注入到Jenkins的全局变量中,这样你就可以很方便的在其他构建步骤中使用这些返回的信息**

### 界面截图
![](https://blog-1251473749.cos.ap-beijing.myqcloud.com/jenkins_upload_pgyer/upload-pgyer-1.png)
### 安装插件

`Manage Jenkins` -> `Manage Plugins` -> `Available` -> `Search ` -> 输入 `Upload to pgyer` -> `install`

### 构建参数

1.34版本中添加了2个构建参数,分别是 `isUploadPgyer``uploadPgyerTimeout`

1. `isUploadPgyer` 用于控制是否将本次构建的apk/ipa文件上传到payer。

![isUploadPgyer](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/isUploadPgyer.png)

2. `uploadPgyerTimeout` 用于控制上传的超时时间,单位是秒,默认300秒。

![uploadPgyerTimeout](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/uploadPgyerTimeout.png)

### 使用指南

你可以在Jenkins的job配置页面的`构建``构建后操作`这两个操作中点击添加构建步骤选择`upload to pgyer with apiVx`。然后你就可以看到类似下面图片的操作界面:

![](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/uploadPgyerInstruction.png)

### 参数介绍
需要填写的字段|字段的解释
----:|:----------
pgyer uKey|`(APIV1必填,APIV2无此参数)` 用户Key,用来标识当前用户的身份,<br/>对于同一个蒲公英的注册用户来说,这个值在固定的。<br/>[点击获取_ukey](https://www.pgyer.com/account/api)
pgyer uKey|`(APIV1必填,APIV2无此参数)` 用户Key,用来标识当前用户的身份,<br/>对于同一个蒲公英的注册用户来说,这个值是固定的。<br/>[点击获取_ukey](https://www.pgyer.com/account/api)
pgyer api_key|(必填) API Key,用来识别API调用者的身份,<br/>如不特别说明,每个接口中都需要含有此参数。<br/>对于同一个蒲公英的注册用户来说,这个值在固定的。<br/>[点击获取_api_key](https://www.pgyer.com/account/api)
scandir|`(必填)` 需要上传的apk/ipa文件所在的文件夹或者父文件夹,<br/>当前默认路径是`${WORKSPACE}`,它代表了当前项目的绝对路径。<br/>这个功能的实现使用了ant框架的DirectoryScanner类,[点击查看DirectoryScanner类](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html),<br/>这个字段就是DirectoryScanner类中的basedir方法的参数[点击查看basedir方法](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#basedir)
file wildcard|`(必填)` 需要上传的apk/ipa文件的名字,支持通配符,<br/>就像这样: **/Test?/*.apk,<br/>这个功能的实现使用了ant框架的DirectoryScanner类,[点击查看DirectoryScanner类](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html),<br/>这个字段就是DirectoryScanner类中的includes方法的参数,[点击查看includes方法](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#includes)
file wildcard|`(必填)` 需要上传的apk/ipa文件的名字,支持通配符,<br/>就像这样: \*\*/\*.apk<br/>或者像这样: \*\*/Test?/\*_sign.apk,<br/>这个功能的实现使用了ant框架的DirectoryScanner类,[点击查看DirectoryScanner类](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html),<br/>这个字段就是DirectoryScanner类中的includes方法的参数,[点击查看includes方法](https://ant.apache.org/manual/api/org/apache/tools/ant/DirectoryScanner.html#includes)
installType|`(选填)` 应用安装方式,值为(1,2,3)。<br/>1:公开,2:密码安装,3:邀请安装。<br/>默认为1公开
password|`(选填)` 设置App安装密码,如果不想设置密码,请传空字符串,或不传。
updateDescription|`(选填)` 版本更新描述,请传空字符串,或不传。
channelShortcut|`(选填)` 所需更新的指定渠道的下载短链接,只可指定一个渠道,字符串型,如:abcd
qrcodePath|`(选填)` 如果你需要下载蒲公英返回的二维码,那么这里填写二维码的存储路径,<br/>如果你不需要下载,那么你不需要在这里填写任何内容。
envVarsPath |`(选填)` 如果你想存储蒲公英返回的上传信息,那么这里填写保存信息的文件路径,<br/>如果你不需要保存,那么你不需要在这里填写任何内容。

### 运行截图
![](https://blog-1251473749.cos.ap-beijing.myqcloud.com/jenkins_upload_pgyer/jenkins_log.png)
![](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/upload_pgyer_running_log.png)

当你的应用上传成功后,在Jenkins中你就能看到上面图片中的信息。同时,你就可以在其他构建步骤中使用蒲公英返回来的信息,例如我的经验:

![](https://blog-1251473749.cos.ap-beijing.myqcloud.com/jenkins_upload_pgyer/upload-pgyer-3.png)

### 蒲公英APIV1 返回字段说明
可以使用的环境变量|作用或解释
----:|:----------
appKey|App Key
appType|应用类型(1:iOS; 2:Android
appIsLastest|是否是最新版(1:是; 2:否)
appFileSize|App 文件大小
appName| 应用名称
appVersion|版本号
appVersionNo|适用于Android的版本编号,iOS始终为0
appBuildVersion|蒲公英生成的用于区分历史版本的build号
appIdentifier|应用程序包名,iOS为BundleId,Android为包名
appIcon|应用的Icon图标key,访问地址为 http://o1wh05aeh.qnssl.com/image/view/app_icons/[appIcon]
appDescription|应用介绍
appUpdateDescription|应用更新说明
appScreenshots|应用截图的key,获取地址为 http://o1whyeemo.qnssl.com/image/view/app_screenshots/[appScreenshots]
appShortcutUrl|应用短链接
appCreated|应用上传时间
appUpdated|应用更新时间
appQRCodeURL|应用二维码地址
appPgyerURL|应用主页地址
appBuildURL|本次上传的应用主页

### 蒲公英APIV2 返回字段说明
可以使用的环境变量|作用或解释
----:|:----------
buildKey | Build Key是唯一标识应用的索引ID
buildType | 应用类型(1:iOS; 2:Android
buildIsFirst | 是否是第一个App(1:是; 2:否)
buildIsLastest | 是否是最新版(1:是; 2:否)
buildFileSize | App 文件大小
buildName | 应用名称
buildVersion | 版本号, 默认为1.0 (是应用向用户宣传时候用到的标识,例如:1.1、8.2.1等。)
buildVersionNo |上传包的版本编号,默认为1 (即编译的版本号,一般来说,编译一次会变动一次这个版本号, 在 Android 上叫 Version Code。对于 iOS 来说,是字符串类型;对于 Android 来说是一个整数。例如:1001,28等。)
buildBuildVersion | 蒲公英生成的用于区分历史版本的build号
buildIdentifier | 应用程序包名,iOS为BundleId,Android为包名
buildIcon | 应用的Icon图标key,访问地址为 https://www.pgyer.com/image/view/app_icons/[应用的Icon图标key]
buildDescription | 应用介绍
buildUpdateDescription | 应用更新说明
buildScreenShots | 应用截图的key,获取地址为 https://www.pgyer.com/image/view/app_screenshots/[应用截图的key]
buildShortcutUrl | 应用短链接
buildCreated | 应用上传时间
buildUpdated | 应用更新时间
buildQRCodeURL |应用二维码地址
appPgyerURL| 应用主页地址
appBuildURL| 本次上传的应用主页
![](https://jenkins-upload-pgyer-1251473749.cos.ap-beijing.myqcloud.com/upload_pgyer_use_env.png)

### Change Log

版本 1.34(2020-08-15)

- **最低兼容Jenkins: [2.164.1](http://mirrors.jenkins.io/war-stable/2.164.1)**
- 添加 `isUploadPgyer` 构建参数
- 添加 `uploadPgyerTimeout` 构建参数
- 升级蒲公英API,添加 `channelShortcut` 参数
- `installType` 默认值设置为1
- 优化参数校验
- 升级Gson 2.8.6
- 升级Ant 1.10.8
- 升级OkHttp3 3.14.9
- 优化代码,提升稳定性

版本 1.33(2019-09-07)

- 修复[SECURITY-1044](https://issues.jenkins-ci.org/browse/SECURITY-1044)
Expand Down

0 comments on commit 6439339

Please sign in to comment.