update configs for publish feature

This commit is contained in:
burnettk 2023-02-16 13:47:26 -05:00
parent 76a701e9dd
commit 5918501083
9 changed files with 20 additions and 20 deletions

View File

@ -80,11 +80,11 @@ SPIFFWORKFLOW_BACKEND_LOG_LEVEL = environ.get(
# When a user clicks on the `Publish` button, this is the default branch this server merges into. # When a user clicks on the `Publish` button, this is the default branch this server merges into.
# I.e., dev server could have `staging` here. Staging server might have `production` here. # I.e., dev server could have `staging` here. Staging server might have `production` here.
SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH"
) )
SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get("SPIFFWORKFLOW_BACKEND_GIT_BRANCH") SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get("SPIFFWORKFLOW_BACKEND_GIT_BRANCH")
SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING = environ.get("GIT_CLONE_URL") SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get("GIT_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

@ -1,8 +1,8 @@
"""Dev.""" """Dev."""
from os import environ from os import environ
SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO", default="staging" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH", default="staging"
) )
SPIFFWORKFLOW_BACKEND_GIT_USERNAME = environ.get( SPIFFWORKFLOW_BACKEND_GIT_USERNAME = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_USERNAME", default="sartography-automated-committer" "SPIFFWORKFLOW_BACKEND_GIT_USERNAME", default="sartography-automated-committer"

View File

@ -13,7 +13,7 @@ SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER = (
environ.get("SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER", default="false") environ.get("SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER", default="false")
== "true" == "true"
) )
SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get(
"GIT_CLONE_URL", default="https://github.com/sartography/sample-process-models.git" "GIT_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"

View File

@ -1,8 +1,8 @@
"""Qa1.""" """Qa1."""
from os import environ from os import environ
SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO", default="qa2" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH", default="qa2"
) )
SPIFFWORKFLOW_BACKEND_GIT_USERNAME = environ.get( SPIFFWORKFLOW_BACKEND_GIT_USERNAME = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_USERNAME", default="sartography-automated-committer" "SPIFFWORKFLOW_BACKEND_GIT_USERNAME", default="sartography-automated-committer"

View File

@ -9,7 +9,7 @@ SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL = (
SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get( SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH", default="main" "SPIFFWORKFLOW_BACKEND_GIT_BRANCH", default="main"
) )
SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get(
"GIT_CLONE_URL", "GIT_CLONE_URL",
default="https://github.com/sartography/sartography-process-models.git", default="https://github.com/sartography/sartography-process-models.git",
) )

View File

@ -4,8 +4,8 @@ from os import environ
SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get( SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH", default="staging" "SPIFFWORKFLOW_BACKEND_GIT_BRANCH", default="staging"
) )
SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO", default="main" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH", default="main"
) )
SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE = False SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE = False
SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = "staging.yml" SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = "staging.yml"

View File

@ -33,6 +33,6 @@ SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL = (
f"https://connector-proxy.{environment_identifier_for_this_config_file_only}" f"https://connector-proxy.{environment_identifier_for_this_config_file_only}"
".spiffworkflow.org" ".spiffworkflow.org"
) )
SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get(
"GIT_CLONE_URL", default="https://github.com/sartography/sample-process-models.git" "GIT_CLONE_URL", default="https://github.com/sartography/sample-process-models.git"
) )

View File

@ -226,11 +226,11 @@ def process_model_publish(
"""Process_model_publish.""" """Process_model_publish."""
if branch_to_update is None: if branch_to_update is None:
branch_to_update = current_app.config[ branch_to_update = current_app.config[
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH"
] ]
if branch_to_update is None: if branch_to_update is None:
raise MissingGitConfigsError( raise MissingGitConfigsError(
"Missing config for SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO. " "Missing config for SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH. "
"This is required for publishing process models" "This is required for publishing process models"
) )
process_model_identifier = _un_modify_modified_process_model_id( process_model_identifier = _un_modify_modified_process_model_id(

View File

@ -132,17 +132,17 @@ 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_BRANCH_TO_PUBLISH_TO"] is None: if current_app.config["SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_TARGET_BRANCH"] is None:
raise MissingGitConfigsError( raise MissingGitConfigsError(
"Missing config for SPIFFWORKFLOW_BACKEND_GIT_BRANCH_TO_PUBLISH_TO. " "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_CLONE_URL_FOR_PUBLISHING"] current_app.config["SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL"]
is None is None
): ):
raise MissingGitConfigsError( raise MissingGitConfigsError(
"Missing config for SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING." "Missing config for SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL."
" This is required for publishing process models" " This is required for publishing process models"
) )
@ -198,7 +198,7 @@ class GitService:
clone_url = webhook["repository"]["clone_url"] clone_url = webhook["repository"]["clone_url"]
if ( if (
clone_url clone_url
!= current_app.config["SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING"] != current_app.config["SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL"]
): ):
raise GitCloneUrlMismatchError( raise GitCloneUrlMismatchError(
"Configured clone url does not match clone url from webhook:" "Configured clone url does not match clone url from webhook:"
@ -243,7 +243,7 @@ class GitService:
destination_process_root = f"/tmp/{clone_dir}" # noqa destination_process_root = f"/tmp/{clone_dir}" # noqa
git_clone_url = current_app.config[ git_clone_url = current_app.config[
"SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL"
] ]
if git_clone_url.startswith("https://"): if git_clone_url.startswith("https://"):
git_clone_url = git_clone_url.replace( git_clone_url = git_clone_url.replace(