ci: Jenkinsfile change

This commit is contained in:
CaptainB 2023-04-17 18:25:41 +08:00
parent 7d7abc3082
commit 47ccec230e
1 changed files with 6 additions and 21 deletions

27
Jenkinsfile vendored
View File

@ -44,12 +44,7 @@ pipeline {
export PATH=$JAVA_HOME/bin:$PATH
java -version
./mvnw install -N -Drevision=${REVISION} --settings ./settings.xml
./mvnw clean install -Drevision=${REVISION} -pl framework,framework/sdk-parent,framework/sdk-parent/domain,framework/sdk-parent/sdk,framework/sdk-parent/xpack-interface,framework/sdk-parent/jmeter --settings ./settings.xml
# 复制前端代码
if [ -n "${FRONTEND_LINK}" ]; then
cp -r framework/sdk-parent/frontend ${FRONTEND_LINK}/frontend/.tmp_npm
fi
./mvnw clean install -Drevision=${REVISION} -pl backend,backend/framework,backend/framework/domain,backend/framework/jmeter,backend/framework/plugin,backend/framework/sdk --settings ./settings.xml
'''
}
}
@ -65,18 +60,14 @@ pipeline {
java -version
./mvnw clean package -Drevision=${REVISION} --settings ./settings.xml
frameworks=('framework/eureka' 'framework/gateway')
for library in "${frameworks[@]}";
do
mkdir -p $library/target/dependency && (cd $library/target/dependency; jar -xf ../*.jar)
done
LOCAL_REPOSITORY=$(./mvnw help:evaluate -Dexpression=settings.localRepository --settings ./settings.xml -q -DforceStdout)
# echo $LOCAL_REPOSITORY
mkdir -p backend/app/target/dependency && cd backend/app/target/dependency && jar -xf ../*.jar;
libraries=('api-test' 'performance-test' 'project-management' 'system-setting' 'test-track' 'report-stat' 'workstation')
libraries=('ui-test' 'load-test')
for library in "${libraries[@]}";
do
mkdir -p $library/backend/target/dependency && (cd $library/backend/target/dependency; jar -xf ../*.jar; cp $LOCAL_REPOSITORY/io/metersphere/metersphere-xpack/${REVISION}/metersphere-xpack-${REVISION}.jar ./BOOT-INF/lib/)
cp -rf $LOCAL_REPOSITORY/io/metersphere/metersphere-$library/${REVISION}/metersphere-$library-${REVISION}.jar backend/app/target/dependency/BOOT-INF/lib/
done
'''
}
@ -89,13 +80,7 @@ pipeline {
for (int i=0; i<10; i++) {
try {
sh '''#!/bin/bash -xe
cd ${WORKSPACE}
libraries=('framework/eureka' 'framework/gateway' 'api-test' 'performance-test' 'project-management' 'report-stat' 'system-setting' 'test-track' 'workstation')
for library in "${libraries[@]}";
do
IMAGE_NAME=${library#*/}
docker --config /home/metersphere/.docker buildx build --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t ${IMAGE_PREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} --platform linux/amd64,linux/arm64 ./$library --push
done
docker --config /home/metersphere/.docker buildx build --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t ${IMAGE_PREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} --platform linux/amd64,linux/arm64 . --push
'''
break
} catch (Exception e) {