Browse Source

更新 Jenkinsfile

release_toaliyun_real
温秋荣 6 years ago
parent
commit
3ee630743b
1 changed files with 49 additions and 0 deletions
  1. +49
    -0
      Jenkinsfile

+ 49
- 0
Jenkinsfile View File

@@ -0,0 +1,49 @@
pipeline {
agent any
stages {
stage('检出') {
steps {
checkout([$class: 'GitSCM', branches: [[name: env.GIT_BUILD_REF]],
userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]])
}
}
stage('构建') {
steps {
sh 'mvn -version'
echo '构建中...'
sh 'mvn clean install -Dmaven.test.skip=true'
echo '构建完成.'
script {
def exists = fileExists 'README.md'
if (!exists) {
writeFile(file: 'README.md', text: 'Helloworld')
}
}

archiveArtifacts(artifacts: 'README.md', fingerprint: true)
}
}
stage('测试') {
steps {
echo '单元测试中...'
echo '单元测试完成.'
writeFile(file: 'TEST-demo.junit4.AppTest.xml', text: '''
<testsuite name="demo.junit4.AppTest" time="0.053" tests="3" errors="0" skipped="0" failures="0">
<properties>
</properties>
<testcase name="testApp" classname="demo.junit4.AppTest" time="0.003"/>
<testcase name="test1" classname="demo.junit4.AppTest" time="0"/>
<testcase name="test2" classname="demo.junit4.AppTest" time="0"/>
</testsuite>
''')
junit '*.xml'
}
}
stage('部署') {
steps {
echo '部署中...'
echo '部署完成'
}
}
}
}

Loading…
Cancel
Save