refactor: ```

This commit is contained in:
xiaojunnuo
2020-12-19 01:57:52 +08:00
parent 06603759fd
commit df9f561fd3
22 changed files with 276 additions and 103 deletions
+13
View File
@@ -0,0 +1,13 @@
import pkg from 'chai'
import options from './options.js'
import Deployer from '../src/index.js'
const { expect } = pkg
describe('AutoDeploy', function () {
it('#run', async function () {
const deploy = new Deployer()
const ret = deploy.run(options)
expect(ret).ok
expect(ret.cert).ok
expect(ret.AliyunCertId).ok
})
})
+9 -9
View File
@@ -1,7 +1,7 @@
import _ from 'lodash'
import optionsPrivate from './options.private.js'
import optionsPrivate from '../../../test/options.private.js'
const defaultOptions = {
providers: {
accessProviders: {
aliyun: {
providerType: 'aliyun',
accessKeyId: '',
@@ -17,7 +17,7 @@ const defaultOptions = {
}
},
cert: {
domains: ['*.docmirror.club', 'docmirror.club'],
domains: ['*.docmirror.club', 'docmirror.xyz'],
email: 'xiaojunnuo@qq.com',
challenge: {
challengeType: 'dns',
@@ -38,17 +38,17 @@ const defaultOptions = {
tasks: [
{
name: '上传证书到云',
taskType: 'uploadCertToCloud',
type: 'uploadCertToAliyun',
certStore: 'aliyun'
},
{
{ // CDN、SCDN、DCDN和负载均衡(SLB
name: '部署证书到SLB',
taskType: 'deployCertToAliyunSLB',
type: 'deployCertToAliyunSLB',
certStore: 'aliyun'
},
{
name: '部署证书到阿里云集群Ingress',
taskType: 'deployCertToAliyunK8sIngress',
type: 'deployCertToAliyunK8sIngress',
certStore: 'aliyun'
}
]
@@ -58,7 +58,7 @@ const defaultOptions = {
tasks: [
{
name: '上传证书到服务器,并重启nginx',
taskType: 'sshAndExecute',
type: 'sshAndExecute',
ssh: 'myLinux',
upload: [
{ from: '{certPath}', to: '/xxx/xxx/xxx.cert.pem' },
@@ -73,7 +73,7 @@ const defaultOptions = {
tasks: [
{
name: '触发jenkins任务',
taskType: 'sshAndExecute',
type: 'sshAndExecute',
ssh: 'myLinux',
script: 'sudo systemctl restart nginx'
}