Compare commits

...

4 Commits

Author SHA1 Message Date
aixianling
c335d97a3f feat(devops): 为 web 和 wxwork 类型的打包任务添加 webhook 支持
- 在打包信息中增加了 webhook 字段
- 更新了构建配置参数,将 webhook 传递给 Jenkins 构建任务
2025-01-15 11:40:11 +08:00
aixianling
456e55bb2e build(Dockerfile): 设置时区为亚洲/上海
- 在 Dockerfile 中添加环境变量 TZ=Asia/Shanghai
- 这个改动将使容器运行时使用北京时间
2025-01-08 16:33:47 +08:00
aixianling
8586b76ef2 feat(node): 添加自定义节点配置的 webhook 字段
- 在 node_custom_config 表单中新增 webhook 字段
- 通过 REST API 接口 /node/custom/addOrUpdate 添加或更新自定义节点配置时,支持 webhook 参数
2025-01-08 15:41:30 +08:00
aixianling
3767f1938a feat(webhook): 动态获取 webhook key
- 修改了 webhook通知功能,使其能够动态获取 key
- 在发送请求时,使用 info.webhook 作为 key 的值,如果为空则使用默认值
2025-01-07 10:26:42 +08:00
4 changed files with 7 additions and 5 deletions

View File

@@ -7,4 +7,6 @@ RUN npm i --registry=http://registry.npmmirror.com
EXPOSE 12525
ENV TZ=Asia/Shanghai
CMD ["node", "index.js"]

View File

@@ -3,10 +3,10 @@ module.exports = {
action: "/node/custom/addOrUpdate",
method: "post",
execute: (request, response) => {
let {id, name, type, customPath, apps, createTime, dist, version, zipTime, download, error, extra} = request.body
let {id, name, type, customPath, apps, createTime, dist, version, zipTime, download, error, extra,webhook} = request.body
dbUtils.addOrUpdate({
table: 'node_custom_config',
form: {id, name, type, customPath, apps, createTime, dist, version, zipTime, download, error, extra}
form: {id, name, type, customPath, apps, createTime, dist, version, zipTime, download, error, extra,webhook}
}).then(data => {
response.send({code: 0, data})
}).catch(err => {

View File

@@ -14,7 +14,7 @@ module.exports = {
> 发布版本:${info.version}
> 打包完成时间:${info.download}`
}
}, {params: {key: "a5971027-2dd3-4c23-a4e4-c99a962d25a7",}}).then(res => {
}, {params: {key: info.webhook || "a5971027-2dd3-4c23-a4e4-c99a962d25a7",}}).then(res => {
response.send({code: 0, msg: res.data})
})
} else response.send({code: 1, err: "无法找到项目信息"})

View File

@@ -61,7 +61,7 @@ const handleZip = (id, ws) => {
const {signal} = controller;
const progress = new counter(`正在处理 ${info.name} 的打包工作...`)
if (['web','wxwork'].includes(info.type)) {
const {name, version, dist} = info
const {name, version, dist,webhook} = info
const deploy = dist?.trim() || `${name}v${version}`
const buildConfig = {
web: {task: "devops-web", token: 'fLeOGSVIRs405Me'},
@@ -72,7 +72,7 @@ const handleZip = (id, ws) => {
.then(() => progress.set(30, id))
.then(() => fse.emptyDir(dist || `../zips/${deploy}`))
.then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => currentJob = (res.data?.nextBuildNumber || 1)))
.then(() => http.get(`/view/devops/job/${buildConfig.task}/buildWithParameters`, {params: {token: buildConfig.token, pid: id, dist: deploy}}))
.then(() => http.get(`/view/devops/job/${buildConfig.task}/buildWithParameters`, {params: {token: buildConfig.token, pid: id, dist: deploy,webhook}}))
.then(() => new Promise((resolve, reject) => {
jobs[id] = {task: buildConfig.task, build: currentJob}
const timer = setInterval(() => {