All files / modules/85-cv/components/PipelineSteps/ContinousVerification constants.ts

100% Statements 19/19
100% Branches 6/6
100% Functions 3/3
100% Lines 19/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104                9x 9x     9x 9x 9x 9x 9x     9x 9x 9x 9x     9x 9x 9x     9x             9x           9x           9x   9x                                                                                                        
/*
 * Copyright 2021 Harness Inc. All rights reserved.
 * Use of this source code is governed by the PolyForm Shield 1.0.0 license
 * that can be found in the licenses directory at the root of this repository, also available at
 * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt.
 */
 
import type { SelectOption } from '@wings-software/uicore'
import { ErrorType, Strategy } from '@pipeline/utils/FailureStrategyUtils'
import { StepType } from '@pipeline/components/PipelineSteps/PipelineStepInterface'
import type { ContinousVerificationData } from './types'
 
export enum JobTypes {
  BLUE_GREEN = 'Bluegreen',
  TEST = 'Test',
  HEALTH = 'Health',
  CANARY = 'Canary'
}
 
export enum SensitivityTypes {
  HIGH = 'HIGH',
  MEDIUM = 'MEDIUM',
  LOW = 'LOW'
}
 
export enum IdentifierTypes {
  serviceIdentifier = '<+service.identifier>',
  envIdentifier = '<+env.identifier>'
}
 
export const durationOptions: SelectOption[] = [
  { label: '5 min', value: '5m' },
  { label: '10 min', value: '10m' },
  { label: '15 min', value: '15m' },
  { label: '30 min', value: '30m' }
]
 
export const trafficSplitPercentageOptions: SelectOption[] = [
  { label: '5%', value: 5 },
  { label: '10%', value: 10 },
  { label: '15%', value: 15 }
]
 
export const VerificationSensitivityOptions: SelectOption[] = [
  { label: 'High', value: 'HIGH' },
  { label: 'Medium', value: 'MEDIUM' },
  { label: 'Low', value: 'LOW' }
]
 
export const baseLineOptions: SelectOption[] = [{ label: 'Last Successful job run', value: 'LAST' }]
 
export const cvDefaultValues: ContinousVerificationData = {
  name: '',
  type: StepType.Verify,
  identifier: '',
  timeout: '2h',
  spec: {
    monitoredServiceRef: '',
    type: '',
    healthSources: [],
    spec: {
      sensitivity: '',
      duration: '',
      baseline: '',
      trafficsplit: '',
      deploymentTag: ''
    }
  },
  failureStrategies: [
    {
      onFailure: {
        errors: [ErrorType.Verification],
        action: {
          type: Strategy.ManualIntervention,
          spec: {
            timeout: '2h',
            onTimeout: {
              action: {
                type: Strategy.StageRollback
              }
            }
          }
        }
      }
    },
    {
      onFailure: {
        errors: [ErrorType.Unknown],
        action: {
          type: Strategy.ManualIntervention,
          spec: {
            timeout: '2h',
            onTimeout: {
              action: {
                type: Strategy.Ignore
              }
            }
          }
        }
      }
    }
  ]
}