Skip to content

Jenkins Pipeline Integration

This example requires Jenkins Docker Pipeline support and a node configured to run Docker containers. Add the following configuration to your Jenkinsfile:

pipeline {
    agent {
        docker {
            image 'alpine/curl:8.12.1'
            args '-u root'
        }
    }

    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 'apk add --no-cache bash'
                    sh 'curl -sf https://raw.githubusercontent.com/Escape-Technologies/cli/refs/heads/main/scripts/install.sh | bash'

                    // Show the installed Escape CLI version
                    sh 'escape-cli version'

                    // Run Escape action
                    sh 'escape-cli scans start ${ESCAPE_APPLICATION_ID} --watch'
                }
            }

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