node('android') { try { stage 'Clean from prevoius build' sh """ rm -fR build/ || echo "dir does not exist"; """ stage 'Checkout branch' checkout scm stage 'Assemble applications' sh """ source ~/.profile make android-apps """ archiveArtifacts artifacts: 'output/*.apk' } catch(err) { currentBuild.result = "FAILURE" /*mail body: "project build error: ${err}" ,*/ /*from: 'ci@dinect.com',*/ /*replyTo: 'm.sokolov@dinect.com',*/ /*subject: 'project build failed',*/ /*to: 'm.sokolov@dinect.com'*/ throw err } finally{ sh """ echo "Build failed" """ } }