From 9f3bb283b3a13924395bce0a11337624a1ad0be8 Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 16 Feb 2023 14:10:31 -0500 Subject: [PATCH] use _GIT_SOURCE_BRANCH instead of _GIT_BRANCH --- .../src/spiffworkflow_backend/config/default.py | 6 +++++- .../src/spiffworkflow_backend/config/sartography.py | 4 ++-- .../src/spiffworkflow_backend/config/staging.py | 4 ++-- .../spiffworkflow_backend/services/git_service.py | 12 ++++++------ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py index 92c40d0ae..e7b42c1ab 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py @@ -83,7 +83,11 @@ SPIFFWORKFLOW_BACKEND_LOG_LEVEL = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get( "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH" ) -SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get("SPIFFWORKFLOW_BACKEND_GIT_BRANCH") +# This is the branch that the app automatically commits to every time the user clicks the save button +# or otherwise changes a process model. +# If publishing is enabled, the contents of this "staging area" / "scratch pad" / WIP spot will be used +# as the relevant contents for process model that the user wants to publish. +SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH = environ.get("SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH") SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get("SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL") SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE = ( environ.get("SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE", default="false") == "true" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/sartography.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/sartography.py index 71bdb399e..083684742 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/sartography.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/sartography.py @@ -6,8 +6,8 @@ SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL = ( f"https://keycloak.{environment_identifier_for_this_config_file_only}" ".spiffworkflow.org/realms/sartography" ) -SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_BRANCH", default="main" +SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH = environ.get( + "SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH", default="main" ) SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get( "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL", diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/staging.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/staging.py index bfb613ec1..edfe36d79 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/staging.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/staging.py @@ -1,8 +1,8 @@ """Staging.""" from os import environ -SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get( - "SPIFFWORKFLOW_BACKEND_GIT_BRANCH", default="staging" +SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH = environ.get( + "SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH", default="staging" ) SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get( "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH", default="main" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py index 45f905782..93390c60e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py @@ -82,7 +82,7 @@ class GitService: cls.check_for_basic_configs() branch_name_to_use = branch_name if branch_name_to_use is None: - branch_name_to_use = current_app.config["SPIFFWORKFLOW_BACKEND_GIT_BRANCH"] + branch_name_to_use = current_app.config["SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH"] repo_path_to_use = repo_path if repo_path is None: repo_path_to_use = current_app.config[ @@ -122,9 +122,9 @@ class GitService: @classmethod def check_for_basic_configs(cls) -> None: """Check_for_basic_configs.""" - if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_BRANCH"] is None: + if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH"] is None: raise MissingGitConfigsError( - "Missing config for SPIFFWORKFLOW_BACKEND_GIT_BRANCH. " + "Missing config for SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH. " "This is required for publishing process models" ) @@ -210,14 +210,14 @@ class GitService: f"Could not find the 'ref' arg in the webhook boy: {webhook}" ) - if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_BRANCH"] is None: + if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH"] is None: raise MissingGitConfigsError( - "Missing config for SPIFFWORKFLOW_BACKEND_GIT_BRANCH. This is required" + "Missing config for SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH. This is required" " for updating the repository as a result of the webhook" ) ref = webhook["ref"] - git_branch = current_app.config["SPIFFWORKFLOW_BACKEND_GIT_BRANCH"] + git_branch = current_app.config["SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH"] if ref != f"refs/heads/{git_branch}": return False