use _GIT_SOURCE_BRANCH instead of _GIT_BRANCH

This commit is contained in:
burnettk 2023-02-16 14:10:31 -05:00
parent 18917e627a
commit 5b89d0cf31
4 changed files with 15 additions and 11 deletions

View File

@ -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"

View File

@ -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",

View File

@ -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"

View File

@ -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