Skip to content

Jenkins Pipeline Integration

Add the following configuration to your Jenkinsfile:

pipeline {
    agent { label 'alpine/curl:8.12.1' } // Use an alpine container

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

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

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

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