Merge branch 'pipeline-test' into master

This commit is contained in:
BugKing 2020-12-18 13:42:55 +08:00
commit 137264b14e
2 changed files with 30 additions and 2 deletions

4
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "backend/src/main/java/io/metersphere/xpack"]
path = backend/src/main/java/io/metersphere/xpack
url = https://github.com/metersphere/xpack-backend.git
url = git@github.com:metersphere/xpack-backend.git
[submodule "frontend/src/business/components/xpack"]
path = frontend/src/business/components/xpack
url = https://github.com/metersphere/xpack-frontend.git
url = git@github.com:metersphere/xpack-frontend.git

28
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,28 @@
pipeline {
agent {
node {
label 'master'
}
}
options { quietPeriod(2400) }
parameters {
string(name: 'IMAGE_NAME', defaultValue: 'metersphere', description: '构建后的 Docker 镜像名称')
string(name: 'IMAGE_FREFIX', defaultValue: 'registry.cn-qingdao.aliyuncs.com/metersphere', description: '构建后的 Docker 镜像带仓库名的前缀')
}
stages {
stage('Build/Test') {
steps {
configFileProvider([configFile(fileId: 'metersphere-maven', targetLocation: 'settings.xml')]) {
sh "mvn clean package --settings ./settings.xml"
}
}
}
stage('Docker build & push') {
steps {
sh "docker build --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-b\${BUILD_NUMBER} -t ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ."
sh "docker tag ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ${IMAGE_FREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
sh "docker push ${IMAGE_FREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
}
}
}
}