mirror of https://github.com/certd/certd
				
				
				
			refactor: 去掉可选链
							parent
							
								
									8b0ca1da2e
								
							
						
					
					
						commit
						fbde35483b
					
				| 
						 | 
				
			
			@ -80,7 +80,7 @@ export class Executor {
 | 
			
		|||
    logger.info('----------------------')
 | 
			
		||||
    if (!cert.isNew) {
 | 
			
		||||
      // 如果没有更新
 | 
			
		||||
      if (!options.args?.forceDeploy && !options.args?.forceRedeploy) {
 | 
			
		||||
      if (!options.args.forceDeploy && !options.args.forceRedeploy) {
 | 
			
		||||
        // 且不需要强制运行deploy
 | 
			
		||||
        logger.info('证书无更新,无需重新部署')
 | 
			
		||||
        logger.info('任务完成')
 | 
			
		||||
| 
						 | 
				
			
			@ -178,7 +178,7 @@ export class Executor {
 | 
			
		|||
    }
 | 
			
		||||
    const taskTrace = trace.getInstance({ type: 'deploy', deployName, taskName })
 | 
			
		||||
    const traceStatus = taskTrace.get({})
 | 
			
		||||
    if (traceStatus?.status === 'success' && !options?.args?.forceRedeploy) {
 | 
			
		||||
    if (traceStatus && traceStatus.status === 'success' && !options.args.forceRedeploy) {
 | 
			
		||||
      logger.info(`----【${taskName}】已经执行完成,跳过此任务`)
 | 
			
		||||
      taskTrace.set({ value: { current: 'skip', status: 'success', remark: '已执行成功过,本次跳过' } })
 | 
			
		||||
      return
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ export class K8sClient {
 | 
			
		|||
   * @returns secretsList
 | 
			
		||||
   */
 | 
			
		||||
  async getSecret (opts) {
 | 
			
		||||
    const namespace = opts?.namespace || 'default'
 | 
			
		||||
    const namespace = opts.namespace || 'default'
 | 
			
		||||
    const secrets = await this.client.api.v1.namespaces(namespace).secrets.get()
 | 
			
		||||
    return secrets
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ export class K8sClient {
 | 
			
		|||
   * @returns {Promise<*>}
 | 
			
		||||
   */
 | 
			
		||||
  async createSecret (opts) {
 | 
			
		||||
    const namespace = opts?.namespace || 'default'
 | 
			
		||||
    const namespace = opts.namespace || 'default'
 | 
			
		||||
    const created = await this.client.api.v1.namespaces(namespace).secrets.post({
 | 
			
		||||
      body: opts.body
 | 
			
		||||
    })
 | 
			
		||||
| 
						 | 
				
			
			@ -66,8 +66,8 @@ export class K8sClient {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  async updateSecret (opts) {
 | 
			
		||||
    const namespace = opts?.namespace || 'default'
 | 
			
		||||
    const secretName = opts?.secretName
 | 
			
		||||
    const namespace = opts.namespace || 'default'
 | 
			
		||||
    const secretName = opts.secretName
 | 
			
		||||
    if (secretName == null) {
 | 
			
		||||
      throw new Error('secretName 不能为空')
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -77,8 +77,8 @@ export class K8sClient {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  async patchSecret (opts) {
 | 
			
		||||
    const namespace = opts?.namespace || 'default'
 | 
			
		||||
    const secretName = opts?.secretName
 | 
			
		||||
    const namespace = opts.namespace || 'default'
 | 
			
		||||
    const secretName = opts.secretName
 | 
			
		||||
    if (secretName == null) {
 | 
			
		||||
      throw new Error('secretName 不能为空')
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -88,8 +88,8 @@ export class K8sClient {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  async getIngress (opts) {
 | 
			
		||||
    const namespace = opts?.namespace || 'default'
 | 
			
		||||
    const ingressName = opts?.ingressName
 | 
			
		||||
    const namespace = opts.namespace || 'default'
 | 
			
		||||
    const ingressName = opts.ingressName
 | 
			
		||||
    if (!ingressName) {
 | 
			
		||||
      throw new Error('ingressName 不能为空')
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -97,8 +97,8 @@ export class K8sClient {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  async patchIngress (opts) {
 | 
			
		||||
    const namespace = opts?.namespace || 'default'
 | 
			
		||||
    const ingressName = opts?.ingressName
 | 
			
		||||
    const namespace = opts.namespace || 'default'
 | 
			
		||||
    const ingressName = opts.ingressName
 | 
			
		||||
    if (!ingressName) {
 | 
			
		||||
      throw new Error('ingressName 不能为空')
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ export class DnspodDnsProvider extends AbstractDnsProvider {
 | 
			
		|||
    _.merge(config, options)
 | 
			
		||||
 | 
			
		||||
    const ret = await request(config)
 | 
			
		||||
    if (ret?.status?.code !== '1') {
 | 
			
		||||
    if (!ret || !ret.status || ret.status.code !== '1') {
 | 
			
		||||
      throw new Error('请求失败:' + ret.status.message + ',api=' + config.url)
 | 
			
		||||
    }
 | 
			
		||||
    return ret
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue