DeployPulse

Automating CodePush Releases with Jenkins

DeployPulse integrates with Jenkins via a standard Declarative Pipeline. This guide walks through a Jenkinsfile that releases OTA updates to DeployPulse when code lands on your release branches.


Prerequisites

  • A DeployPulse account and app already created
  • deploypulse-access-key stored as a Jenkins Secret Text credential
  • Docker available on the Jenkins agent (for the node:20 image), or Node.js installed directly on the agent

Declarative Pipeline (Jenkinsfile)

dpctl picks up DEPLOYPULSE_ACCESS_KEY from the environment automatically. The credentials() binding injects the secret and masks it in console output.

pipeline {
  agent {
    docker {
      image 'node:20'
    }
  }

  environment {
    DEPLOYPULSE_ACCESS_KEY = credentials('deploypulse-access-key')
  }

  stages {
    stage('Install') {
      steps {
        sh 'npm ci'
      }
    }

    stage('Install dpctl') {
      steps {
        sh '''
          git clone https://github.com/deploypulseio/dpctl dpctl
          cd dpctl && npm install && npm run build && npm install -g
        '''
      }
    }

    stage('Release to Production') {
      when {
        branch 'main'
      }
      steps {
        sh '''
          dpctl release-react MyApp-iOS ios \
            --deployment Production \
            --dev false
        '''
      }
    }

    stage('Release to Staging') {
      when {
        branch 'develop'
      }
      steps {
        sh '''
          dpctl release-react MyApp-iOS ios \
            --deployment Staging \
            --dev false
        '''
      }
    }
  }
}

Staged Rollout

Add --rollout to limit the initial release to a percentage of users:

sh '''
  dpctl release-react MyApp-iOS ios \
    --deployment Production \
    --dev false \
    --rollout 15
'''

Promote to full rollout from the dashboard or with dpctl patch after verifying metrics.


Code Signing

Store the private key as a Jenkins Secret File credential (code-signing-key), then bind it in the environment block:

environment {
  DEPLOYPULSE_ACCESS_KEY = credentials('deploypulse-access-key')
  CODE_SIGNING_KEY       = credentials('code-signing-key')
}

// in steps:
sh '''
  dpctl release-react MyApp-iOS ios \
    --deployment Production \
    --private-key "$CODE_SIGNING_KEY" \
    --dev false
'''

See the Code Signing guide for key generation and app configuration.


Further Reading