This commit is contained in:
jasquat 2023-02-16 14:38:19 -05:00
parent 8732bd25c8
commit 0e8ebc26b4
4 changed files with 20 additions and 12 deletions

View File

@ -87,8 +87,12 @@ SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get(
# or otherwise changes a process model. # or otherwise changes a process model.
# If publishing is enabled, the contents of this "staging area" / "scratch pad" / WIP spot will be used # 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. # 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_SOURCE_BRANCH = environ.get(
SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get("SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL") "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 = ( SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE = (
environ.get("SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE", default="false") == "true" environ.get("SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE", default="false") == "true"
) )

View File

@ -14,7 +14,8 @@ SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER = (
== "true" == "true"
) )
SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL", default="https://github.com/sartography/sample-process-models.git" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL",
default="https://github.com/sartography/sample-process-models.git",
) )
SPIFFWORKFLOW_BACKEND_GIT_USERNAME = "sartography-automated-committer" SPIFFWORKFLOW_BACKEND_GIT_USERNAME = "sartography-automated-committer"
SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = ( SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = (

View File

@ -34,5 +34,6 @@ SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL = (
".spiffworkflow.org" ".spiffworkflow.org"
) )
SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL", default="https://github.com/sartography/sample-process-models.git" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL",
default="https://github.com/sartography/sample-process-models.git",
) )

View File

@ -82,7 +82,9 @@ class GitService:
cls.check_for_basic_configs() cls.check_for_basic_configs()
branch_name_to_use = branch_name branch_name_to_use = branch_name
if branch_name_to_use is None: if branch_name_to_use is None:
branch_name_to_use = current_app.config["SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH"] branch_name_to_use = current_app.config[
"SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH"
]
repo_path_to_use = repo_path repo_path_to_use = repo_path
if repo_path is None: if repo_path is None:
repo_path_to_use = current_app.config[ repo_path_to_use = current_app.config[
@ -132,15 +134,15 @@ class GitService:
def check_for_publish_configs(cls) -> None: def check_for_publish_configs(cls) -> None:
"""Check_for_configs.""" """Check_for_configs."""
cls.check_for_basic_configs() cls.check_for_basic_configs()
if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH"] is None: if (
current_app.config["SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH"]
is None
):
raise MissingGitConfigsError( raise MissingGitConfigsError(
"Missing config for SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH. " "Missing config for SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH. "
"This is required for publishing process models" "This is required for publishing process models"
) )
if ( if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL"] is None:
current_app.config["SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL"]
is None
):
raise MissingGitConfigsError( raise MissingGitConfigsError(
"Missing config for SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL." "Missing config for SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL."
" This is required for publishing process models" " This is required for publishing process models"
@ -212,8 +214,8 @@ class GitService:
if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH"] is None: if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH"] is None:
raise MissingGitConfigsError( raise MissingGitConfigsError(
"Missing config for SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH. This is required" "Missing config for SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH. This is"
" for updating the repository as a result of the webhook" " required for updating the repository as a result of the webhook"
) )
ref = webhook["ref"] ref = webhook["ref"]