提交 90827358 编写于 作者: 雨爱无痕

Adjust jenkinsfile.

上级 0978b0f3
pipeline {
agent {
kubernetes {
inheritFrom "build-go code-scan xuanim"
inheritFrom "build-go build-node code-scan xuanim"
yaml '''
apiVersion: v1
kind: Pod
metadata:
spec:
containers:
- name: zentao
image: hub.qucheng.com/app/quickon-zentao:max4.3.k8s-20230407
tty: true
args: ["sleep", "99d"]
- name: mysql
image: hub.qucheng.com/app/mysql:5.7.37-debian-10
tty: true
env:
- name: MYSQL_PASSWORD
value: pass4Zentao
- name: MYSQL_ROOT_PASSWORD
value: pass4Zentao
nodeSelector:
kubernetes.io/hostname: k3s-worker01
'''
}
}
......@@ -66,24 +87,57 @@ pipeline {
}
stage("Build") {
//when {
// expression {
// sh(returnStatus: true, script: 'git diff --name-only HEAD~1 | egrep -q "VERSION"') == 0
// }
//}
environment {
ARTIFACT_REPOSITORY = "easycorp-snapshot"
ARTIFACT_HOST = "nexus.qc.oop.cc"
ARTIFACT_PROTOCOL = "https"
ARTIFACT_CRED_ID = "nexus-jenkins"
ZTF_VERSION = """${sh(
returnStdout: true,
script: 'cat VERSION'
).trim()}"""
}
steps {
container('golang') {
sh 'git config --global --add safe.directory $(pwd)'
sh 'CGO_ENABLED=0 make compile_command_linux'
sh 'ls bin/linux/'
sh 'cd bin/linux && tar zcf ${WORKSPACE}/ztf.linux.tar.gz ztf'
}
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: env.ARTIFACT_PROTOCOL,
nexusUrl: env.ARTIFACT_HOST,
groupId: 'autotest.framework',
version: env.ZTF_VERSION,
repository: env.ARTIFACT_REPOSITORY,
credentialsId: env.ARTIFACT_CRED_ID,
artifacts: [
[artifactId: 'ztf',
classifier: 'linux-amd64',
file: 'ztf.linux.tar.gz',
type: 'tar.gz']
]
)
}
post {
success {
container('xuanimbot') {
sh 'git config --global --add safe.directory $(pwd)'
sh 'git config --global --add safe.directory $(pwd)'
sh '/usr/local/bin/xuanimbot --users "$(git show -s --format=%ce)" --title "ztf build success" --url "${BUILD_URL}" --content "ztf build success" --debug --custom'
}
}
failure {
container('xuanimbot') {
sh 'git config --global --add safe.directory $(pwd)'
sh 'git config --global --add safe.directory $(pwd)'
sh '/usr/local/bin/xuanimbot --users "$(git show -s --format=%ce)" --title "ztf build failure" --url "${BUILD_URL}" --content "ztf build failure, please check it" --debug --custom'
}
}
......@@ -91,5 +145,21 @@ pipeline {
} // End Build
stage("DEBUG") {
steps {
container('zentao') {
sh '/etc/s6/s6-init/run'
sh 'apachectl start'
sh 'env'
}
container('golang') {
sh 'nohup go run cmd/server/main.go &'
}
container('node') {
sh 'cd ui && npm i && npm run serve'
}
}
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册