build: 区分社区版和企业版镜像
This commit is contained in:
parent
36d5407b51
commit
edb7176c0a
|
@ -62,32 +62,64 @@ pipeline {
|
|||
export PATH=$JAVA_HOME/bin:/opt/apache-maven-3.8.3/bin:$PATH
|
||||
java -version
|
||||
mvn clean package -Drevision=${REVISION} -DskipTests --settings ./settings.xml
|
||||
mkdir -p backend/app/target/dependency && (cd backend/app/target/dependency && jar -xf ../*.jar);
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Community build & push') {
|
||||
when { environment name: 'BUILD_SDK', value: 'false' }
|
||||
steps {
|
||||
configFileProvider([configFile(fileId: 'metersphere-maven', targetLocation: 'settings.xml')]) {
|
||||
sh '''#!/bin/bash -xe
|
||||
export JAVA_HOME=/opt/jdk-21
|
||||
export CLASSPATH=$JAVA_HOME/lib:$CLASSPATH
|
||||
export PATH=$JAVA_HOME/bin:/opt/apache-maven-3.8.3/bin:$PATH
|
||||
|
||||
LOCAL_REPOSITORY=$(mvn 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=('metersphere-ui-test-impl' 'metersphere-load-test-impl' 'general-xpack-impl')
|
||||
libraries=('general-xpack-impl')
|
||||
for library in "${libraries[@]}";
|
||||
do
|
||||
cp -rf $LOCAL_REPOSITORY/io/metersphere/$library/${REVISION}/$library-${REVISION}.jar backend/app/target/dependency/BOOT-INF/lib/
|
||||
done
|
||||
|
||||
docker --config /home/metersphere/.docker buildx build --no-cache --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t ${IMAGE_PREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}-community --platform linux/amd64,linux/arm64 . --push
|
||||
# 同步提交到 dockerhub
|
||||
docker --config /home/metersphere/.docker buildx build --no-cache --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t metersphere/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}-community --platform linux/amd64,linux/arm64 . --push
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Docker build & push') {
|
||||
stage('Enterprise build & push') {
|
||||
when { environment name: 'BUILD_SDK', value: 'false' }
|
||||
steps {
|
||||
configFileProvider([configFile(fileId: 'metersphere-maven', targetLocation: 'settings.xml')]) {
|
||||
sh '''#!/bin/bash -xe
|
||||
docker --config /home/metersphere/.docker buildx build --no-cache --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
|
||||
export JAVA_HOME=/opt/jdk-21
|
||||
export CLASSPATH=$JAVA_HOME/lib:$CLASSPATH
|
||||
export PATH=$JAVA_HOME/bin:/opt/apache-maven-3.8.3/bin:$PATH
|
||||
java -version
|
||||
LOCAL_REPOSITORY=$(mvn help:evaluate -Dexpression=settings.localRepository --settings ./settings.xml -q -DforceStdout)
|
||||
# echo $LOCAL_REPOSITORY
|
||||
|
||||
libraries=('metersphere-ui-test-impl' 'metersphere-load-test-impl' 'general-xpack-impl')
|
||||
for library in "${libraries[@]}";
|
||||
do
|
||||
cp -rf $LOCAL_REPOSITORY/io/metersphere/$library/${REVISION}/$library-${REVISION}.jar backend/app/target/dependency/BOOT-INF/lib/
|
||||
#
|
||||
mvn dependency:copy-dependencies --file $LOCAL_REPOSITORY/io/metersphere/$library/${REVISION}/$library-${REVISION}.pom --settings ./settings.xml
|
||||
cp -rf $LOCAL_REPOSITORY/io/metersphere/$library/${REVISION}/target/lib/* backend/app/target/dependency/BOOT-INF/lib/
|
||||
done
|
||||
|
||||
docker --config /home/metersphere/.docker buildx build --no-cache --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t ${IMAGE_PREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}-enterprise --platform linux/amd64,linux/arm64 . --push
|
||||
# 同步提交到 dockerhub
|
||||
docker --config /home/metersphere/.docker buildx build --no-cache --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t metersphere/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} --platform linux/amd64,linux/arm64 . --push
|
||||
docker --config /home/metersphere/.docker buildx build --no-cache --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-\${GIT_COMMIT:0:8} -t metersphere/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}-enterprise --platform linux/amd64,linux/arm64 . --push
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post('Notification') {
|
||||
always {
|
||||
sh "echo \$WEBHOOK\n"
|
||||
|
|
Loading…
Reference in New Issue