Compare commits

...

3 Commits

Author SHA1 Message Date
Follow Fate 02609d1230
Pre Merge pull request !1122 from Follow Fate/N/A 2026-01-06 05:53:17 +00:00
RuoYi 1f2f11f80f 修复Excel自定义格式样式污染问题 2026-01-06 13:53:11 +08:00
Follow Fate 53abbdb405
add Jenkinsfile.
Signed-off-by: Follow Fate <1934378319@qq.com>
2025-12-12 00:48:48 +00:00
2 changed files with 200 additions and 1 deletions

184
Jenkinsfile vendored 100644
View File

@ -0,0 +1,184 @@
pipeline {
agent {
kubernetes {
cloud 'prod-k8s'
slaveConnectTimeout 1200
workspaceVolume hostPathWorkspaceVolume(hostPath:"/opt/workspace", readOnly: false)
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- args: [\'$(JENKINS_SECRET)\', \'$(JENKINS_NAME)\']
image: "registry.cn-hangzhou.aliyuncs.com/hujiaming/jnlp-slave:1.0.0"
name: jnlp
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: "/etc/localtime"
name: "localtime"
readOnly: false
- command:
- "cat"
env:
- name: "LANGUAGE"
value: "en_US:en"
- name: "LC_ALL"
value: "en_US.UTF-8"
- name: "LANG"
value: "en_US.UTF-8"
image: "registry.cn-hangzhou.aliyuncs.com/hujiaming/node:alpine-lts"
imagePullPolicy: "IfNotPresent"
name: "build"
tty: true
volumeMounts:
- mountPath: "/etc/localtime"
name: "localtime"
- mountPath: "/root/.m2/"
name: "cachedir"
readOnly: false
- command:
- "cat"
env:
- name: "LANGUAGE"
value: "en_US:en"
- name: "LC_ALL"
value: "en_US.UTF-8"
- name: "LANG"
value: "en_US.UTF-8"
image: "registry.cn-hangzhou.aliyuncs.com/hujiaming/kubectl:alpine"
imagePullPolicy: "IfNotPresent"
name: "kubectl"
tty: true
volumeMounts:
- mountPath: "/etc/localtime"
name: "localtime"
readOnly: false
- command:
- "sleep"
args:
- "99d"
env:
- name: "LANGUAGE"
value: "en_US:en"
- name: "LC_ALL"
value: "en_US.UTF-8"
- name: "LANG"
value: "en_US.UTF-8"
image: "registry.cn-hangzhou.aliyuncs.com/hujiaming/kaniko-executor:1.0.0"
imagePullPolicy: "IfNotPresent"
name: "kaniko"
tty: true
volumeMounts:
- mountPath: "/etc/localtime"
name: "localtime"
readOnly: false
- mountPath: "/kaniko/.docker"
name: "docker-registry-config"
restartPolicy: "Never"
nodeSeletor:
build: "true"
volumes:
- name: docker-registry-config
configMap:
name: docker-registry-config
- hostPath:
path: "/usr/share/zoneinfo/Asia/Shanghai"
name: "localtime"
- name: "cachedir"
hostPath:
path: "/opt/m2"
'''
}
}
stages {
stage('Pulling Code') {
parallel {
stage('Pulling Code by Jenkins') {
when {
expression {
env.gitlabBranch == null
}
}
steps {
git(changelog: true, poll: true, url: "${GIT_URL}", branch:"${BRANCH}", credentialsId: 'jenkinskey')
script {
COMMIT_ID = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim()
TAG = BUILD_TAG + '-' + COMMIT_ID
println "Current branch is ${BRANCH}, Commit ID is ${COMMIT_ID}, Image TAG is ${TAG}"
}
}
}
stage('Pulling Code by trigger') {
when {
expression {
env.gitlabBranch != null
}
}
steps {
git(url: "${GIT_URL}", branch: env.gitlabBranch, changelog:true, poll: true, credentialsId: 'jenkinskey')
script {
COMMIT_ID = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim()
TAG = BUILD_TAG + '-' + COMMIT_ID
println "Current branch is ${env.gitlabBranch}, Commit ID is ${COMMIT_ID}, Image TAG is ${TAG}"
}
}
}
}
}
stage('Building') {
steps {
container(name: 'build') {
sh """
cd ruoyi-ui
npm install --registry=https://registry.npmmirror.com/
npm run build:prod
ls
"""
}
}
}
stage('Build for creating image') {
steps {
container(name: 'kaniko') {
sh """
executor -d ${HARBOR_ADDRESS}/${REGISTRY_DIR}/${IMAGE_NAME}:${TAG} -c . --insecure --skip-tls-verify
"""
}
}
}
stage('Deploying to K8s') {
environment {
MY_KUBECONFIG = credentials('prod-k8s')
}
steps {
container(name: 'kubectl'){
sh """
kubectl --kubeconfig $MY_KUBECONFIG set image deploy -l app=${IMAGE_NAME} ${IMAGE_NAME}=${HARBOR_ADDRESS}/${REGISTRY_DIR}/${IMAGE_NAME}:${TAG} -n $NAMESPACE
"""
}
}
}
}
environment {
COMMIT_ID = ""
HARBOR_ADDRESS = "192.168.88.171"
REGISTRY_DIR = "ruoyi"
IMAGE_NAME = "ruoyi-ui"
NAMESPACE = "ruoyi"
TAG = ""
GIT_URL = "git@gitee.com:follow_fates/ruoyi-ui.git"}
parameters {
gitParameter(
branch: '',
branchFilter: 'origin/(.*)',
defaultValue: '',
description: 'Branch for build and deploy',
name: 'BRANCH',
quickFilterEnabled: false,
selectedValue: 'NONE',
sortMode: 'NONE',
tagFilter: '*',
type: 'PT_BRANCH'
)
}
}

View File

@ -1153,7 +1153,7 @@ public class ExcelUtil<T>
String dictType = attr.dictType();
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
{
cell.getCellStyle().setDataFormat(this.wb.getCreationHelper().createDataFormat().getFormat(dateFormat));
cell.setCellStyle(createCellStyle(cell.getCellStyle(), dateFormat));
cell.setCellValue(parseDateToStr(dateFormat, value));
}
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
@ -1192,6 +1192,21 @@ public class ExcelUtil<T>
return cell;
}
/**
* 使
*
* @param cellStyle
* @param format
* @return CellStyle
*/
private CellStyle createCellStyle(CellStyle cellStyle, String format)
{
CellStyle style = wb.createCellStyle();
style.cloneStyleFrom(cellStyle);
style.setDataFormat(wb.getCreationHelper().createDataFormat().getFormat(format));
return style;
}
/**
* POI XSSFSheet
*