Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/_context/_scenarios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from .appsec_low_waf_timeout import AppsecLowWafTimeout
from .ai_guard import AIGuardScenario
from .integration_frameworks import IntegrationFrameworksScenario
from utils._context.ports import ContainerPorts
from utils._context.constants import ContainerPorts
from utils._context._scenarios.appsec_rasp import AppSecLambdaRaspScenario, AppsecRaspScenario
from utils._context.containers import (
CassandraContainer,
Expand Down
6 changes: 6 additions & 0 deletions utils/_context/_scenarios/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def __call__(self, test_object): # noqa: ANN001 (tes_object can be a class or a


class _ScenarioGroups:
"""Group scenario into coherents buckets. It's used in two usages :

1. decorate test classes if ever they should be applied to more than one scenario
2. select a set of scenario to execute in the official system-tests workflow
"""

all = ScenarioGroup()
ai_guard = ScenarioGroup()
appsec = ScenarioGroup()
Expand Down
21 changes: 21 additions & 0 deletions utils/_context/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from enum import StrEnum, IntEnum


class WeblogBuildMode(StrEnum):
"""Describe how a weblog should be built"""

none = "none"
""" The weblog does not require any build step"""

local = "local"
""" The weblog has a fully baked base image, so the build step is extra light,
and does not requires a full job in the CI"""

prebuild = "prebuild"
""" The weblog will be built in a dedicated job in the CI """


class ContainerPorts(IntEnum):
"""Host ports used by tested containers"""

vcr_cassettes = 8300
2 changes: 1 addition & 1 deletion utils/_context/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from utils._context.component_version import ComponentVersion, Version
from utils._context.docker import get_docker_client
from utils._context._image_mirror import mirror_image
from utils._context.ports import ContainerPorts
from utils._context.constants import ContainerPorts
from utils.proxy.tuf import get_tuf_root_json
from utils.proxy.ports import ProxyPorts
from utils.proxy.mocked_response import (
Expand Down
7 changes: 0 additions & 7 deletions utils/_context/ports.py

This file was deleted.

19 changes: 4 additions & 15 deletions utils/_context/weblog_metadata.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
from enum import StrEnum
from dataclasses import dataclass, replace
from pathlib import Path
import yaml


class BuildMode(StrEnum):
none = "none"
""" The weblog does not require any build step"""

local = "local"
""" The weblog has a fully baked base image, so the build step is extra light,
and does not requires a full job in the CI"""

prebuild = "prebuild"
""" The weblog will be built in a dedicated job in the CI """
from .constants import WeblogBuildMode


@dataclass
class WeblogMetaData:
name: str
library: str
build_mode: BuildMode = BuildMode.prebuild
build_mode: WeblogBuildMode = WeblogBuildMode.prebuild
framework_versions: list[str] | None = None
artifact_name: str = ""
""" not declared in the yml file, but populated later """

def __post_init__(self):
self.build_mode = BuildMode(self.build_mode)
self.build_mode = WeblogBuildMode(self.build_mode)

@property
def require_build(self) -> bool:
"""The run_end_to_end job builds the weblog locally (weblog_build_required)."""
return self.build_mode != BuildMode.none
return self.build_mode != WeblogBuildMode.none

@property
def base_dockerfile(self) -> Path | None:
Expand Down
3 changes: 2 additions & 1 deletion utils/scripts/ci_orchestrators/workflow_data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from collections import defaultdict
import json
from utils._context._scenarios import Scenario
from utils._context.weblog_metadata import WeblogMetaData as Weblog, BuildMode
from utils._context.weblog_metadata import WeblogMetaData as Weblog
from utils._context.constants import WeblogBuildMode as BuildMode


def _load_json(file_path: str) -> dict:
Expand Down
Loading