コード例 #1
0
  private int callQaService() throws IOException {
    String localIp = NetworkInterfaceManager.INSTANCE.getLocalHostAddress();
    String qaServiceUrlPrefix = task.getQaServiceUrlPrefix();
    DomainHealthCheckInfo deployInfo =
        new DomainHealthCheckInfo(
            task.getDomain(),
            config.getEnv(),
            localIp,
            config.getContainerPort(),
            qaServiceUrlPrefix);

    int exitCode = DeployStep.CODE_OK;
    if (!StringUtils.isEmpty(StringUtils.trimAll(qaServiceUrlPrefix))) {
      logger.info(
          String.format(
              "qa service url is given, checking domain status via %s", qaServiceUrlPrefix));

      CheckResult checkResult = CheckResult.FAIL;
      try {
        checkResult =
            qaService.isDomainHealthy(
                deployInfo, config.getQaServiceTimeout(), config.getQaServiceQueryInterval());
      } catch (RuntimeException e) {
        checkResult = CheckResult.AGENT_LOCAL_EXCEPTION;
        logger.error("agent local exception when calling qa service", e);
      }

      exitCode = qaCheckResultToExitCode(checkResult);
    } else {
      logger.info("qa service url is not given, skip checking domain status");
    }
    return exitCode;
  }