未验证 提交 ae97106d 编写于 作者: W wade zhang 提交者: GitHub

Merge pull request #14006 from taosdata/ci/TD-16621_2.6

ci: split ci environment into two
...@@ -7,6 +7,7 @@ def sync_source() { ...@@ -7,6 +7,7 @@ def sync_source() {
sh ''' sh '''
hostname hostname
date date
env
''' '''
sh ''' sh '''
cd ${WKC} cd ${WKC}
...@@ -57,6 +58,7 @@ def sync_source() { ...@@ -57,6 +58,7 @@ def sync_source() {
[ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md" [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
git pull >/dev/null git pull >/dev/null
git clean -dfx git clean -dfx
git log -5
''' '''
script { script {
if (env.CHANGE_TARGET == 'master') { if (env.CHANGE_TARGET == 'master') {
...@@ -90,6 +92,7 @@ def sync_source() { ...@@ -90,6 +92,7 @@ def sync_source() {
cd ${WK} cd ${WK}
git pull >/dev/null git pull >/dev/null
git clean -dfx git clean -dfx
git log -5
''' '''
script { script {
if (env.CHANGE_URL =~ /\/TDengine\//) { if (env.CHANGE_URL =~ /\/TDengine\//) {
...@@ -98,16 +101,13 @@ def sync_source() { ...@@ -98,16 +101,13 @@ def sync_source() {
cd ${WKC} cd ${WKC}
git fetch origin +refs/pull/${CHANGE_ID}/merge git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD git checkout -qf FETCH_HEAD
git log -5
if [ ! -d src/connector/python/.github ]; then '''
rm -rf src/connector/python/* || : sh '''
rm -rf src/connector/python/.* || :
git clone --depth 1 https://github.com/taosdata/taos-connector-python src/connector/python || echo "failed to clone python connector"
else
cd src/connector/python || echo "src/connector/python not exist"
git pull || :
cd ${WKC} cd ${WKC}
fi rm -rf src/connector/python
mkdir -p src/connector/python
git clone --depth 1 https://github.com/taosdata/taos-connector-python src/connector/python || echo "failed to clone python connector"
''' '''
} else if (env.CHANGE_URL =~ /\/TDinternal\//) { } else if (env.CHANGE_URL =~ /\/TDinternal\//) {
sh ''' sh '''
...@@ -115,16 +115,13 @@ def sync_source() { ...@@ -115,16 +115,13 @@ def sync_source() {
cd ${WK} cd ${WK}
git fetch origin +refs/pull/${CHANGE_ID}/merge git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD git checkout -qf FETCH_HEAD
git log -5
if [ ! -d community/src/connector/python/.github ]; then '''
rm -rf community/src/connector/python/* || : sh '''
rm -rf community/src/connector/python/.* || : cd ${WKC}
git clone --depth 1 https://github.com/taosdata/taos-connector-python community/src/connector/python || echo "failed to clone python connector" rm -rf src/connector/python
else mkdir -p src/connector/python
cd community/src/connector/python || echo "community/src/connector/python not exist" git clone --depth 1 https://github.com/taosdata/taos-connector-python src/connector/python || echo "failed to clone python connector"
git pull || :
cd ${WK}
fi
''' '''
} else { } else {
sh ''' sh '''
...@@ -136,16 +133,6 @@ def sync_source() { ...@@ -136,16 +133,6 @@ def sync_source() {
cd ${WKC} cd ${WKC}
git submodule update --init --recursive git submodule update --init --recursive
''' '''
sh '''
cd ${WKC}
git branch
git log -5
'''
sh '''
cd ${WK}
git branch
git log -5
'''
} }
def pre_test() { def pre_test() {
sync_source() sync_source()
...@@ -157,6 +144,7 @@ def pre_test() { ...@@ -157,6 +144,7 @@ def pre_test() {
go env -w GO111MODULE=on go env -w GO111MODULE=on
cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true > /dev/null cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true > /dev/null
make -j8 >/dev/null make -j8 >/dev/null
make install
''' '''
return 1 return 1
} }
...@@ -174,7 +162,7 @@ def pre_test_mac() { ...@@ -174,7 +162,7 @@ def pre_test_mac() {
return 1 return 1
} }
pipeline { pipeline {
agent {label " dispatcher "} agent none
options { skipDefaultCheckout() } options { skipDefaultCheckout() }
environment{ environment{
WK = '/var/data/jenkins/workspace/TDinternal' WK = '/var/data/jenkins/workspace/TDinternal'
...@@ -182,18 +170,7 @@ pipeline { ...@@ -182,18 +170,7 @@ pipeline {
LOGDIR = '/var/data/jenkins/workspace/log' LOGDIR = '/var/data/jenkins/workspace/log'
} }
stages { stages {
stage ('pre_build') { stage('run test') {
steps {
sh '''
date
pwd
env
hostname
'''
}
}
stage ('Parallel build stage') {
//only build pr
options { skipDefaultCheckout() } options { skipDefaultCheckout() }
when { when {
allOf { allOf {
...@@ -202,98 +179,57 @@ pipeline { ...@@ -202,98 +179,57 @@ pipeline {
} }
} }
parallel { parallel {
stage ('dispatcher sync source') { stage ('build arm64') {
steps { agent {label " worker07_arm64 || worker09_arm64 "}
timeout(time: 20, unit: 'MINUTES') {
sync_source()
script {
sh '''
echo "dispatcher ready"
date
'''
}
}
}
}
stage ('build worker01') {
agent {label " worker01 "}
steps { steps {
timeout(time: 20, unit: 'MINUTES') { timeout(time: 20, unit: 'MINUTES') {
pre_test() pre_test()
script { script {
sh ''' sh '''
echo "worker01 build done" echo "arm64 build done"
date date
''' '''
} }
} }
} }
} }
stage ('build worker02') { stage ('build Mac') {
agent {label " worker02 "} agent {label " Mac_catalina "}
steps { steps {
timeout(time: 20, unit: 'MINUTES') { timeout(time: 20, unit: 'MINUTES') {
pre_test() pre_test_mac()
script { script {
sh ''' sh '''
echo "worker02 build done" echo "Mac build done"
date date
''' '''
} }
} }
} }
} }
} stage('run cases') {
} agent {label " worker01 || worker02 "}
stage('run test') {
options { skipDefaultCheckout() }
when {
allOf {
changeRequest()
not { expression { env.CHANGE_BRANCH =~ /docs\// }}
}
}
parallel {
stage ('build worker07_arm64') {
agent {label " worker07_arm64 "}
steps { steps {
timeout(time: 20, unit: 'MINUTES') {
pre_test()
script {
sh ''' sh '''
echo "worker07_arm64 build done"
date date
pwd
hostname
''' '''
} timeout(time: 15, unit: 'MINUTES') {
} pre_test()
}
}
stage ('build Mac_catalina ') {
agent {label " Mac_catalina "}
steps {
timeout(time: 20, unit: 'MINUTES') {
pre_test_mac()
script { script {
sh ''' sh '''
echo "Mac_catalina build done" echo "Linux build done"
date date
''' '''
} }
} }
}
}
stage('run cases') {
steps {
sh '''
date
hostname
'''
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 20, unit: 'MINUTES') { timeout(time: 25, unit: 'MINUTES') {
sh ''' sh '''
date date
cd ${WKC}/tests/parallel_test cd ${WKC}/tests/parallel_test
time ./run.sh -m m.json -t cases.task -l ${LOGDIR} -b ${BRANCH_NAME} time ./run.sh -m /home/m.json -t cases.task -l ${LOGDIR} -b ${BRANCH_NAME}
date date
hostname hostname
''' '''
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册