Skip to content

Jenkins Pipeline Integration

Quick Start

Add the following configuration to your Jenkinsfile:

pipeline {
    agent { label 'node' } // Use a node with Node.js installed

    environment {
        ESCAPE_APPLICATION_ID = credentials('ESCAPE_APPLICATION_ID')
        ESCAPE_API_KEY = credentials('ESCAPE_API_KEY')
    }

    stages {
        stage('Checkout') {
            steps {
                checkout scm // Checkout the codebase from the SCM provider
            }
        }

        stage('Post-Deploy') {
            when {
                branch 'staging' // Only run on the 'staging' branch
            }

            steps {
                script {
                    // Install the Escape CLI tool
                    sh 'npm install -g @escape.tech/action'

                    // Show the installed Escape CLI version
                    sh 'npm show @escape.tech/action version'

                    // Run Escape action
                    sh 'escape-action'
                }
            }

            post {
                always {
                    // Configuration to allow failure
                }
            }
        }
    }
}

Configuration Options

Environment Variables

  • ESCAPE_APPLICATION_ID: Your Escape application identifier (stored in Jenkins credentials)
  • ESCAPE_API_KEY: Your Escape API key (stored in Jenkins credentials)

Pipeline Settings

  • agent: Specify Node.js-enabled agent
  • stages: Define pipeline execution flow
  • when: Control stage execution conditions
  • post: Configure post-execution actions

Failure behavior

The Escape CLI will: - Exit with code 1 if high-severity issues are found - Can be configured to fail on different severity levels

Available variables and options

See CLI documentation for complete configuration options.