加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Jenkinsfile 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
XinlongStar 提交于 2023-02-15 23:12 . peizhi
pipeline {
agent {
node {
label 'maven'
}
}
parameters {
string(name:'PROJECT_VERSION',defaultValue: 'v0.0Beta',description:'')
string(name:'PROJECT_NAME',defaultValue: '',description:'')
}
environment {
DOCKER_CREDENTIAL_ID = 'dockerhub-id'
GITEE_CREDENTIAL_ID = 'gitee-id'
KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig'
REGISTRY = 'docker.io'
DOCKERHUB_NAMESPACE = 'lvxinlong'
GITEE_ACCOUNT = 'lemon_wan'
SONAR_CREDENTIAL_ID = 'sonar-qube'
BRANCH_NAME = 'master'
}
stages {
stage ('拉取代码') {
steps {
git(url: 'https://gitee.com/xinlong-lv/gulimall_1.git', credentialsId: 'gitee-id', changelog: true, poll: false, branch: 'master')
sh 'echo 正在构建 $PROJECT_NAME 版本号:$PROJECT_VERSION 将会提交给 $REGISTRY 镜像仓库'
container ('maven') {
sh 'mvn clean install -Dmaven.test.skip=true -gs `pwd`/mvn-settings.xml'
}
}
}
stage('sonarqube代码质量分析') {
steps {
container ('maven') {
withCredentials([string(credentialsId: "$SONAR_CREDENTIAL_ID", variable: 'SONAR_TOKEN')]) {
withSonarQubeEnv('sonar') {
sh "echo 当前目录 `pwd`"
sh "mvn sonar:sonar -gs `pwd`/mvn-settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN"
}
}
timeout(time: 1, unit: 'HOURS') {
waitForQualityGate abortPipeline: true
}
}
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化