Files
EasySoft-ZenTaoPMS/Jenkinsfile.test
T

146 lines
5.3 KiB
Plaintext
Executable File

pipeline {
agent {
kubernetes {
inheritFrom "xuanim"
yamlFile 'misc/ci/normal.yaml'
}
}
options {
skipDefaultCheckout()
}
environment {
TZ="Asia/Shanghai"
ZENTAO_RELEASE_PATH = "${WORKSPACE}/release"
XUANXUAN_SRC_PATH = "${WORKSPACE}/xuansrc"
SRC_ZDOO_PATH = "${WORKSPACE}/zdoo"
SRC_ZDOOEXT_PATH = "${WORKSPACE}/zdooext"
SRC_ZENTAOEXT_PATH = "${WORKSPACE}/zentaoext"
// set to blank for auto-detect from ci.json
DOWNGRADE_ENABLED = "false"
DOWNGRADE_VERSIONS = "7.2,7.1,7.0,5.4"
}
stages {
stage("Test Code") {
agent {
kubernetes {
inheritFrom "zentao-package build-docker xuanim"
yamlFile 'misc/ci/basic-build.yaml'
}
}
stages {
stage("Pull") {
steps {
checkout scm
script {
env.XUANVERSION = sh(returnStdout: true,script: 'jq -r .pkg.xuanxuan.gitVersion < ci.json').trim()
env.ZENTAOEXT_VERSION = sh(returnStdout: true,script: 'jq -r .pkg.zentaoext.gitVersion < ci.json').trim()
env.ZENTAOEXT_GIT_REPO = sh(returnStdout: true,script: 'jq -r .pkg.zentaoext.gitRepo < ci.json').trim()
env.ZDOO_VERSION = sh(returnStdout: true,script: 'jq -r .pkg.zdoo.gitVersion < ci.json').trim()
env.ZDOOEXT_VERSION = sh(returnStdout: true,script: 'jq -r .pkg.zdooext.gitVersion < ci.json').trim()
}
dir('xuansrc') {
checkout scmGit(branches: [[name: "${env.XUANVERSION}"]],
userRemoteConfigs: [[credentialsId: 'git-zcorp-cc-jenkins-bot-http', url: 'https://git.zcorp.cc/easycorp/xuanxuan.git']]
)
}
dir('zdoo') {
checkout scmGit(branches: [[name: "${env.ZDOO_VERSION}"]],
extensions: [cloneOption(depth: 2, noTags: false, reference: '', shallow: true)],
userRemoteConfigs: [[credentialsId: 'git-zcorp-cc-jenkins-bot-http', url: 'https://git.zcorp.cc/easycorp/zdoo.git']]
)
}
dir('zdooext') {
checkout scmGit(branches: [[name: "${env.ZDOOEXT_VERSION}"]],
extensions: [cloneOption(depth: 2, noTags: false, reference: '', shallow: true)],
userRemoteConfigs: [[credentialsId: 'git-zcorp-cc-jenkins-bot-http', url: 'https://git.zcorp.cc/easycorp/zdooext.git']]
)
}
dir('zentaoext') {
checkout scmGit(branches: [[name: "${env.ZENTAOEXT_VERSION}"]],
extensions: [cloneOption(depth: 2, noTags: false, reference: '', shallow: true)],
userRemoteConfigs: [[credentialsId: 'git-zcorp-cc-jenkins-bot-http', url: "${env.ZENTAOEXT_GIT_REPO}"]]
)
}
}
}
stage("Setup Global Env") {
steps {
script {
def ximUsers = sh(returnStdout: true,script: 'jq -r .notice.users < ci.json').trim()
env.XIM_USERS = "qishiyao"
env.XIM_GROUPS = "31a0008b-6e3e-4b7f-9b7b-396a46b1f8f4"
env.PMS_VERSION = sh(returnStdout: true, script: 'cat ${SRC_ZENTAOEXT_PATH}/VERSION').trim()
env.BIZ_VERSION = sh(returnStdout: true, script: 'cat ${SRC_ZENTAOEXT_PATH}/BIZVERSION').trim()
env.MAX_VERSION = sh(returnStdout: true, script: 'cat ${SRC_ZENTAOEXT_PATH}/MAXVERSION').trim()
env.IPD_VERSION = sh(returnStdout: true, script: 'cat ${SRC_ZENTAOEXT_PATH}/IPDVERSION').trim()
}
}
}
stage("Downgrade") {
stages {
stage("make Package") {
steps {
withCredentials([gitUsernamePassword(credentialsId: 'git-zcorp-cc-jenkins-bot-http',gitToolName: 'git-tool')]) {
container('package') {
sh 'mkdir ${ZENTAO_RELEASE_PATH} && chown 1000:1000 ${ZENTAO_RELEASE_PATH}'
sh 'git config --global pull.ff only'
sh 'pwd && ls -l && make ciCommon'
sh 'ls -l ${ZENTAO_RELEASE_PATH}'
}
}
}
}
stage("test downgrade") {
steps {
container('package') {
sh 'unzip -q ZenTaoPMS.${PMS_VERSION}.zip'
sh 'ls -l zentaopms'
sh './misc/downgrade.sh -p "$DOWNGRADE_VERSIONS" -r zentaopms -i -s -o "$ZENTAO_RELEASE_PATH" framework lib module/*'
}
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: env.ZENTAO_RELEASE_PATH,
reportFiles: 'downgradeReport.html',
reportName: 'DowngradeReport'
])
container('xuanimbot') {
sh 'git config --global --add safe.directory $(pwd)'
sh 'test -f $ZENTAO_RELEASE_PATH/downgradeReport.html && /usr/local/bin/xuanimbot --title "`echo -n 6ZmN57qn5aSx6LSl | base64 --decode`" --url "${RUN_DISPLAY_URL}" --content "[PHP Syntax Report]($BUILD_URL/DowngradeReport/)" --debug --custom || echo "No syntax found"'
}
}
}
}
} // End Downgrade
}
}
}
}