|
|
@@ -36,7 +36,61 @@
|
|
|
<trim>false</trim>
|
|
|
</hudson.model.TextParameterDefinition>
|
|
|
<hudson.model.TextParameterDefinition>
|
|
|
- <name>TARGET_JAR</name>
|
|
|
+ <name>SONAEQUEBE_URL</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>SONARQUBE_URL</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>SONARQUBE_LOGIN</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>SONARQUBE_PASSWORD</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>SONARQUBE_PROJECT</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>PROBLEM_DIR</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>EXCLUSIONS</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>SOURCES</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>BINARIES</name>
|
|
|
+ <description/>
|
|
|
+ <defaultValue/>
|
|
|
+ <trim>false</trim>
|
|
|
+ </hudson.model.TextParameterDefinition>
|
|
|
+ <hudson.model.TextParameterDefinition>
|
|
|
+ <name>CODE_ANALYSIS_SWITCH</name>
|
|
|
<description/>
|
|
|
<defaultValue/>
|
|
|
<trim>false</trim>
|
|
|
@@ -46,73 +100,87 @@
|
|
|
</properties>
|
|
|
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.53">
|
|
|
<script>
|
|
|
- pipeline {
|
|
|
- agent any
|
|
|
- stages {
|
|
|
- stage('Clean Workspace') {
|
|
|
+pipeline {
|
|
|
+ agent any
|
|
|
+ stages {
|
|
|
+ stage('Clean Workspace') {
|
|
|
steps {
|
|
|
- deleteDir()
|
|
|
- }
|
|
|
+ deleteDir()
|
|
|
}
|
|
|
- stage('Pull Code') {
|
|
|
+ }
|
|
|
+ stage('Pull Code') {
|
|
|
steps {
|
|
|
- git credentialsId: "MOOCODER", url: "${GIT_URL}"
|
|
|
+ git credentialsId: "MOOCODER", url: "${GIT_URL}"
|
|
|
}
|
|
|
- }
|
|
|
- stage('Reset Git HEAD') {
|
|
|
+ }
|
|
|
+ stage('Reset Git HEAD') {
|
|
|
steps {
|
|
|
- sh "git reset --hard ${COMMIT_HASH}"
|
|
|
+ sh "git reset --hard ${COMMIT_HASH}"
|
|
|
}
|
|
|
+ }
|
|
|
+ stage('SonarQube'){
|
|
|
+ when {
|
|
|
+ environment name: 'CODE_ANALYSIS_SWITCH', value: 'true'
|
|
|
}
|
|
|
- stage('Run Build') {
|
|
|
- agent {
|
|
|
- docker {
|
|
|
- image "${DOCKER_IMAGE}"
|
|
|
- args '--cpus 1 -m 1G'<!-- mount type=tmpfs,destination=/var/ws/tmp,tmpfs-size=134217728-->
|
|
|
- reuseNode true
|
|
|
+ steps{
|
|
|
+ script{
|
|
|
+ sonarqubeScanner = tool name: 'scanner_for_sonar'
|
|
|
+ }
|
|
|
+ withSonarQubeEnv('sonar') {
|
|
|
+ sh "${sonarqubeScanner}/bin/sonar-scanner -Dsonar.projectKey=${SONARQUBE_PROJECT} -Dsonar.projectName=${SONARQUBE_PROJECT} -Dsonar.exclusions=$WORKSPACE/${PROBLEM_DIR}/${EXCLUSIONS} -Dsonar.sources=$WORKSPACE/${PROBLEM_DIR}/${SOURCES} -Dsonar.java.binaries=$WORKSPACE/${PROBLEM_DIR}/${BINARIES} -Dsonar.host.url=${SONARQUBE_URL} -Dsonar.login=${SONARQUBE_LOGIN} -Dsonar.password=${SONARQUBE_PASSWORD}"
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+ stage('Run Build') {
|
|
|
+ agent {
|
|
|
+ docker {
|
|
|
+ image "${DOCKER_IMAGE}"
|
|
|
+ args '--network none --cpus 1 -m 1G -h localhost --mount type=tmpfs,destination=/var/ws/tmp,tmpfs-size=134217728'
|
|
|
+ reuseNode true
|
|
|
+ }
|
|
|
}
|
|
|
steps {
|
|
|
echo '==CONSOLE OUTPUT BEGIN=='
|
|
|
catchError {
|
|
|
- sh "${EXECUTE_SHELL}"
|
|
|
+ timeout(1) {
|
|
|
+ sh "${EXECUTE_SHELL}"
|
|
|
+ }
|
|
|
}
|
|
|
- archiveArtifacts allowEmptyArchive: true, artifacts: '${TARGET_JAR}'
|
|
|
echo '==CONSOLE OUTPUT END=='
|
|
|
}
|
|
|
- }
|
|
|
- stage('Collect DLTest Report') {
|
|
|
+ }
|
|
|
+ stage('Collect Test Report') {
|
|
|
when {
|
|
|
- environment name: 'PROB_TARGET', value: 'TEST'
|
|
|
+ environment name: 'PROB_TARGET', value: 'TEST'
|
|
|
}
|
|
|
steps {
|
|
|
- junit allowEmptyResults: true, testResults: 'test-reports/*.xml'
|
|
|
+ junit allowEmptyResults: true, testResults: 'test-reports/*.xml'
|
|
|
}
|
|
|
- }
|
|
|
- stage('Collect Coverage Report') {
|
|
|
+ }
|
|
|
+ stage('Collect Coverage Report') {
|
|
|
when {
|
|
|
- environment name: 'PROB_TARGET', value: 'COVERAGE'
|
|
|
+ environment name: 'PROB_TARGET', value: 'COVERAGE'
|
|
|
}
|
|
|
steps {
|
|
|
publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')]
|
|
|
}
|
|
|
- }
|
|
|
- stage('Collect Mutation Report') {
|
|
|
+ }
|
|
|
+ stage('Collect Mutation Report') {
|
|
|
when {
|
|
|
- environment name: 'PROB_TARGET', value: 'MUTATION'
|
|
|
+ environment name: 'PROB_TARGET', value: 'MUTATION'
|
|
|
}
|
|
|
steps {
|
|
|
- archiveArtifacts allowEmptyArchive: true, artifacts: 'mutation-reports/mutations.xml'
|
|
|
- }
|
|
|
- }
|
|
|
+ archiveArtifacts allowEmptyArchive: true, artifacts: 'mutation-reports/mutations.xml'
|
|
|
}
|
|
|
- post {
|
|
|
- always {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ post {
|
|
|
+ always {
|
|
|
cleanWs()
|
|
|
sh 'curl -o /dev/null -s -X POST -H "X-Moocoder-Secret: ${MOOCODER_SECRET}" "${MOOCODER_HOST}/internal/notify/callback/${JOB_NAME}/${BUILD_NUMBER}" || :'
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
<sandbox>true</sandbox>
|
|
|
</definition>
|