Merge remote-tracking branch 'origin/main' into feature/support_local_openid_in_cypress_tests

This commit is contained in:
jasquat 2023-02-16 14:25:51 -05:00
commit f5a5059ce0
9 changed files with 38 additions and 34 deletions

View File

@ -80,11 +80,15 @@ 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") # This is the branch that the app automatically commits to every time the user clicks the save button
SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING = environ.get("GIT_CLONE_URL") # 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 = ( 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,8 +13,8 @@ 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" "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

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

@ -6,10 +6,10 @@ SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL = (
f"https://keycloak.{environment_identifier_for_this_config_file_only}" f"https://keycloak.{environment_identifier_for_this_config_file_only}"
".spiffworkflow.org/realms/sartography" ".spiffworkflow.org/realms/sartography"
) )
SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get( SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH", default="main" "SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH", default="main"
) )
SPIFFWORKFLOW_BACKEND_GIT_CLONE_URL_FOR_PUBLISHING = environ.get( SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL = environ.get(
"GIT_CLONE_URL", "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_CLONE_URL",
default="https://github.com/sartography/sartography-process-models.git", default="https://github.com/sartography/sartography-process-models.git",
) )

View File

@ -1,11 +1,11 @@
"""Staging.""" """Staging."""
from os import environ from os import environ
SPIFFWORKFLOW_BACKEND_GIT_BRANCH = environ.get( SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH = environ.get(
"SPIFFWORKFLOW_BACKEND_GIT_BRANCH", default="staging" "SPIFFWORKFLOW_BACKEND_GIT_SOURCE_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" "SPIFFWORKFLOW_BACKEND_GIT_PUBLISH_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

@ -82,7 +82,7 @@ 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_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[
@ -122,9 +122,9 @@ class GitService:
@classmethod @classmethod
def check_for_basic_configs(cls) -> None: def check_for_basic_configs(cls) -> None:
"""Check_for_basic_configs.""" """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( raise MissingGitConfigsError(
"Missing config for SPIFFWORKFLOW_BACKEND_GIT_BRANCH. " "Missing config for SPIFFWORKFLOW_BACKEND_GIT_SOURCE_BRANCH. "
"This is required for publishing process models" "This is required for publishing process models"
) )
@ -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:"
@ -210,14 +210,14 @@ class GitService:
f"Could not find the 'ref' arg in the webhook boy: {webhook}" 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( 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" " for updating the repository as a result of the webhook"
) )
ref = webhook["ref"] 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}": if ref != f"refs/heads/{git_branch}":
return False return False
@ -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(