Skip to content

Commit

Permalink
Enforce version 2 of manifests (#12775)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Aug 19, 2022
1 parent a414e70 commit 2d86725
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 471 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ...constants import get_root
from ...datastructures import JSONDict
from ...manifest_validator import get_all_validators
from ...manifest_validator.constants import V1_STRING
from ...manifest_validator.constants import V1_STRING, V2_STRING
from ...testing import process_checks_option
from ...utils import complete_valid_checks
from ..console import (
Expand Down Expand Up @@ -70,7 +70,11 @@ def manifest(ctx, check, fix):
annotate_error(manifest_file, f"Invalid json: {e}")
continue

version = decoded.get('manifest_version', V1_STRING)
version = decoded.get('manifest_version', V2_STRING)
if version == V1_STRING:
file_failures += 1
display_queue.append((echo_failure, 'Manifest version must be >= 2.0.0'))

all_validators = get_all_validators(ctx, version, is_extras, is_marketplace)

for validator in all_validators:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

from packaging.version import parse

from .constants import V2
from .v1.validator import get_v1_validators
from .v2.validator import get_v2_validators


def get_all_validators(ctx, version_string, is_extras=False, is_marketplace=False):
if parse(version_string) < V2:
return get_v1_validators(is_extras, is_marketplace)
else:
# e.g. parse(version) >= V2:
return get_v2_validators(ctx, is_extras, is_marketplace)
return get_v2_validators(ctx, is_extras, is_marketplace)

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2d86725

Please sign in to comment.