mirror of
https://github.com/harness/drone.git
synced 2025-05-21 11:29:52 +08:00
Merge branch 'default-to-V0' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#497)
This commit is contained in:
commit
4923af907f
@ -31,7 +31,7 @@ import { getErrorMessage } from 'utils/Utils'
|
||||
import { decodeGitContent } from 'utils/GitUtils'
|
||||
import pipelineSchemaV1 from './schema/pipeline-schema-v1.json'
|
||||
import pipelineSchemaV0 from './schema/pipeline-schema-v0.json'
|
||||
import { DRONE_CONFIG_YAML_FILE_SUFFIXES, YamlVersion } from './Constants'
|
||||
import { V1_SCHEMA_YAML_FILE_REGEX, YamlVersion } from './Constants'
|
||||
|
||||
import css from './AddUpdatePipeline.module.scss'
|
||||
|
||||
@ -145,9 +145,9 @@ const AddUpdatePipeline = (): JSX.Element => {
|
||||
// set YAML version for Pipeline setup
|
||||
useEffect(() => {
|
||||
setYAMLVersion(
|
||||
DRONE_CONFIG_YAML_FILE_SUFFIXES.find((suffix: string) => pipelineData?.config_path?.endsWith(suffix))
|
||||
? YamlVersion.V0
|
||||
: YamlVersion.V1
|
||||
pipelineData?.config_path && V1_SCHEMA_YAML_FILE_REGEX.test(pipelineData.config_path)
|
||||
? YamlVersion.V1
|
||||
: YamlVersion.V0
|
||||
)
|
||||
}, [pipelineData])
|
||||
|
||||
|
@ -7,3 +7,5 @@ export const DEFAULT_YAML_PATH_PREFIX = '.harness/'
|
||||
export const DEFAULT_YAML_PATH_SUFFIX = '.yaml'
|
||||
|
||||
export const DRONE_CONFIG_YAML_FILE_SUFFIXES = ['.drone.yml', '.drone.yaml']
|
||||
|
||||
export const V1_SCHEMA_YAML_FILE_REGEX = /^(.*v1\.ya?ml)$/i
|
||||
|
Loading…
Reference in New Issue
Block a user