forked from yu-shao-gm/zanata-jenkins-plugin
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from zanata/master
Added Jenkinsfile for building
- Loading branch information
Showing
5 changed files
with
139 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,67 @@ | ||
#!/usr/bin/env groovy | ||
@Library('github.com/zanata/zanata-pipeline-library@master') | ||
|
||
/* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ | ||
buildPlugin() | ||
/* Only keep the 10 most recent builds. */ | ||
def projectProperties = [ | ||
[ | ||
$class: 'BuildDiscarderProperty', | ||
strategy: [$class: 'LogRotator', numToKeepStr: '10'] | ||
], | ||
] | ||
|
||
properties(projectProperties) | ||
|
||
/* Upto stash stage should fail fast: | ||
* Failed and stop the build | ||
* Yet able to create report | ||
*/ | ||
try { | ||
timestamps { | ||
node { | ||
ansicolor { | ||
stage('Checkout') { | ||
info.printNode() | ||
notify.started() | ||
|
||
// Shallow Clone does not work with RHEL7, which use git-1.8.3 | ||
// https://issues.jenkins-ci.org/browse/JENKINS-37229 | ||
checkout scm | ||
} | ||
|
||
// Build and Unit Tests | ||
// The result is archived | ||
stage('Build') { | ||
info.printNode() | ||
info.printEnv() | ||
def testReports = 'target/surefire-reports/TEST-*.xml' | ||
def hpiFiles = 'target/*.hpi' | ||
|
||
withEnv(["MVN_HOME=${ tool name: 'mvn', type: 'hudson.tasks.Maven$MavenInstallation' }"]) { | ||
sh '$MVN_HOME/bin/mvn clean verify' | ||
} | ||
|
||
junit allowEmptyResults: true, | ||
keepLongStdio: false, | ||
testDataPublishers: [[$class: 'StabilityTestDataPublisher']], | ||
testResults: "**/${testReports}" | ||
|
||
// notify if compile+unit test successful | ||
notify.testResults(null) | ||
archive "**/${hpiFiles},**/target/site/jacoco/**" | ||
} | ||
|
||
stage('Report') { | ||
// this is not working properly yet | ||
// step([$class: 'JacocoPublisher']) | ||
} | ||
} | ||
} | ||
} | ||
} catch (e) { | ||
notify.failed() | ||
junit allowEmptyResults: true, | ||
keepLongStdio: false, | ||
testDataPublishers: [[$class: 'StabilityTestDataPublisher']], | ||
testResults: "**/${testReports}" | ||
throw e | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env groovy | ||
|
||
/* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ | ||
buildPlugin() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters