Important: As of May 24, 2024, the Perfecto Jenkins plugin will be deprecated. Current plugin installation will continue to work, but going forward, Perfecto will no longer provide bug fixes and maintenance services for this plugin. As an alternative, you can create a Jenkins pipeline with Perfecto Connect. To learn more, see Jenkins plugin > Step-by-step instructions > 4 | Work with Advanced usage scenarios > Create a Perfecto Connect pipeline.
Perfecto Jenkins Plugin provides the ability to auto-create/ re-use existing Perfecto Connect tunnel-id in build environment.
- Download Perfecto Connect client, extract to any folder.
- Generate Perfecto Security Token (if not generated already)
- Mac users should install Jenkins via brew.
- In Jenkins, navigate to Manage Jenkins > Manage Plugins view, available to administrators of a Jenkins environment. Search for “perfecto” under the Available tab, click on the checkbox near to it and then click on Install without restart button.
- Click New Item in Jenkins home page.
- Enter Your preferred Item name.
- Select any project type except pipeline.
- Click OK.
- Select Perfecto Connect checkbox under Build Environment (Refer Screenshots section)
- Note: Get help from your Jenkins Administrator to create the below Perfecto credentials:
a. Select Add option next to Credentials dropdown and select Jenkins.
b. Select option: “Perfecto” under Kind dropdown in Add Credentials window.
c. Provide Your Cloud Name, Username and Security Token and click on Add.
- Provide Perfecto Connect Path in Perfecto Connect Path text field.
a. E.g.: - /Users/Mymac/Downloads - Provide Perfecto Connect File Name in Perfecto Connect File Name text field.
a. E.g.: - Mac – perfectoconnect
b. E.g.: - Windows – perfectoconnect64.exe or perfectoconnect32.exe
You can provide Advanced options such as Perfecto Connect Additional Parameters, Override Tunnel ID Name and Existing Tunnel ID.
- Additional Parameters
a. Provide Perfecto Connect parameters such as bridgeproxyip, bridgeproxyport
b. E.g.: - --bridgeproxyip=127.0.0.1 --bridgeproxyport=8888 - You can override Tunnel ID Environment Variable name in Override Tunnel ID Name in text field. (The default Jenkins Build Environment variable name is tunnelId)
- You can reuse already created Tunnel ID in Existing Tunnel ID text field.
- Add a Post Build task under Post Build Action.
- Enter the below script under Script text field.
- Create a new Pipeline and add the below code to pipeline script text field.
- Update cloudName, securityToken and perfectoConnectPath as applicable.
import groovy.json.JsonSlurperClassic
import groovy.json.JsonSlurper
node {
String cloudName = "<<CLOUD NAME e.g. demo>>";
String securityToken = "<<SECURITY TOKEN>>";
String perfectoConnectPath = "/Users/myMac/Downloads/perfectoconnect";
environment {
tunnelId = ""
}
stage('perfectoconnect start'){
if(cloudName.contains("<<")){
error "Kindly update cloudName, securityToken and perfectoConnectPath"
}
String script = perfectoConnectPath + " start -c " + cloudName + ".perfectomobile.com -s " + securityToken;
echo script;
tunnelId = sh (script: script , returnStdout: true).trim()
env.tunnelId = "${tunnelId}"
}
stage('script'){
echo "Tunnel id: ${tunnelId}"
}
stage('perfectoconnect stop'){
sh label: '', returnStdout: true, script: perfectoConnectPath + " stop"
}
}
Follow this documentation to use curl and upload app to perfecto media repository.