Skip to main content

Jenkins

Build and upload both your Android (APK) & iOS (IPA) to notify your testers for testing and feedback using Jenkins Freestyle Project & Pipeline

Build and upload both your Android (APK) & iOS (IPA) to notify your testers for testing and feedback using Jenkins Freestyle Project & Pipeline.


​

Install Jenkins with Docker

Assuming Docker is installed, use the following command to start the Jenkins server.

docker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home --name jenkins jenkins/jenkins:lts-jdk17

Open http://localhost:8080 and get the credentials from the log:

docker logs jenkins

Follow the instructions to complete the setup.


​

Setup the Jenkins job

Depending on how you use Jenkins, please choose one of the two options to upload your package.


​

Option 1: Freestyle Project

  1. Create a Freestyle Project job — do not include spaces in the name, e.g. upload-mobile-package

  2. Add parameters to the job as shown below

Parameter Type

Parameter Name

Default Value

Description

String Parameter

api_token

String Parameter

app_id

You can get it from your app page at https://portal.testapp.io/apps

Choice Parameter

release

It can be either both or android or ios

String Parameter

apk

/user/path/to/app.apk (if you select release both or android)

String Parameter

ipa

/user/path/to/app.ipa (if you select release both or ios)

String Parameter

release_notes

Manually add the release notes to be displayed for the testers

Boolean Parameter

notify

Send notifications to your team members about this release

Check TA-CLI for more info

  1. Add an Execute Shell build step, and paste the following code

export INSTALL_DIR=`pwd`
if [ ! -f ${INSTALL_DIR}/ta-cli ]
then
  curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash
else
  ${INSTALL_DIR}/ta-cli version | grep "You are using the latest version"
  if [ $? -ne 0 ]
  then
    curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash
  fi
fi
export PATH=$INSTALL_DIR:$PATH
chmod 0755 $INSTALL_DIR/ta-cli$INSTALL_DIR/ta-cli publish --api_token=$api_token --app_id=$app_id --release=$release --apk=$apk --ipa=$ipa --release_notes="$release_notes" --notify=$notify --source="Jenkins"
  1. Integrate with existing Jenkins CI process

Call this job from other jobs which build the APK/IPA packages.


​

Option 2: Pipeline (Jenkinsfile)

Add the below stage to your pipeline script after the build stage.

node {
    stage('Upload to TestApp.io') {
        api_token = 'Your API Token'
        app_id = 'Your App ID'
        release = 'both'
        apk = '/tmp/data/sample-app.apk'  // /user/path/to/app.apk (if you select release both or android)
        ipa = '/tmp/data/sample-app.ipa' // /user/path/to/app.ipa (if you select release both or ios)
        release_notes = "My release notes..."
        notify = false        // Install ta-cli
        sh '''
            export INSTALL_DIR=`pwd`
            if [ ! -f ${INSTALL_DIR}/ta-cli ]
            then
              curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash
            else
              ${INSTALL_DIR}/ta-cli version | grep "You are using the latest version"
              if [ $? -ne 0 ]
              then
                curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash
              fi
            fi
        '''
        // Upload to TestApp.io
        sh "./ta-cli publish --api_token=$api_token --app_id=$app_id --release=$release --apk=$apk --ipa=$ipa --release_notes=$release_notes --notify=$notify --source=Jenkins"    }
}

Tip: Once your CI/CD pipeline uploads a build, team members using the TestApp.io mobile app receive a push notification and can install the build with a single tap. You can also create share links to distribute builds to external testers and clients.


Need help? Contact us — we're happy to assist!

Did this answer your question?