diff --git a/data/model/build.py b/data/model/build.py index e67eaffe5..346d9ebef 100644 --- a/data/model/build.py +++ b/data/model/build.py @@ -9,7 +9,6 @@ from data.database import (BuildTriggerService, RepositoryBuildTrigger, Reposito RepositoryBuild, BUILD_PHASE, db_for_update, db_random_func) from data.model import (InvalidBuildTriggerException, InvalidRepositoryBuildException, db_transaction, user as user_model) -from data.model.helpers.build_helper import _get_config_expand PRESUMED_DEAD_BUILD_AGE = timedelta(days=15) PHASES_NOT_ALLOWED_TO_CANCEL_FROM = (BUILD_PHASE.PUSHING, BUILD_PHASE.COMPLETE, @@ -19,7 +18,7 @@ ARCHIVABLE_BUILD_PHASES = [BUILD_PHASE.COMPLETE, BUILD_PHASE.ERROR, BUILD_PHASE. def update_build_trigger(trigger, config, auth_token=None, write_token=None): - trigger.config = json.dumps(_get_config_expand(config or {})) + trigger.config = json.dumps(config or {}) if auth_token is not None: trigger.auth_token = auth_token @@ -30,13 +29,12 @@ def update_build_trigger(trigger, config, auth_token=None, write_token=None): def create_build_trigger(repo, service_name, auth_token, user, pull_robot=None, config=None): - config = config or {} service = BuildTriggerService.get(name=service_name) trigger = RepositoryBuildTrigger.create(repository=repo, service=service, auth_token=auth_token, connected_user=user, pull_robot=pull_robot, - config=json.dumps(_get_config_expand(config))) + config=json.dumps(config or {})) return trigger diff --git a/data/model/helpers/__init__.py b/data/model/helpers/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/data/model/helpers/build_helper.py b/data/model/helpers/build_helper.py deleted file mode 100644 index 1f5da8296..000000000 --- a/data/model/helpers/build_helper.py +++ /dev/null @@ -1,9 +0,0 @@ - -def _get_config_expand(config): - """ Get config with both context and dockerfile_path written to it """ - if not config: - return {} - if 'context' in config: - config['subdir'] = config['context'] - - return config diff --git a/data/model/helpers/test/test_build_helper.py b/data/model/helpers/test/test_build_helper.py deleted file mode 100644 index 25686faff..000000000 --- a/data/model/helpers/test/test_build_helper.py +++ /dev/null @@ -1,14 +0,0 @@ -import pytest - -from data.model.helpers.build_helper import _get_config_expand - - -@pytest.mark.parametrize('org_config,expected', [ - (None, {}), - ({}, {}), - ({'some other key': 'some other value'}, {'some other key': 'some other value'}), - ({'context': 'some/context', 'dockerfile_path': 'some/context/with/Dockerfile'}, - {'context': 'some/context', 'dockerfile_path': 'some/context/with/Dockerfile', 'subdir': 'some/context'}), -]) -def test_super_user_build_endpoints(org_config, expected): - assert _get_config_expand(org_config) == expected