Compare commits

...

13 Commits

Author SHA1 Message Date
xiaojunnuo
b258e92620 v1.1.4 2023-07-03 12:30:41 +08:00
xiaojunnuo
f6148ef1fb build: prepare to build 2023-07-03 12:25:26 +08:00
xiaojunnuo
457da594be build: prepare to build 2023-07-03 11:53:44 +08:00
xiaojunnuo
891a43ae67 perf: flush log 2023-07-03 11:53:11 +08:00
xiaojunnuo
bc65c0a786 perf: cancel task 2023-07-03 11:45:32 +08:00
xiaojunnuo
3eeb1f77aa perf: timeout 2023-07-03 11:16:46 +08:00
xiaojunnuo
91be6826b9 perf: flush logger 2023-07-03 10:54:03 +08:00
xiaojunnuo
f87eee3b9f fix: 成功图标转动的问题 2023-07-03 10:31:25 +08:00
xiaojunnuo
b4e17691c4 chore: index update fast 2023-07-03 10:29:06 +08:00
xiaojunnuo
cce372aeba chore: env config 2023-07-03 10:14:22 +08:00
xiaojunnuo
b5a8a9e08a chore: deploy 2023-07-03 10:05:50 +08:00
xiaojunnuo
35632da284 chore: deploy 2023-07-03 09:33:18 +08:00
xiaojunnuo
02a9b0d16c chore: 1.1.3 2023-07-03 09:25:52 +08:00
40 changed files with 346 additions and 102 deletions

View File

