-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
38 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,52 +1,57 @@ | ||
properties properties: [ | ||
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']], | ||
#!/groovy | ||
properties: [ | ||
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '0', numToKeepStr: '0']], | ||
disableConcurrentBuilds() | ||
] | ||
|
||
@Library('mare-build-library') | ||
def nodeJS = new de.mare.ci.jenkins.NodeJS() | ||
def git = new de.mare.ci.jenkins.Git() | ||
|
||
node('nodejs') { | ||
def buildNumber = env.BUILD_NUMBER | ||
def branchName = env.BRANCH_NAME | ||
def workspace = env.WORKSPACE | ||
def buildUrl = env.BUILD_URL | ||
|
||
// PRINT ENVIRONMENT TO JOB | ||
echo "workspace directory is $workspace" | ||
echo "build URL is $buildUrl" | ||
echo "build Number is $buildNumber" | ||
echo "branch name is $branchName" | ||
echo "PATH is $env.PATH" | ||
|
||
try { | ||
stage('Checkout') { | ||
cleanWs() | ||
checkout scm | ||
} | ||
timeout(30) { | ||
node('nodejs') { | ||
def buildNumber = env.BUILD_NUMBER | ||
def branchName = env.BRANCH_NAME | ||
def workspace = env.WORKSPACE | ||
def buildUrl = env.BUILD_URL | ||
|
||
// PRINT ENVIRONMENT TO JOB | ||
echo "workspace directory is $workspace" | ||
echo "build URL is $buildUrl" | ||
echo "build Number is $buildNumber" | ||
echo "branch name is $branchName" | ||
echo "PATH is $env.PATH" | ||
|
||
try { | ||
stage('Checkout') { | ||
cleanWs() | ||
checkout scm | ||
} | ||
|
||
stage('Build') { | ||
nodeJS.nvm('install') | ||
nodeJS.nvmRun('build') | ||
} | ||
stage('Build') { | ||
nodeJS.nvm('install') | ||
nodeJS.nvmRun('build') | ||
} | ||
|
||
stage('Security Checks') { | ||
nodeJS.nvmRun('check') | ||
} | ||
stage('Security Checks') { | ||
nodeJS.nvmRun('check') | ||
} | ||
|
||
stage('Test') { | ||
nodeJS.nvmRun('test') | ||
// junit '*/target/tests.js.xml' | ||
} | ||
stage('Test') { | ||
nodeJS.nvmRun('test') | ||
// junit '*/target/tests.js.xml' | ||
} | ||
|
||
if(git.isDevelopBranch() || git.isFeatureBranch()){ | ||
stage('Publish NPM snapshot') { | ||
nodeJS.publishSnapshot('.', buildNumber, branchName) | ||
if(git.isDevelopBranch() || git.isFeatureBranch()){ | ||
stage('Publish NPM snapshot') { | ||
nodeJS.publishSnapshot('.', buildNumber, branchName) | ||
} | ||
} | ||
} | ||
|
||
} catch (e) { | ||
mail subject: "${env.JOB_NAME} (${buildNumber}): Error on build", to: 'github@martinreinhardt-online.de', body: "Please go to ${buildUrl}." | ||
throw e | ||
} catch (e) { | ||
mail subject: "${env.JOB_NAME} (${buildNumber}): Error on build", to: 'github@martinreinhardt-online.de', body: "Please go to ${buildUrl}." | ||
throw e | ||
} | ||
} | ||
} | ||
|