Skip to content

Commit

Permalink
enhancement(#4909): Changing launchers structure
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed Feb 7, 2024
1 parent f6bb99b commit d0338b5
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 32 deletions.
4 changes: 2 additions & 2 deletions deployability/Jenkinsfiles/Launcher.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

String jenkins_reference = params.getOrDefault('JENKINS_REFERENCE', 'enhancement/4751-dtt1-iteration-2-poc')
String launcher_path = "launchers"
String task_flow_launcher = "provision.py"
String launcher_path = "modules/provision"
String task_flow_launcher = "main.py"
String workflow = "modules/workflow_engine/examples/dtt1-managers.yaml"
String schema = "modules/workflow_engine/schema.json"

Expand Down
4 changes: 2 additions & 2 deletions deployability/Jenkinsfiles/Provision.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


String provision_path = "${WORKSPACE}/scripts/provision"
String provision_script = "provision.py"
String provision_path = "${WORKSPACE}/modules/provision"
String provision_script = "main.py"
String inventory = "inventory.yaml"
String jenkins_reference = params.getOrDefault('JENKINS_REFERENCE', 'enhancement/4665-dtt1-poc')

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import sys

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(project_root)

from modules.allocation import Allocator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# ---------------- Vars ------------------------

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(project_root)

from modules.provision import Provision, models
Expand Down
28 changes: 11 additions & 17 deletions deployability/deps/setup.py → deployability/modules/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,27 @@ def get_version():
return version

scripts_list = [
'models=workflow.models:main',
'schema_validator=workflow.schema_validator:main',
'task=workflow.task:main',
'utils=workflow.utils:main',
'workflow_processor=workflow.workflow_processor:main',
'launch_allocation = launchers.allocation:main',
'launch_provision = launchers.provision:main',
'launch_test = launchers.test:main',
'launch_workflow_engine = launchers.workflow_engine:main',
'models=workflow_engine.models:main',
'schema_validator=workflow_engine.schema_validator:main',
'task=workflow_engine.task:main',
'utils=workflow_engine.utils:main',
'workflow_processor=workflow_engine.workflow_processor:main',
'main=workflow_engine.main:main'
]

package_data_list = get_files_from_directory("../modules/workflow_engine")
launchers_data_list = get_files_from_directory("../launchers")
package_data_list = get_files_from_directory("workflow_engine")

setup(
name='workflow',
name='workflow_engine',
version=get_version(),
description='Wazuh testing utilities to help programmers automate deployment tests',
url='https://github.com/wazuh',
author='Wazuh',
author_email='[email protected]',
license='GPLv2',
packages=['workflow_engine', 'launchers'],
package_dir={'workflow_engine': '../modules/workflow_engine',
'launchers': '../launchers'},
package_data={'workflow_engine': package_data_list,
'launchers': launchers_data_list},
packages=['workflow_engine'],
package_dir={'workflow_engine': 'workflow_engine'},
package_data={'workflow_engine': package_data_list},
entry_points={'console_scripts': scripts_list},
include_package_data=True,
zip_safe=False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
import os

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(project_root)

from modules.testing import Tester, InputPayload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import logging
import colorlog

project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
sys.path.append(project_root)

from workflow.workflow_processor import WorkflowProcessor
from workflow.models import InputPayload
from workflow_engine.workflow_processor import WorkflowProcessor
from workflow_engine.models import InputPayload


def parse_arguments() -> argparse.Namespace:
Expand Down
2 changes: 1 addition & 1 deletion deployability/modules/workflow_engine/schema_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from jsonschema.exceptions import ValidationError
from pathlib import Path
from ruamel.yaml import YAML
from workflow.utils import logger
from workflow_engine.utils import logger

class SchemaValidator:
"""
Expand Down
2 changes: 1 addition & 1 deletion deployability/modules/workflow_engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import time

from abc import ABC, abstractmethod
from workflow.utils import logger
from workflow_engine.utils import logger


class Task(ABC):
Expand Down
6 changes: 3 additions & 3 deletions deployability/modules/workflow_engine/workflow_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from pathlib import Path
from itertools import product

from workflow.schema_validator import SchemaValidator
from workflow.task import *
from workflow.utils import logger
from workflow_engine.schema_validator import SchemaValidator
from workflow_engine.task import *
from workflow_engine.utils import logger



Expand Down

0 comments on commit d0338b5

Please sign in to comment.