Merge remote-tracking branch 'origin/v2' into v2

# Conflicts:
#	.github/workflows/build-image.yml
#	build.trigger
pull/101/head
xiaojunnuo 2024-07-24 10:55:21 +08:00
commit 4060f6ecbc
34 changed files with 160 additions and 74 deletions

View File

@ -12,7 +12,7 @@ permissions:
contents: read
jobs:
sync:
build-certd-image:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
@ -20,28 +20,19 @@ jobs:
- name: get_certd_version
id: get_certd_version
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const fs = require('fs');
const path = require('path');
const pnpmWorkspace = "pnpm-workspace.yaml";
fs.removeSync(pnpmWorkspace)
const pnpmWorkspace = "./pnpm-workspace.yaml";
fs.unlinkSync(pnpmWorkspace)
const jsonFilePath = "./packages/ui/certd-server/package.json";
const jsonContent = fs.readFileSync(jsonFilePath, 'utf-8');
console.log(jsonContent)
const pkg = JSON.parse(jsonContent)
// 打印 JSON 文件内容
console.log("certd_version:",pkg.version);
// 输出 JSON 对象,可以在后续步骤中使用
return {"version":"0.0.5"};
- name: Set up the working directory
run: |
mkdir -p ./packages/ui/
working-directory: ./packages/ui/
return pkg.version
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@ -49,17 +40,18 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
- name: Login to aliyun container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-shenzhen.aliyuncs.com
username: ${{ secrets.ALIYUN_CS_USERNAME }}
password: ${{ secrets.ALIYUN_CS_PASSWORD }}
username: ${{ secrets.aliyun_cs_username }}
password: ${{ secrets.aliyun_cs_password }}
- name: Build and push
uses: docker/build-push-action@v6.5.0
with:
platforms: linux/amd64,linux/arm64
# platforms: linux/amd64,linux/arm64
push: true
context: ./packages/ui/
tags: |
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.version}}
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}}

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.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
### Bug Fixes
* 修复创建流水线时无法根据dns类型默认正确的dns授权的bug ([a2c43b5](https://github.com/certd/certd/commit/a2c43b50a6069ed48958fd142844a8568c2af452))
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
### Performance Improvements

View File

@ -1 +1 @@
6
4

View File

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

View File

@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.22.1"
"version": "1.22.2"
}

View File

@ -12,10 +12,10 @@
"scripts": {
"start": "lerna bootstrap --hoist",
"i-all": "lerna link && lerna exec npm install ",
"publish": "npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && npm run deploy1",
"publish": "npm run prepublishOnly1 && lerna publish --conventional-commits --create-release github && npm run afterpublishOnly && npm run deploy1",
"afterpublishOnly": "",
"prepublishOnly1": "npm run check && npm run before-build && lerna run build ",
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add build.trigger && git commit -m \\\"build: prepare to build\\\"",
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
"deploy1": "node --experimental-json-modules deploy.js ",
"check": "node --experimental-json-modules publish-check.js",
"init": "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.22.2](https://github.com/publishlab/node-acme-client/compare/v1.22.1...v1.22.2) (2024-07-23)
**Note:** Version bump only for package @certd/acme-client
## [1.22.1](https://github.com/publishlab/node-acme-client/compare/v1.22.0...v1.22.1) (2024-07-20)
**Note:** Version bump only for package @certd/acme-client

View File

@ -1 +1 @@
03:10
02:24

View File

@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.22.1",
"version": "1.22.2",
"main": "src/index.js",
"types": "types/index.d.ts",
"license": "MIT",
@ -59,5 +59,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "47fe3d5826661f678d081ab53e67c847a3239d88"
"gitHead": "e5da46cfc31b2e30a4903bcb2251b1851265ef41"
}

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.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
**Note:** Version bump only for package @certd/pipeline
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
### Performance Improvements

View File

@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.22.1",
"version": "1.22.2",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -55,5 +55,5 @@
"vite": "^4.3.8",
"vue-tsc": "^1.6.5"
},
"gitHead": "47fe3d5826661f678d081ab53e67c847a3239d88"
"gitHead": "e5da46cfc31b2e30a4903bcb2251b1851265ef41"
}

View File

