Ai
1 Star 0 Fork 0

biancl/ansible-maven-sample

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Jenkinsfile 2.75 KB
一键复制 编辑 原始数据 按行查看 历史
占翼 提交于 2018-12-25 16:26 +08:00 . 删除不必要的部署脚本。整理README.
#!groovy
node('maven') {
def REPOSITORY_URL='http://200.31.147.77/devops/ansible-maven-sample.git';
def REPOSITORY_CREDENTIAL_ID='git';
def GITLAB_CONNECTION='cfets-gitlab';
def SONAR_SERVER='cfets-sonar';
def artServer = Artifactory.server('artifactory');
artServer.credentialsId='GLOBAL-ARTIFACTORY';
def rtMaven = Artifactory.newMavenBuild();
rtMaven.tool = 'maven';
rtMaven.resolver server: artServer, releaseRepo: 'maven-release', snapshotRepo: 'maven-release';
rtMaven.deployer.deployArtifacts = false;
properties([
gitLabConnection("$GITLAB_CONNECTION"),
[$class: 'GitlabLogoProperty', repositoryName: ''],
[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false],
pipelineTriggers([[
$class: 'GitLabPushTrigger',
branchFilterType: 'All',
triggerOnPush: true,
triggerOnMergeRequest: true,
triggerOpenMergeRequestOnPush: "never",
triggerOnNoteRequest: true,
noteRegex: "Jenkins please retry a build",
skipWorkInProgressMergeRequest: true,
ciSkip: false,
setBuildDescription: true,
addNoteOnMergeRequest: true,
addCiMessage: true,
addVoteOnMergeRequest: true,
acceptMergeRequestOnSuccess: false,
]])
])
gitlabBuilds(builds: ['Checkout', 'Scan', 'Test', 'Quality Gate']){
stage('Check out'){
gitlabCommitStatus("Checkout") {
echo "branchName=$BRANCH_NAME"
echo "REPOSITORY_CREDENTIAL_ID=$REPOSITORY_CREDENTIAL_ID"
git branch: "$BRANCH_NAME", credentialsId: "$REPOSITORY_CREDENTIAL_ID", url: "$REPOSITORY_URL"
}
}
stage("SonarQube scan") {
gitlabCommitStatus("Scan") {
withSonarQubeEnv("$SONAR_SERVER") {
rtMaven.run pom:'pom.xml', goals: '-Dmaven.test.skip=true compile sonar:sonar'
}
}
}
stage('Unit Test') {
gitlabCommitStatus("Test") {
echo "=============================unit test start================================================="
rtMaven.run pom:'pom.xml', goals: 'org.jacoco:jacoco-maven-plugin:prepare-agent test'
// jacoco() //需安装jacoco插件
echo "=============================unit test end================================================="
}
}
}
}
stage("Quality Gate"){
gitlabCommitStatus("Quality Gate") {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/biancl/ansible-maven-sample.git
git@gitee.com:biancl/ansible-maven-sample.git
biancl
ansible-maven-sample
ansible-maven-sample
develop

搜索帮助