Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-manage-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-manage-ui
Commits
43a80b9d
Commit
43a80b9d
authored
Jun 19, 2023
by
张俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[feat](cicd): 添加部署和版本修改脚本
parent
412e0c6b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
18 deletions
+114
-18
.beagle.yml
.beagle.yml
+29
-16
package.json
package.json
+3
-2
version.js
version.js
+82
-0
No files found.
.beagle.yml
View file @
43a80b9d
...
...
@@ -59,7 +59,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
base
:
registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-amd64
# 基础镜像
dockerfile
:
.beagle/dockerfile
repo
:
smart-operation/so-manage-ui
# 生成镜像的 分组/名称
version
:
"
3.0.0
"
# 版本号
version
:
"
v3.0.1
"
# 版本号
channel
:
amd64
# 后缀
args
:
"
TARGETOS=linux,TARGETARCH=amd64"
# 不同架构的构建参数
registry
:
hub.wodcloud.com
# 私有仓库地址
...
...
@@ -68,6 +68,19 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
registry_password
:
# 密码
from_secret
:
REGISTRY_PASSWORD
-
name
:
deploy-amd64
image
:
registry.cn-qingdao.aliyuncs.com/wod/devops-kubernetes:1.0
settings
:
namespace
:
apaas-v5
deployment
:
apaas-portal-ui
container
:
apaas-portal-ui
image
:
hub.wodcloud.com/smart-operation/so-manage-ui:v3.0.1-amd64
environment
:
KUBERNETES_SERVER
:
from_secret
:
KUBERNETES_SERVER
KUBERNETES_TOKEN
:
from_secret
:
KUBERNETES_TOKEN
-
name
:
docker-arm64
image
:
registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
volumes
:
...
...
@@ -77,7 +90,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
base
:
registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-arm64
dockerfile
:
.beagle/dockerfile
repo
:
smart-operation/so-manage-ui
version
:
"
3.0.0
"
version
:
"
v3.0.1
"
channel
:
arm64
args
:
"
TARGETOS=linux,TARGETARCH=arm64"
registry
:
hub.wodcloud.com
...
...
@@ -95,7 +108,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
base
:
registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-ppc64le
dockerfile
:
.beagle/dockerfile
repo
:
smart-operation/so-manage-ui
version
:
"
3.0.0
"
version
:
"
v3.0.1
"
channel
:
ppc64le
args
:
"
TARGETOS=linux,TARGETARCH=ppc64le"
registry
:
hub.wodcloud.com
...
...
@@ -113,7 +126,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
base
:
registry.cn-qingdao.aliyuncs.com/wod/nginx:1.19.5-mips64le
dockerfile
:
.beagle/dockerfile
repo
:
smart-operation/so-manage-ui
version
:
"
3.0.0
"
version
:
"
v3.0.1
"
channel
:
mips64le
args
:
"
TARGETOS=linux,TARGETARCH=mips64le"
registry
:
hub.wodcloud.com
...
...
@@ -126,8 +139,8 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
image
:
registry.cn-qingdao.aliyuncs.com/wod/devops-docker-manifest:1.0
settings
:
platforms
:
linux/amd64,linux/arm64,linux/ppc64le,linux/mips64le
template
:
hub.wodcloud.com/smart-operation/so-manage-ui:
3.0.0
-ARCH
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:
3.0.0
template
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v3.0.1
-ARCH
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v3.0.1
username
:
from_secret
:
REGISTRY_USER
password
:
...
...
@@ -158,8 +171,8 @@ steps:
REGISTRY_PASSWORD
:
from_secret
:
REGISTRY_PASSWORD
settings
:
source
:
hub.wodcloud.com/smart-operation/so-manage-ui:
3.0.0
-amd64
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:3.0-amd64
source
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v3.0.1
-amd64
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v
3.0-amd64
registry
:
hub.wodcloud.com
-
name
:
harbor-arm64
...
...
@@ -176,8 +189,8 @@ steps:
REGISTRY_PASSWORD
:
from_secret
:
REGISTRY_PASSWORD
settings
:
source
:
hub.wodcloud.com/smart-operation/so-manage-ui:
3.0.0
-arm64
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:3.0-arm64
source
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v3.0.1
-arm64
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v
3.0-arm64
registry
:
hub.wodcloud.com
-
name
:
harbor-ppc64le
...
...
@@ -194,8 +207,8 @@ steps:
REGISTRY_PASSWORD
:
from_secret
:
REGISTRY_PASSWORD
settings
:
source
:
hub.wodcloud.com/smart-operation/so-manage-ui:
3.0.0
-ppc64le
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:3.0-ppc64le
source
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v3.0.1
-ppc64le
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v
3.0-ppc64le
registry
:
hub.wodcloud.com
-
name
:
harbor-mips64le
...
...
@@ -212,16 +225,16 @@ steps:
REGISTRY_PASSWORD
:
from_secret
:
REGISTRY_PASSWORD
settings
:
source
:
hub.wodcloud.com/smart-operation/so-manage-ui:
3.0.0
-mips64le
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:3.0-mips64le
source
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v3.0.1
-mips64le
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v
3.0-mips64le
registry
:
hub.wodcloud.com
-
name
:
harbor-arch
image
:
registry.cn-qingdao.aliyuncs.com/wod/devops-docker-manifest:1.0
settings
:
platforms
:
linux/amd64,linux/arm64,linux/ppc64le,linux/mips64le
template
:
hub.wodcloud.com/smart-operation/so-manage-ui:3.0-ARCH
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:3.0
template
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v
3.0-ARCH
target
:
hub.wodcloud.com/smart-operation/so-manage-ui:
v
3.0
username
:
from_secret
:
REGISTRY_USER
password
:
...
...
package.json
View file @
43a80b9d
{
"version"
:
"
5.0.15
"
,
"version"
:
"
3.0.1
"
,
"scripts"
:
{
"dev"
:
"vite"
,
"build"
:
"vite build"
,
"version"
:
"node version.js"
,
"serve"
:
"vite preview"
},
"dependencies"
:
{
...
...
version.js
0 → 100644
View file @
43a80b9d
/**
* params
* input: node version newVersion
* output:process.argv == ['','','to']
*/
const
path
=
require
(
'
path
'
);
const
fs
=
require
(
'
fs
'
);
console
.
log
(
process
.
argv
)
const
argv
=
process
.
argv
// 获取命令行参数中的新版本号,并过滤v字头
let
newVersion
=
''
if
(
argv
[
2
].
includes
(
'
v
'
)){
newVersion
=
process
.
argv
[
2
].
replace
(
/^v/
,
''
)
}
else
if
(
argv
[
2
].
includes
(
'
V
'
)){
newVersion
=
argv
[
2
].
replace
(
/^V/
,
''
)
}
else
{
newVersion
=
argv
[
2
]
}
if
(
!
newVersion
)
{
console
.
log
(
'
请传入新版本号,版本号遵循semver规范 .eg: 1.0.0, 1.0.1, 1.1.0
'
);
process
.
exit
(
1
);
}
// 获取当前命令行上下文路径
const
currentDirectory
=
process
.
cwd
();
// 获取 package.json 文件中的版本号
const
packageJsonPath
=
path
.
join
(
currentDirectory
,
'
package.json
'
);
const
packageJsonContent
=
fs
.
readFileSync
(
packageJsonPath
,
'
utf8
'
);
const
packageJson
=
JSON
.
parse
(
packageJsonContent
);
const
currentVersion
=
packageJson
.
version
;
packageJson
.
version
=
newVersion
;
//获取.beagle.yml及其版本号,并进行替换
const
filePath
=
path
.
join
(
__dirname
,
'
.beagle.yml
'
);
fs
.
readFile
(
filePath
,
'
utf8
'
,
function
(
err
,
data
)
{
if
(
err
)
{
return
console
.
log
(
err
);
}
let
from
=
'
v
'
+
currentVersion
;
let
to
=
''
if
(
argv
[
2
].
includes
(
'
v
'
)){
to
=
argv
[
2
]
}
else
if
(
argv
[
2
].
includes
(
'
V
'
)){
to
=
argv
[
2
].
replace
(
/^V/
,
'
v
'
)
}
else
{
to
=
'
v
'
+
argv
[
2
]
}
let
re
=
new
RegExp
(
from
,
"
g
"
);
let
result
=
data
.
replace
(
re
,
to
);
//有大版本号的输入则替换大版本号
let
fromArr
=
from
.
split
(
'
.
'
)
let
toArr
=
to
.
split
(
'
.
'
)
//前2个相等则是小版本迭代
if
(
fromArr
[
0
]
==
toArr
[
0
]
&&
fromArr
[
1
]
==
toArr
[
1
]){
}
else
{
let
shortFrom
=
"
:
"
+
fromArr
[
0
]
+
'
.
'
+
fromArr
[
1
];
let
shortTo
=
"
:
"
+
toArr
[
0
]
+
'
.
'
+
toArr
[
1
];
let
reShort
=
new
RegExp
(
shortFrom
,
"
g
"
);
result
=
result
.
replace
(
reShort
,
shortTo
);
}
//更新yml文件中的版本号
fs
.
writeFile
(
filePath
,
result
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
return
console
.
log
(
err
);
});
// 更新 package.json 文件中的版本号
fs
.
writeFileSync
(
packageJsonPath
,
JSON
.
stringify
(
packageJson
,
null
,
2
));
console
.
log
(
`版本号已从
${
currentVersion
}
更新为
${
newVersion
}
`
);
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment