pipeline { environment { JAVA_HOME = '/tool/jdk1.6.0_45' ANT_HOME = '/tool/ant1.7.1' } agent any stages { stage('Compile'){ steps { sh "$ANT_HOME/bin/ant compile compile_tests" } } stage('Test'){ steps { sh "$ANT_HOME/bin/ant test" junit 'reports/*.xml' script{ if (currentBuild.result == 'UNSTABLE') { currentBuild.result = 'FAILURE' error('Tests failed, failing the build!') } } } } stage('Package'){ steps { sh "$ANT_HOME/bin/ant create_run_jar" } } stage('Archive Artifacts') { when {triggeredBy 'UserIdCause'} steps{ archiveArtifacts artifacts: 'CrossJeeves.jar' } } } post { success { // Report success to Gitea giteaSetCommitStatus(context: 'success', description: 'Build Passed', targetUrl: env.BUILD_URL) } failure { // Report failure to Gitea giteaSetCommitStatus(context: 'failure', description: 'Build Failed', targetUrl: env.BUILD_URL) } } }