@@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Bug Fixes
* 成功图标转动的问题 ([f87eee3](https://github.com/certd/certd/commit/f87eee3b9ff1ef9874e79a81fe0ed7104cb9ee8c))
### Performance Improvements
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
* flush logger ([91be682](https://github.com/certd/certd/commit/91be6826b902e0f302b1a6cbdb1d24e15914c18d))
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package root

View File

@@ -2,9 +2,10 @@ import http from 'axios'
import fs from 'fs'
//读取 packages/core/pipline/package.json的版本号
import { default as packageJson } from './packages/core/pipeline/package.json' assert { type: "json" };
import {default as packageJson} from './packages/core/pipeline/package.json' assert {type: "json"};
const certdVersion = packageJson.version
console.log("certdVersion",certdVersion)
console.log("certdVersion", certdVersion)
// 同步npmmirror的包
async function getPackages(directoryPath) {
@@ -29,18 +30,18 @@ async function getPackages(directoryPath) {
}
async function getAllPackages(){
async function getAllPackages() {
const base = await getPackages("./packages/core")
const plugins =await getPackages("./packages/plugins")
const plugins = await getPackages("./packages/plugins")
return base.concat(plugins)
}
async function sync(){
async function sync() {
const packages = await getAllPackages()
for(const pkg of packages){
for (const pkg of packages) {
await http({
url: `https://registry-direct.npmmirror.com/@certd/${pkg}/sync?sync_upstream=true`,
url: `http://registry-direct.npmmirror.com/@certd/${pkg}/sync?sync_upstream=true`,
method: 'PUT',
headers: {
"Content-Type": "application/json"
@@ -50,7 +51,6 @@ async function sync(){
console.log(`sync success:${pkg}`)
await sleep(1000)
}
await sleep(60000)
}
// curl -X PUT https://registry-direct.npmmirror.com/@certd/plugin-cert/sync?sync_upstream=true
@@ -87,6 +87,7 @@ async function start() {
console.log("等待60秒")
await sleep(60 * 1000)
await sync()
await sleep(60 * 1000)
await triggerBuild()
}

View File

@@ -1,7 +1,15 @@
#!/bin/bash
set -e
echo "请先输入一个版本号(如 1.0.6)"
read version
# 判断$CERTD_VERSION 是否存在
if [ -n "$CERTD_VERSION" ]; then
echo "CERTD_VERSION is set = $CERTD_VERSION"
version=$CERTD_VERSION
else
echo "CERTD_VERSION is not set"
echo "请先输入一个版本号(如 1.0.6)"
read version
fi
echo "您输入的版本号是: $version"
export TAG="$version"
sudo -E docker compose up -d

View File

@@ -1,20 +1,23 @@
version: '3.3' # 指定docker-compose 版本
services: # 要拉起的服务们
version: '3.3'
services:
certd:
# build:
# context: ./
# dockerfile: Dockerfile
# ↓↓↓↓↓ 修改镜像版本号
# 镜像 # ↓↓↓↓↓ --- 1、 修改镜像版本号
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${TAG}
container_name: certd # 容器名
restart: unless-stopped # 重启
volumes:
# ↓↓↓↓↓ 修改数据库以及证书存储路径
# ↓↓↓↓↓ ------------------------------------------------------- 2、 修改数据库以及证书存储路径
- /data/certd:/app/data
ports: # 端口映射
- "7001:7001"
environment:
environment: # 环境变量
- TZ=Asia/Shanghai
- certd_auth_jwt_secret=changeme
# ↑↑↑↑↑ 注意修改成你的自定义密钥
# ↑↑↑↑↑ ---------------------------------- 3、 修改成你的自定义密钥
# 设置环境变量即可自定义certd配置
# 服务端配置项见: packages/ui/certd-server/src/config/config.default.ts
# 服务端配置规则: certd_ + 配置项, 点号用_代替
# 如jwt密钥配置为 auth.jwt.secret则设置环境变量 certd_auth_jwt_secret=changeme
# 客户端配置项见: packages/ui/certd-client/.env
# 按实际名称配置环境变量即可,如: VITE_APP_API=http://localhost:7001

View File

@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.1.3"
"version": "1.1.4"
}

View File

@@ -11,7 +11,7 @@
"scripts": {
"start": "lerna bootstrap --hoist",
"i-all": "lerna link && lerna exec npm install ",
"publish": "npm run proxy && npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && node deploy.js",
"publish": "npm run proxy && npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && npm run deploy1",
"afterpublishOnly": "",
"proxy": "npm config set proxy=http://127.0.0.1:10809",
"prepublishOnly1": "npm run before-build && lerna run build ",

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/publishlab/node-acme-client/compare/v1.1.3...v1.1.4) (2023-07-03)
**Note:** Version bump only for package @certd/acme-client
## [1.1.3](https://github.com/publishlab/node-acme-client/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/acme-client

View File

@@ -1 +1 @@
09:21
12:25

View File

@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.1.3",
"version": "1.1.4",
"main": "src/index.js",
"types": "types",
"license": "MIT",

View File

@@ -3,6 +3,15 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
* flush logger ([91be682](https://github.com/certd/certd/commit/91be6826b902e0f302b1a6cbdb1d24e15914c18d))
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/pipeline

View File

@@ -1,10 +1,15 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.1.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"version": "1.1.4",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"scripts": {
"dev": "vite",
"build": "rollup -c",
@@ -18,7 +23,7 @@
"qs": "^6.11.2"
},
"devDependencies": {
"@certd/acme-client": "^1.1.3",
"@certd/acme-client": "^1.1.4",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",

View File

@@ -12,6 +12,7 @@ import { RegistryItem } from "../registry";
import { Decorator } from "../decorator";
import { IEmailService } from "../service";
import { FileStore } from "./file-store";
import { TimeoutPromise } from "../utils/util.promise";
export type ExecutorOptions = {
userId: any;
@@ -31,6 +32,7 @@ export class Executor {
lastStatusMap!: RunnableCollection;
lastRuntime!: RunHistory;
options: ExecutorOptions;
canceled = false;
onChanged: (history: RunHistory) => void;
constructor(options: ExecutorOptions) {
this.options = options;
@@ -50,6 +52,12 @@ export class Executor {
this.lastStatusMap = new RunnableCollection(lastRuntime?.pipeline);
}
async cancel() {
this.canceled = true;
this.runtime?.cancel(this.pipeline);
await this.onChanged(this.runtime);
}
async run(runtimeId: any = 0, triggerType: string) {
try {
await this.init();
@@ -99,17 +107,24 @@ export class Executor {
return ResultType.skip;
}
}
try {
await run();
this.runtime.success(runnable);
const intervalFlushLogId = setInterval(async () => {
await this.onChanged(this.runtime);
}, 5000);
const timeout = runnable.timeout ?? 20 * 60 * 1000;
try {
if (this.canceled) {
throw new Error("task canceled");
}
await TimeoutPromise(run, timeout);
this.runtime.success(runnable);
return ResultType.success;
} catch (e: any) {
this.runtime.error(runnable, e);
await this.onChanged(this.runtime);
throw e;
} finally {
this.runtime.finally(runnable);
clearInterval(intervalFlushLogId);
await this.onChanged(this.runtime);
}
}

View File

@@ -92,6 +92,19 @@ export class RunHistory {
this.logError(runnable, e);
}
cancel(runnable: Runnable) {
const now = new Date().getTime();
const status = runnable.status;
_.merge(status, {
status: ResultType.canceled,
endTime: now,
result: ResultType.canceled,
message: "用户取消",
});
this.log(runnable, "任务取消");
}
log(runnable: Runnable, text: string) {
// @ts-ignore
this._loggers[runnable.id].info(`[${runnable.title}]<id:${runnable.id}> [${runnable.runnableType}]`, text);

View File

@@ -66,6 +66,7 @@ export type Runnable = {
strategy?: RunnableStrategy;
runnableType?: string; // pipeline, stage, task , step
status?: HistoryResult;
timeout?: number;
default?: {
[key: string]: any;
};
@@ -105,6 +106,7 @@ export enum ResultType {
start = "start",
success = "success",
error = "error",
canceled = "canceled",
skip = "skip",
none = "none",
}

View File

@@ -0,0 +1,13 @@
export function TimeoutPromise(callback: () => Promise<void>, ms = 30 * 1000) {
let timeout: any;
return Promise.race([
callback(),
new Promise((resolve, reject) => {
timeout = setTimeout(() => {
reject(new Error(`Task timeout in ${ms} ms`));
}, ms);
}),
]).finally(() => {
clearTimeout(timeout);
});
}

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-aliyun

View File

@@ -1,10 +1,15 @@
{
"name": "@certd/plugin-aliyun",
"private": false,
"version": "1.1.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"version": "1.1.4",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"scripts": {
"dev": "vite",
"build1": "vue-tsc --noEmit && vite build",
@@ -18,10 +23,10 @@
"node-forge": "^0.10.0"
},
"devDependencies": {
"@certd/acme-client": "^1.1.3",
"@certd/pipeline": "^1.1.3",
"@certd/plugin-cert": "^1.1.3",
"@certd/plugin-util": "^1.1.3",
"@certd/acme-client": "^1.1.4",
"@certd/pipeline": "^1.1.4",
"@certd/plugin-cert": "^1.1.4",
"@certd/plugin-util": "^1.1.4",
"@midwayjs/core": "^3.0.0",
"@midwayjs/decorator": "^3.0.0",
"@rollup/plugin-commonjs": "^23.0.4",

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-all

View File

@@ -1,10 +1,15 @@
{
"name": "@certd/plugin-all",
"private": false,
"version": "1.1.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"version": "1.1.4",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"scripts": {
"dev": "vite",
"build2": " vite build",
@@ -12,12 +17,12 @@
"preview": "vite preview"
},
"devDependencies": {
"@certd/pipeline": "^1.1.3",
"@certd/plugin-aliyun": "^1.1.3",
"@certd/plugin-cert": "^1.1.3",
"@certd/plugin-host": "^1.1.3",
"@certd/plugin-huawei": "^1.1.3",
"@certd/plugin-tencent": "^1.1.3",
"@certd/pipeline": "^1.1.4",
"@certd/plugin-aliyun": "^1.1.4",
"@certd/plugin-cert": "^1.1.4",
"@certd/plugin-host": "^1.1.4",
"@certd/plugin-huawei": "^1.1.4",
"@certd/plugin-tencent": "^1.1.4",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-cert

View File

@@ -1,10 +1,15 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.1.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"version": "1.1.4",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"scripts": {
"dev": "vite",
"build": "rollup -c",
@@ -12,8 +17,8 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.1.3",
"@certd/pipeline": "^1.1.3",
"@certd/acme-client": "^1.1.4",
"@certd/pipeline": "^1.1.4",
"jszip": "^3.10.1",
"node-forge": "^0.10.0"
},

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-host

View File

@@ -1,10 +1,15 @@
{
"name": "@certd/plugin-host",
"private": false,
"version": "1.1.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"version": "1.1.4",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"scripts": {
"dev": "vite",
"build": "rollup -c",
@@ -12,8 +17,8 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/pipeline": "^1.1.3",
"@certd/plugin-cert": "^1.1.3",
"@certd/pipeline": "^1.1.4",
"@certd/plugin-cert": "^1.1.4",
"ssh2": "^0.8.9"
},
"devDependencies": {

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-huawei

View File

@@ -1,10 +1,15 @@
{
"name": "@certd/plugin-huawei",
"private": false,
"version": "1.1.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"version": "1.1.4",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"scripts": {
"dev": "vite",
"build": "rollup -c",
@@ -12,10 +17,10 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.1.3",
"@certd/pipeline": "^1.1.3",
"@certd/plugin-cert": "^1.1.3",
"@certd/plugin-util": "^1.1.3",
"@certd/acme-client": "^1.1.4",
"@certd/pipeline": "^1.1.4",
"@certd/plugin-cert": "^1.1.4",
"@certd/plugin-util": "^1.1.4",
"axios": "^0.27.2",
"dayjs": "^1.11.6",
"lodash": "^4.17.21",

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-tencent

View File

@@ -1,10 +1,15 @@
{
"name": "@certd/plugin-tencent",
"private": false,
"version": "1.1.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"version": "1.1.4",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"scripts": {
"dev": "vite",
"build": "rollup -c",
@@ -12,9 +17,9 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/pipeline": "^1.1.3",
"@certd/plugin-cert": "^1.1.3",
"@certd/plugin-util": "^1.1.3",
"@certd/pipeline": "^1.1.4",
"@certd/plugin-cert": "^1.1.4",
"@certd/plugin-util": "^1.1.4",
"tencentcloud-sdk-nodejs": "^4.0.44"
},
"devDependencies": {

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* timeout ([3eeb1f7](https://github.com/certd/certd/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/plugin-util

View File

@@ -1,10 +1,15 @@
{
"name": "@certd/plugin-util",
"private": false,
"version": "1.1.3",
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts",
"version": "1.1.4",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"publishConfig": {
"main": "./dist/bundle.js",
"module": "./dist/bundle.mjs",
"types": "./dist/d/index.d.ts"
},
"scripts": {
"dev": "vite",
"build": "rollup -c",
@@ -16,7 +21,7 @@
"shelljs": "^0.8.5"
},
"devDependencies": {
"@certd/pipeline": "^1.1.3",
"@certd/pipeline": "^1.1.4",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/certd/certd/compare/v1.1.3...v1.1.4) (2023-07-03)
### Bug Fixes
* 成功图标转动的问题 ([f87eee3](https://github.com/certd/certd/commit/f87eee3b9ff1ef9874e79a81fe0ed7104cb9ee8c))
### Performance Improvements
* cancel task ([bc65c0a](https://github.com/certd/certd/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
* flush log ([891a43a](https://github.com/certd/certd/commit/891a43ae6716ff98ed06643f7da2e35199ee195c))
## [1.1.3](https://github.com/certd/certd/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/ui-client

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.1.3",
"version": "1.1.4",
"private": true,
"scripts": {
"dev": "vite",
@@ -22,7 +22,7 @@
"dependencies": {
"@ant-design/colors": "^6.0.0",
"@ant-design/icons-vue": "^6.0.1",
"@certd/acme-client": "^1.1.3",
"@certd/acme-client": "^1.1.4",
"@fast-crud/fast-crud": "^1.14.4",
"@fast-crud/fast-extends": "^1.14.4",
"@fast-crud/ui-antdv": "^1.14.4",
@@ -59,7 +59,7 @@
"vuedraggable": "^4.0.1"
},
"devDependencies": {
"@certd/pipeline": "^1.1.3",
"@certd/pipeline": "^1.1.4",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/chai": "^4.3.4",

View File

@@ -67,6 +67,14 @@ export function Trigger(id: any) {
});
}
export function Cancel(historyId: any) {
return request({
url: apiPrefix + "/cancel",
method: "post",
params: { historyId }
});
}
export async function GetFiles(pipelineId: number) {
return request({
url: historyApiPrefix + "/files",

View File

@@ -9,6 +9,8 @@
<a-tag v-if="isCurrent" class="pointer" color="green" :closable="true" @close="cancel">当前</a-tag>
<a-tag v-else-if="!editMode" class="pointer" color="blue" @click="view">查看</a-tag>
<a-tag v-if="status.value === 'start'" class="pointer" color="red" @click="cancelTask">取消</a-tag>
</p>
</a-timeline-item>
</template>
@@ -16,6 +18,8 @@
<script lang="ts">
import { defineComponent, ref, provide, Ref, watch, computed } from "vue";
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
import * as api from "../../api";
import { Modal, notification } from "ant-design-vue";
export default defineComponent({
name: "PiHistoryTimelineItem",
props: {
@@ -38,7 +42,7 @@ export default defineComponent({
}
},
emits: ["view", "cancel"],
setup(props, ctx) {
setup(props: any, ctx: any) {
const status = computed(() => {
return statusUtil.get(props.runnable?.status?.result);
});
@@ -49,10 +53,25 @@ export default defineComponent({
function cancel() {
ctx.emit("cancel");
}
function cancelTask() {
Modal.confirm({
title: "确认取消",
content: "确认取消该任务吗?",
okText: "确认",
cancelText: "取消",
onOk: async () => {
await api.Cancel(props.runnable.id);
}
});
notification.success({
message: "任务取消成功"
});
}
return {
status,
cancel,
view
view,
cancelTask
};
}
});

View File

@@ -15,7 +15,7 @@
</template>
<script lang="ts">
import { inject, provide, Ref, ref } from "vue";
import { computed, inject, Ref, ref } from "vue";
import { RunHistory } from "../../type";
import PiStatusShow from "/@/views/certd/pipeline/pipeline/component/status-show.vue";
@@ -55,7 +55,9 @@ export default {
}
for (let node of nodes) {
if (currentHistory?.value?.logs != null) {
node.logs = currentHistory.value.logs[node.node.id] || [];
node.logs = computed(() => {
return currentHistory.value.logs[node.node.id] || [];
});
}
}

View File

@@ -14,7 +14,7 @@ const StatusEnum: StatusEnumType = {
value: "success",
label: "成功",
color: "green",
spin: true,
spin: false,
icon: "ant-design:check-circle-outlined"
},
error: {

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/fast-crud/fast-server-js/compare/v1.1.3...v1.1.4) (2023-07-03)
### Performance Improvements
* cancel task ([bc65c0a](https://github.com/fast-crud/fast-server-js/commit/bc65c0a786360c087fe95cad93ec6a87804cc5ee))
* flush logger ([91be682](https://github.com/fast-crud/fast-server-js/commit/91be6826b902e0f302b1a6cbdb1d24e15914c18d))
* timeout ([3eeb1f7](https://github.com/fast-crud/fast-server-js/commit/3eeb1f77aa2922f3545f3d2067f561d95621d54f))
## [1.1.3](https://github.com/fast-crud/fast-server-js/compare/v1.1.2...v1.1.3) (2023-07-03)
**Note:** Version bump only for package @certd/ui-server

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.1.3",
"version": "1.1.4",
"description": "fast-server base midway",
"private": true,
"scripts": {
@@ -21,15 +21,15 @@
"mig": "typeorm migration:create -n name"
},
"dependencies": {
"@certd/acme-client": "^1.1.3",
"@certd/pipeline": "^1.1.3",
"@certd/plugin-aliyun": "^1.1.3",
"@certd/plugin-all": "^1.1.3",
"@certd/plugin-cert": "^1.1.3",
"@certd/plugin-host": "^1.1.3",
"@certd/plugin-huawei": "^1.1.3",
"@certd/plugin-tencent": "^1.1.3",
"@certd/plugin-util": "^1.1.3",
"@certd/acme-client": "^1.1.4",
"@certd/pipeline": "^1.1.4",
"@certd/plugin-aliyun": "^1.1.4",
"@certd/plugin-all": "^1.1.4",
"@certd/plugin-cert": "^1.1.4",
"@certd/plugin-host": "^1.1.4",
"@certd/plugin-huawei": "^1.1.4",
"@certd/plugin-tencent": "^1.1.4",
"@certd/plugin-util": "^1.1.4",
"@koa/cors": "^3.4.3",
"@midwayjs/bootstrap": "^3.9.1",
"@midwayjs/cache": "^3.9.0",

View File

@@ -25,6 +25,11 @@ const development = {
alias: {
'/': '/index.html',
},
files: {
'/index.html': {
maxAge: 60 * 60 * 1000,
},
},
},
},
},

View File

@@ -11,6 +11,7 @@ import { CrudController } from '../../../basic/crud-controller';
import { PipelineService } from '../service/pipeline-service';
import { PipelineEntity } from '../entity/pipeline';
import { Constants } from '../../../basic/constants';
import { HistoryService } from '../service/history-service';
/**
* 证书
@@ -20,6 +21,8 @@ import { Constants } from '../../../basic/constants';
export class PipelineController extends CrudController<PipelineService> {
@Inject()
service: PipelineService;
@Inject()
historyService: HistoryService;
getService() {
return this.service;
@@ -77,4 +80,11 @@ export class PipelineController extends CrudController<PipelineService> {
await this.service.trigger(id);
return this.ok({});
}
@Post('/cancel', { summary: Constants.per.authOnly })
async cancel(@Query('historyId') historyId) {
await this.historyService.checkUserId(historyId, this.ctx.user.id);
await this.service.cancel(historyId);
return this.ok({});
}
}

View File

@@ -4,7 +4,7 @@ import { In, Repository } from 'typeorm';
import { BaseService } from '../../../basic/base-service';
import { PipelineEntity } from '../entity/pipeline';
import { PipelineDetail } from '../entity/vo/pipeline-detail';
import { Executor, Pipeline, RunHistory } from '@certd/pipeline';
import { Executor, Pipeline, ResultType, RunHistory } from '@certd/pipeline';
import { AccessService } from './access-service';
import { DbStorage } from './db-storage';
import { StorageService } from './storage-service';
@@ -16,6 +16,8 @@ import { HistoryLogService } from './history-log-service';
import { logger } from '../../../utils/logger';
import { EmailService } from '../../basic/service/email-service';
const runningTasks: Map<string | number, Executor> = new Map();
/**
* 证书申请
*/
@@ -178,7 +180,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
});
}
async run(id, triggerId) {
async run(id: number, triggerId: string) {
const entity: PipelineEntity = await this.info(id);
const pipeline = JSON.parse(entity.content);
@@ -219,11 +221,27 @@ export class PipelineService extends BaseService<PipelineEntity> {
fileRootDir: this.certdConfig.fileRootDir,
});
try {
runningTasks.set(historyId, executor);
await executor.init();
await executor.run(historyId, triggerType);
} catch (e) {
logger.error('执行失败:', e);
throw e;
} finally {
runningTasks.delete(historyId);
}
}
async cancel(historyId: number) {
const executor = runningTasks.get(historyId);
if (executor) {
await executor.cancel();
} else {
const entity = await this.historyService.info(historyId);
const pipeline: Pipeline = JSON.parse(entity.pipeline);
pipeline.status.status = ResultType.canceled;
const runtime = new RunHistory(historyId, null, pipeline);
await this.saveHistory(runtime);
}
}