@ -283,7 +283,7 @@ export class Executor {
}
if (notification.type === "email") {
try {
this.options.emailService?.send({
await this.options.emailService?.send({
userId: this.pipeline.userId,
subject,
content,

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.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
**Note:** Version bump only for package @certd/lib-k8s
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
**Note:** Version bump only for package @certd/lib-k8s

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.22.1",
"version": "1.22.2",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -17,7 +17,7 @@
"shelljs": "^0.8.5"
},
"devDependencies": {
"@certd/pipeline": "^1.22.1",
"@certd/pipeline": "^1.22.2",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
@ -38,5 +38,5 @@
"tslib": "^2.5.2",
"typescript": "^4.8.4"
},
"gitHead": "47fe3d5826661f678d081ab53e67c847a3239d88"
"gitHead": "e5da46cfc31b2e30a4903bcb2251b1851265ef41"
}

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.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.22.1",
"version": "1.22.2",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@ -53,5 +53,5 @@
"typeorm": "^0.3.11",
"typescript": "~5.1.0"
},
"gitHead": "47fe3d5826661f678d081ab53e67c847a3239d88"
"gitHead": "e5da46cfc31b2e30a4903bcb2251b1851265ef41"
}

View File

@ -227,8 +227,10 @@ export class Flyway {
if (history.hash !== hash && this.allowHashNotMatch === false) {
throw new Error(file + `hash conflict ,old: ${history.hash} != new: ${hash}`);
}
this.logger.info('[ midfly ] script<' + file + '> already executed');
return true;
}
this.logger.info('[ midfly ] script<' + file + '> not yet execute');
return false;
}

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.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
**Note:** Version bump only for package @certd/plugin-cert
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
### Performance Improvements

View File

@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.22.1",
"version": "1.22.2",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -13,8 +13,8 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.22.1",
"@certd/pipeline": "^1.22.1",
"@certd/acme-client": "^1.22.2",
"@certd/pipeline": "^1.22.2",
"jszip": "^3.10.1",
"node-forge": "^0.10.0",
"psl": "^1.9.0"
@ -53,5 +53,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "47fe3d5826661f678d081ab53e67c847a3239d88"
"gitHead": "e5da46cfc31b2e30a4903bcb2251b1851265ef41"
}

View File

@ -33,6 +33,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
vModel: "value",
options: [
{ value: "letsencrypt", label: "Let's Encrypt" },
// { value: "letsencrypt-proxy", label: "Let's Encrypt代理letsencrypt.org无法访问时使用" },
// { value: "buypass", label: "Buypass" },
{ value: "zerossl", label: "ZeroSSL" },
],

View File

@ -0,0 +1 @@
export const dnsList = [];

View File

