Setting up CI/CD for a mobile application via Jenkins

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Setting up CI/CD for a mobile application via Jenkins
Complex
~3-5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

CI/CD Setup for Mobile Applications via Jenkins

Jenkins is chosen when you need complete infrastructure control, already have on-premise Jenkins in company, or security policies prohibit cloud CI. For mobile development this means: Linux controller for Android, macOS agent for iOS.

Jenkins Architecture for Mobile Development

Jenkins Controller (Linux/macOS)
    ├── macOS Agent (for iOS)
    │     ├── Xcode 16
    │     ├── fastlane
    │     └── CocoaPods / SPM
    └── Linux Agent (for Android)
          ├── JDK 17
          ├── Android SDK
          └── Gradle

Agents connect via SSH (Launch agents via SSH) or JNLP. For macOS agent—must be account with Keychain access to code signing certificates.

Jenkinsfile: Declarative Pipeline

pipeline {
    agent none

    environment {
        FASTLANE_SKIP_UPDATE_CHECK = 'true'
        MATCH_PASSWORD = credentials('match-passphrase')
        FIREBASE_TOKEN = credentials('firebase-cli-token')
    }

    stages {
        stage('Test iOS') {
            agent { label 'macos-m2' }
            steps {
                checkout scm
                sh 'bundle install --path vendor/bundle'
                sh 'bundle exec fastlane test'
            }
            post {
                always {
                    junit 'fastlane/test_output/report.junit'
                }
            }
        }

        stage('Build iOS Beta') {
            agent { label 'macos-m2' }
            when {
                branch 'main'
            }
            steps {
                sh 'bundle exec fastlane beta'
            }
        }

        stage('Build Android') {
            agent { label 'linux-android' }
            steps {
                checkout scm
                sh './gradlew test assembleRelease'
                archiveArtifacts artifacts: 'app/build/outputs/apk/release/*.apk'
            }
        }
    }

    post {
        failure {
            slackSend(
                channel: '#mobile-ci',
                color: 'danger',
                message: "Build failed: ${env.JOB_NAME} #${env.BUILD_NUMBER}"
            )
        }
    }
}

credentials('match-passphrase')—Jenkins Credentials Store. Secrets aren't in Jenkinsfile, only ID references.

Keychain Management on macOS Agent

Main pain point—Jenkins + iOS: running as background daemon, codesign cannot open Keychain without unlock. Solution—unlock at pipeline start:

stage('Unlock Keychain') {
    agent { label 'macos-m2' }
    environment {
        KEYCHAIN_PASSWORD = credentials('macos-keychain-password')
    }
    steps {
        sh 'security unlock-keychain -p $KEYCHAIN_PASSWORD ~/Library/Keychains/login.keychain-db'
        sh 'security set-keychain-settings -lut 3600 ~/Library/Keychains/login.keychain-db'
    }
}

set-keychain-settings -lut 3600—keychain doesn't lock for 1 hour (enough for build). Without this, after 5 minutes idle keychain locks automatically and codesign gets errSecInteractionNotAllowed.

Artifact Caching

Jenkins lacks built-in smart cache like GitHub Actions. Options:

Shared directory on agent. Folder ~/.gradle or ~/Library/Caches/CocoaPods saves between builds automatically—if always using same agent (sticky agent).

Jenkins Workspace Caching Plugin. Caches by hash of Podfile.lock/build.gradle, like GitHub Actions cache.

Artifactory/Nexus. For enterprise—cache Maven/Gradle dependencies through internal repository. GRADLE_USER_HOME=~/.gradle + Nexus mirror.

Parallel Stages

stage('Test Parallel') {
    parallel {
        stage('iOS Tests') {
            agent { label 'macos-m2' }
            steps { sh 'bundle exec fastlane test' }
        }
        stage('Android Tests') {
            agent { label 'linux-android' }
            steps { sh './gradlew test' }
        }
    }
}

Parallel iOS and Android test run reduces total time from ~20 to ~12 minutes.

Common Issues

  • xcodebuild cannot find simulator—must explicitly boot with xcrun simctl boot "iPhone 16" before test run on new agent
  • Gradle wrapper not found—need chmod +x gradlew in beginning of step
  • Build number conflicts on parallel builds—use ${env.BUILD_NUMBER} as suffix

Timeline

Jenkins Pipeline setup with macOS + Linux agents, test + deploy lanes: 1–2 weeks (including agents). Parallel builds support, Slack/Jira integration, Artifactory setup: another week. Cost calculated individually.