mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Update pipeline.yml
This commit is contained in:
+20
-45
@@ -1,47 +1,22 @@
|
|||||||
variables:
|
pipeline {
|
||||||
# sonner scanner 安装目录
|
agent any
|
||||||
SCANNER_HOME : "/usr/local/sonar-scanner-4.6.2.2472-linux"
|
|
||||||
# 扫描代码路径
|
|
||||||
SCAN_DIR : "src"
|
|
||||||
# 制品目录
|
|
||||||
ARTIFACT_PATH : 'target/*.jar'
|
|
||||||
# maven 仓库地址
|
|
||||||
MAVEN_REPO: /root/.m2/repository
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- compile
|
|
||||||
|
|
||||||
编译:
|
stages {
|
||||||
stage: compile
|
stage('Checkout') {
|
||||||
tags:
|
steps {
|
||||||
- test
|
// 检出代码并指定分支
|
||||||
# interruptible 当新管道在同一分支上启动时,可以取消正在运行的作业。
|
git credentialsId: '1',
|
||||||
interruptible: true
|
url: 'http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git',
|
||||||
# 是否允许失败,允许的话如果当前阶段运行失败还会继续执行下一个阶段
|
branch: 'main'
|
||||||
allow_failure: false
|
}
|
||||||
# 运行脚本
|
}
|
||||||
script:
|
|
||||||
- java -version
|
stage('SonarQube Analysis') {
|
||||||
- mvn -version
|
steps {
|
||||||
# maven 编译
|
// 使用SonarScanner执行代码分析
|
||||||
- mvn -Dmaven.repo.local=$MAVEN_REPO clean -U package -Dfile.encoding=UTF-8 -DskipTests=true
|
sh 'mvn clean verify sonar:sonar -Dsonar.projectKey=test-cf-server -Dsonar.host.url=http://192.168.1.205:9000 -Dsonar.login=519c6ab9af828810bdacd86bd22550fafbc93298'
|
||||||
# 代码扫描
|
}
|
||||||
- "$SCANNER_HOME/bin/sonar-scanner -Dsonar.projectKey=${CI_PROJECT_NAME} \
|
}
|
||||||
-Dsonar.projectName=${CI_PROJECT_NAME} \
|
}
|
||||||
-Dsonar.projectVersion=${CI_COMMIT_REF_NAME} \
|
}
|
||||||
-Dsonar.ws.timeout=30 \
|
|
||||||
-Dsonar.projectDescription=${CI_PROJECT_TITLE} \
|
|
||||||
-Dsonar.links.homepage=${CI_PROJECT_URL} \
|
|
||||||
-Dsonar.sources=${SCAN_DIR} \
|
|
||||||
-Dsonar.sourceEncoding=UTF-8 \
|
|
||||||
-Dsonar.java.binaries=target/classes \
|
|
||||||
-Dsonar.java.test.binaries=target/test-classes \
|
|
||||||
-Dsonar.java.surefire.report=target/surefire-reports \
|
|
||||||
-Dsonar.branch.name=${CI_COMMIT_REF_NAME}"
|
|
||||||
- ls -lh target/
|
|
||||||
# Maven编译,所以会有Jar包产物,这里定义产物的过期时间
|
|
||||||
artifacts:
|
|
||||||
name: $PROJECT
|
|
||||||
expire_in: 1 days
|
|
||||||
paths:
|
|
||||||
- target/*.jar
|
|
||||||
|
|||||||
Reference in New Issue
Block a user