@ -1,9 +1,9 @@
import { IsTaskPlugin, pluginGroups, RunStrategy, sp, Step, TaskInput } from "@certd/pipeline";
import type { CertInfo } from "./acme.js";
import { CertReader } from "./cert-reader.js";
import { CertApplyBasePlugin } from "./base.js";
import type { CertInfo } from "../acme.js";
import { CertReader } from "../cert-reader.js";
import { CertApplyBasePlugin } from "../base.js";
import fs from "fs";
import { EabAccess } from "../../access";
import { EabAccess } from "../../../access/index.js";
import path from "path";
export { CertReader };
@ -25,6 +25,21 @@ export type { CertInfo };
},
})
export class CertApplyLegoPlugin extends CertApplyBasePlugin {
// @TaskInput({
// title: "ACME服务端点",
// default: "https://acme-v02.api.letsencrypt.org/directory",
// component: {
// name: "a-select",
// vModel: "value",
// options: [
// { value: "https://acme-v02.api.letsencrypt.org/directory", label: "Let's Encrypt" },
// { value: "https://letsencrypt.proxy.handsfree.work/directory", label: "Let's Encrypt代理letsencrypt.org无法访问时使用" },
// ],
// },
// required: true,
// })
acmeServer!: string;
@TaskInput({
title: "DNS类型",
component: {
@ -110,8 +125,14 @@ export class CertApplyLegoPlugin extends CertApplyBasePlugin {
const savePathArgs = `--path "${saveDir}"`;
const os_type = process.platform === "win32" ? "windows" : "linux";
const legoPath = path.resolve("./tools", os_type, "lego");
let serverArgs = "";
if (this.acmeServer) {
serverArgs = ` --server ${this.acmeServer}`;
}
const cmds = [
`${legoPath} -a --email "${this.email}" --dns ${this.dnsType} ${keyType} ${domainArgs} ${eabArgs} ${savePathArgs} ${this.customArgs || ""} run`,
`${legoPath} -a --email "${this.email}" --dns ${this.dnsType} ${keyType} ${domainArgs} ${serverArgs} ${eabArgs} ${savePathArgs} ${
this.customArgs || ""
} run`,
];
await sp.spawn({

View File

@ -1,2 +1,2 @@
export * from "./cert-plugin/index.js";
export * from "./cert-plugin/lego.js";
export * from "./cert-plugin/lego/index.js";

View File

@ -2,8 +2,7 @@ FROM node:18-alpine as builder
EXPOSE 7001
WORKDIR /workspace/
COPY . /workspace/
RUN npm install -g pnpm@8.15.7 --registry=https://registry.npmmirror.com
RUN pnpm config set registry https://registry.npmmirror.com/
RUN npm install -g pnpm@8.15.7
RUN cd /workspace/certd-client && pnpm install && npm run build
RUN cd /workspace/certd-server && pnpm install && npm run build-on-docker
@ -14,9 +13,9 @@ RUN cp /workspace/certd-client/dist/* /workspace/certd-server/public/ -rf
FROM node:18-alpine
WORKDIR /app/
COPY --from=builder /workspace/certd-server/ /app/
ENV TZ Asia/Shanghai
ENV NODE_ENV production
ENV MIDWAY_SERVER_ENV production
ENV TZ=Asia/Shanghai
ENV NODE_ENV=production
ENV MIDWAY_SERVER_ENV=production
CMD ["npm", "run","start"]

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.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
### Bug Fixes
* 修复创建流水线时无法根据dns类型默认正确的dns授权的bug ([a2c43b5](https://github.com/certd/certd/commit/a2c43b50a6069ed48958fd142844a8568c2af452))
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
### Performance Improvements

View File

@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.22.1",
"version": "1.22.2",
"private": true,
"scripts": {
"dev": "vite --open",
@ -59,7 +59,7 @@
"vuedraggable": "^2.24.3"
},
"devDependencies": {
"@certd/pipeline": "^1.22.1",
"@certd/pipeline": "^1.22.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12",

View File

@ -0,0 +1,19 @@
import _ from "lodash-es";
import { compute } from "@fast-crud/fast-crud";
export function useReference(form: any) {
if (!form.reference) {
return;
}
for (const reference of form.reference) {
debugger;
_.set(
form,
reference.dest,
compute<any>((scope) => {
debugger;
return _.get(scope, reference.src);
})
);
}
}

View File

@ -1,5 +1,7 @@
import { compute, CreateCrudOptionsRet, dict } from "@fast-crud/fast-crud";
import { PluginGroup } from "@certd/pipeline";
import { useReference } from "/@/use/use-refrence";
import _ from "lodash-es";
export default function (certPluginGroup: PluginGroup, formWrapperRef: any): CreateCrudOptionsRet {
const inputs: any = {};
@ -10,10 +12,11 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
inputs[inputKey].form.show = true;
continue;
}
const inputDefine = plugin.input[inputKey];
const inputDefine = _.cloneDeep(plugin.input[inputKey]);
if (!inputDefine.required && !inputDefine.maybeNeed) {
continue;
}
useReference(inputDefine);
inputs[inputKey] = {
title: inputDefine.title,
form: {

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.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
### Bug Fixes
* 修复创建流水线时无法根据dns类型默认正确的dns授权的bug ([a2c43b5](https://github.com/certd/certd/commit/a2c43b50a6069ed48958fd142844a8568c2af452))
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
### Performance Improvements

View File

@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.22.1",
"version": "1.22.2",
"description": "fast-server base midway",
"private": true,
"type": "module",
@ -21,12 +21,12 @@
"@alicloud/cs20151215": "^3.0.3",
"@alicloud/openapi-client": "^0.4.0",
"@alicloud/pop-core": "^1.7.10",
"@certd/acme-client": "^1.22.1",
"@certd/acme-client": "^1.22.2",
"@certd/lib-huawei": "^1.22.1",
"@certd/lib-k8s": "^1.22.1",
"@certd/midway-flyway-js": "^1.22.1",
"@certd/pipeline": "^1.22.1",
"@certd/plugin-cert": "^1.22.1",
"@certd/lib-k8s": "^1.22.2",
"@certd/midway-flyway-js": "^1.22.2",
"@certd/pipeline": "^1.22.2",
"@certd/plugin-cert": "^1.22.2",
"@koa/cors": "^3.4.3",
"@midwayjs/bootstrap": "^3.16.2",
"@midwayjs/cache": "^3.14.0",

View File

@ -59,7 +59,7 @@ const development = {
type: 'better-sqlite3',
database: './data/db.sqlite',
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
logging: true,
logging: false,
// 配置实体模型 或者 entities: '/entity',
entities: ['**/modules/*/entity/*.ts', '**/entity/*.js', '**/entity/*.d.ts', PipelineEntity, FlywayHistory, UserEntity],

View File

@ -8,6 +8,13 @@ const preview = {
preview: {
enabled: true,
},
typeorm: {
dataSource: {
default: {
logging: false,
},
},
},
} as MidwayConfig;
mergeConfig(preview, 'preview');

View File

@ -8,6 +8,13 @@ const production = {
preview: {
enabled: false,
},
typeorm: {
dataSource: {
default: {
logging: false,
},
},
},
} as MidwayConfig;
mergeConfig(production, 'production');

View File

@ -1,5 +1,6 @@
import fs from 'fs'
import childProcess from 'child_process';
function check(){
const gitAdd = fs.readFileSync("./node_modules/@lerna-lite/version/dist/lib/git-add.js","utf-8")
if(gitAdd.indexOf("('git', ['add', '.']") > -1){
@ -8,6 +9,14 @@ function check(){
console.error("git-add 没有修改过")
throw new Error("git-add 还没修改过")
}
//GH_TOKEN
console.log("检查 GH_TOKEN")
if(!process.env.GH_TOKEN){
// setx /M GH_TOKEN xxxxx
console.error("GH_TOKEN 未设置")
throw new Error("GH_TOKEN 未设置")
}
}
check()
check()