Skip to content
Snippets Groups Projects
Select Git revision
  • 369cd81d14235ebdf873224f5a43250f4c4df983
  • main default protected
  • release-0.15
  • automated-updates-main
  • release-0.13
  • automated-updates-release-0.13
  • release-0.14
  • release-0.10
  • release-0.11
  • release-0.12
  • fix-versions-action
  • versions-fix
  • release-0.9
  • release-0.8
  • release-0.7
  • release-0.6
  • release-0.5
  • release-0.4
  • release-0.3
  • release-0.1
  • release-0.2
  • v0.15.0
  • v0.14.0
  • v0.13.0
  • v0.12.0
  • v0.11.0
  • v0.10.0
  • v0.9.0
  • v0.8.0
  • v0.7.0
  • v0.6.0
  • v0.5.0
  • v0.4.0
  • v0.3.0
  • v0.2.0
  • v0.1.0
36 results

monitoring-external-etcd.md

Blame
  • result.ts 1.85 KiB
    import type { RenovateConfig } from '../../config/types';
    import {
      CONFIG_SECRETS_EXPOSED,
      CONFIG_VALIDATION,
      REPOSITORY_ACCESS_FORBIDDEN,
      REPOSITORY_ARCHIVED,
      REPOSITORY_BLOCKED,
      REPOSITORY_CLOSED_ONBOARDING,
      REPOSITORY_DISABLED,
      REPOSITORY_DISABLED_BY_CONFIG,
      REPOSITORY_EMPTY,
      REPOSITORY_FORKED,
      REPOSITORY_MIRRORED,
      REPOSITORY_NOT_FOUND,
      REPOSITORY_NO_CONFIG,
      REPOSITORY_NO_PACKAGE_FILES,
      REPOSITORY_RENAMED,
      REPOSITORY_UNINITIATED,
    } from '../../constants/error-messages';
    import { logger } from '../../logger';
    
    type ProcessStatus = 'disabled' | 'enabled' | 'onboarding' | 'unknown';
    export interface ProcessResult {
      res: string;
      status: ProcessStatus;
      enabled: boolean;
      onboarded: boolean;
    }
    
    export function processResult(
      config: RenovateConfig,
      res: string
    ): ProcessResult {
      const disabledStatuses = [
        REPOSITORY_ACCESS_FORBIDDEN,
        REPOSITORY_ARCHIVED,
        REPOSITORY_BLOCKED,
        REPOSITORY_CLOSED_ONBOARDING,
        REPOSITORY_DISABLED,
        REPOSITORY_DISABLED_BY_CONFIG,
        REPOSITORY_EMPTY,
        REPOSITORY_FORKED,
        REPOSITORY_MIRRORED,
        REPOSITORY_NOT_FOUND,
        REPOSITORY_NO_CONFIG,
        REPOSITORY_NO_PACKAGE_FILES,
        REPOSITORY_RENAMED,
        REPOSITORY_UNINITIATED,
      ];
      const enabledStatuses = [CONFIG_SECRETS_EXPOSED, CONFIG_VALIDATION];
      let status: ProcessStatus;
      let enabled: boolean;
      let onboarded: boolean;
      // istanbul ignore next
      if (disabledStatuses.includes(res)) {
        status = 'disabled';
        enabled = false;
      } else if (enabledStatuses.includes(res) || config.repoIsOnboarded) {
        status = 'enabled';
        enabled = true;
        onboarded = true;
      } else if (config.repoIsOnboarded === false) {
        status = 'onboarding';
        enabled = true;
        onboarded = false;
      } else {
        logger.debug({ res }, 'Unknown res');
        status = 'unknown';
      }
      return { res, status, enabled, onboarded };
    }