2021-01-14 15:04:47 +00:00
|
|
|
|
import _ from 'lodash-es'
|
2020-12-25 17:37:53 +00:00
|
|
|
|
import optionsPrivate from './options.private.js'
|
2020-12-15 16:35:05 +00:00
|
|
|
|
const defaultOptions = {
|
2020-12-20 16:32:17 +00:00
|
|
|
|
args: {
|
|
|
|
|
forceCert: false, // 强制更新证书
|
|
|
|
|
skipCert: false, // 是否跳过证书申请环节
|
2021-01-08 08:59:53 +00:00
|
|
|
|
forceDeploy: true,
|
2021-01-14 15:04:47 +00:00
|
|
|
|
test: false
|
2020-12-20 16:32:17 +00:00
|
|
|
|
},
|
2020-12-18 17:57:52 +00:00
|
|
|
|
accessProviders: {
|
2020-12-15 16:35:05 +00:00
|
|
|
|
aliyun: {
|
|
|
|
|
providerType: 'aliyun',
|
|
|
|
|
accessKeyId: '',
|
|
|
|
|
accessKeySecret: ''
|
|
|
|
|
},
|
2020-12-25 17:37:53 +00:00
|
|
|
|
dnspod: {
|
|
|
|
|
providerType: 'dnspod',
|
|
|
|
|
id: '',
|
|
|
|
|
token: ''
|
|
|
|
|
},
|
|
|
|
|
tencent: {
|
|
|
|
|
providerType: 'tencent',
|
|
|
|
|
secretId: '',
|
|
|
|
|
secretKey: ''
|
|
|
|
|
},
|
2020-12-15 16:35:05 +00:00
|
|
|
|
myLinux: {
|
|
|
|
|
providerType: 'SSH',
|
|
|
|
|
username: 'xxx',
|
|
|
|
|
password: 'xxx',
|
|
|
|
|
host: '1111.com',
|
|
|
|
|
port: 22,
|
|
|
|
|
publicKey: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cert: {
|
2020-12-20 16:32:17 +00:00
|
|
|
|
domains: ['*.docmirror.cn'],
|
2020-12-15 16:35:05 +00:00
|
|
|
|
email: 'xiaojunnuo@qq.com',
|
2020-12-25 17:37:53 +00:00
|
|
|
|
dnsProvider: 'aliyun',
|
2020-12-15 16:35:05 +00:00
|
|
|
|
csrInfo: {
|
|
|
|
|
country: 'CN',
|
|
|
|
|
state: 'GuangDong',
|
|
|
|
|
locality: 'ShengZhen',
|
|
|
|
|
organization: 'CertD Org.',
|
|
|
|
|
organizationUnit: 'IT Department',
|
|
|
|
|
emailAddress: 'xiaojunnuo@qq.com'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
deploy: [
|
|
|
|
|
{
|
2021-01-01 18:47:58 +00:00
|
|
|
|
deployName: '流程1-部署到阿里云系列产品',
|
2021-02-04 03:17:54 +00:00
|
|
|
|
disabled: false,
|
2020-12-15 16:35:05 +00:00
|
|
|
|
tasks: [
|
|
|
|
|
{
|
2021-01-01 18:47:58 +00:00
|
|
|
|
taskName: '上传证书到云',
|
2020-12-18 17:57:52 +00:00
|
|
|
|
type: 'uploadCertToAliyun',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
props:{
|
|
|
|
|
accessProvider: 'aliyun'
|
|
|
|
|
}
|
2020-12-15 16:35:05 +00:00
|
|
|
|
},
|
2020-12-18 17:57:52 +00:00
|
|
|
|
{ // CDN、SCDN、DCDN和负载均衡(SLB)
|
2021-01-01 18:47:58 +00:00
|
|
|
|
taskName: '部署证书到CDN',
|
2020-12-20 16:32:17 +00:00
|
|
|
|
type: 'deployCertToAliyunCDN',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
props:{
|
|
|
|
|
domainName: 'certd-cdn-upload.docmirror.cn',
|
|
|
|
|
certName: 'certd部署测试(upload)',
|
|
|
|
|
certType: 'upload',
|
|
|
|
|
accessProvider: 'aliyun'
|
|
|
|
|
}
|
2020-12-15 16:35:05 +00:00
|
|
|
|
}
|
2020-12-20 16:32:17 +00:00
|
|
|
|
// {
|
|
|
|
|
// name: '部署证书到阿里云集群Ingress',
|
|
|
|
|
// type: 'deployCertToAliyunK8sIngress',
|
|
|
|
|
// accessProvider: 'aliyun'
|
|
|
|
|
// }
|
2020-12-15 16:35:05 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-01-01 18:47:58 +00:00
|
|
|
|
deployName: '流程2-部署到nginx服务器',
|
2020-12-20 16:32:17 +00:00
|
|
|
|
disabled: true,
|
2020-12-15 16:35:05 +00:00
|
|
|
|
tasks: [
|
|
|
|
|
{
|
2021-01-01 18:47:58 +00:00
|
|
|
|
taskName: '上传证书到服务器,并重启nginx',
|
2020-12-18 17:57:52 +00:00
|
|
|
|
type: 'sshAndExecute',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
props:{
|
|
|
|
|
accessProvider: 'myLinux',
|
|
|
|
|
upload: [
|
|
|
|
|
{ from: '{certPath}', to: '/xxx/xxx/xxx.cert.pem' },
|
|
|
|
|
{ from: '{keyPath}', to: '/xxx/xxx/xxx.key' }
|
|
|
|
|
],
|
|
|
|
|
script: 'sudo systemctl restart nginx'
|
|
|
|
|
}
|
2020-12-15 16:35:05 +00:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
deployName: '流程3-触发jenkins任务',
|
2021-02-04 03:17:54 +00:00
|
|
|
|
disabled: false,
|
2020-12-15 16:35:05 +00:00
|
|
|
|
tasks: [
|
|
|
|
|
{
|
2021-01-01 18:47:58 +00:00
|
|
|
|
taskName: '触发jenkins任务',
|
2020-12-18 17:57:52 +00:00
|
|
|
|
type: 'sshAndExecute',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
props:{
|
|
|
|
|
accessProvider: 'myLinux',
|
|
|
|
|
script: 'sudo systemctl restart nginx'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
deployName: '流程4-部署到腾讯云ingress',
|
2021-02-04 03:17:54 +00:00
|
|
|
|
disabled: true,
|
2021-01-01 18:47:58 +00:00
|
|
|
|
tasks: [
|
|
|
|
|
{
|
|
|
|
|
taskName: '上传到腾讯云',
|
|
|
|
|
type: 'uploadCertToTencent',
|
|
|
|
|
props:{
|
|
|
|
|
accessProvider: 'tencent-yonsz'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
taskName: '部署到TKE-ingress',
|
|
|
|
|
type: 'deployCertToTencentTKEIngress',
|
|
|
|
|
props:{
|
|
|
|
|
clusterId:'cls-6lbj1vee',
|
|
|
|
|
ingressName:'ingress-base',
|
|
|
|
|
secretName:'certd-base-yonsz-net-hnuzjrzf',
|
|
|
|
|
accessProvider: 'tencent-yonsz'
|
|
|
|
|
}
|
2020-12-15 16:35:05 +00:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_.merge(defaultOptions, optionsPrivate)
|
|
|
|
|
|
2020-12-25 17:37:53 +00:00
|
|
|
|
export function createOptions(){
|
|
|
|
|
return _.cloneDeep(defaultOptions)
|
|
|
|
|
}
|