Merge branch 'main' into deploy-app-dev

This commit is contained in:
Madhurya Liyanage 2023-06-26 11:59:37 +05:30
commit b28ec01f78
7 changed files with 85 additions and 17 deletions

View File

@ -44,7 +44,22 @@ function run() {
git push --set-upstream origin "${git_branch}"
}
exec {lock_fd}>/var/lock/spiff-workflow-git-lock || failed_to_get_lock
lock_directory="/var/lock"
if [[ ! -d "${lock_directory}" ]]; then
lock_directory="/tmp"
fi
if ! command -v flock >/dev/null 2>&1; then
if command -v brew >/dev/null 2>&1; then
# some hero made this available on mac: https://github.com/discoteq/flock
brew install flock
else
>&2 echo "ERROR: flock is not installed and we cannot install it."
exit 1
fi
fi
exec {lock_fd}>"${lock_directory}/spiffworkflow-git-lock" || failed_to_get_lock
flock --timeout 60 "${lock_fd}" || failed_to_get_lock
run
flock -u "${lock_fd}"

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
username="${1:-}"
password="${2:-}"
if [[ -z "$password" ]]; then
password="$username"
fi
if [[ -z "${1:-}" ]]; then
>&2 echo "usage: $(basename "$0") [username] [password]"
exit 1
fi
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
if [[ -z "${REALM_NAME:-}" ]]; then
REALM_NAME=spiffworkflow
fi
access_token=$("${script_dir}/get_token" "$username" "$password" "$REALM_NAME" || echo '')
if [[ -z "$access_token" || "$access_token" == "null" ]]; then
>&2 echo "ERROR: failed to get access token for '$username'"
else
echo "access_token: ${access_token}"
curl -v -X POST "${BACKEND_BASE_URL}/v1.0/login_with_access_token?access_token=${access_token}" -H "Authorization: Bearer $access_token"
fi

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
if [[ -z "${KEYCLOAK_BASE_URL:-}" ]]; then
# export KEYCLOAK_BASE_URL=http://localhost:7002
export KEYCLOAK_BASE_URL=https://keycloak.dev.spiffworkflow.org
fi
if [[ -z "${BACKEND_BASE_URL:-}" ]]; then
# export BACKEND_BASE_URL=http://localhost:7000
export BACKEND_BASE_URL=https://api.dev.spiffworkflow.org
fi
user_list="${1}"
if [[ -z "${1:-}" ]]; then
>&2 echo "usage: $(basename "$0") [user_list]"
exit 1
fi
export REALM_NAME=${2-spiffworkflow}
while read -r input_line; do
if ! grep -qE '(^#|email)' <<<"$input_line" ; then
username=$(awk -F '@' '{print $1}' <<<"$input_line")
password=$(awk -F ',' '{print $2}' <<<"$input_line")
"${script_dir}/login_with_user" "$username" "$password"
fi
done <"$user_list"

View File

@ -120,8 +120,6 @@ class Task:
form_ui_schema: dict | None = None,
parent: str | None = None,
event_definition: dict[str, Any] | None = None,
call_activity_process_identifier: str | None = None,
calling_subprocess_task_id: str | None = None,
error_message: str | None = None,
):
self.id = id
@ -135,8 +133,6 @@ class Task:
self.lane = lane
self.parent = parent
self.event_definition = event_definition
self.call_activity_process_identifier = call_activity_process_identifier
self.calling_subprocess_task_id = calling_subprocess_task_id
self.data = data
if self.data is None:
@ -194,8 +190,6 @@ class Task:
"form_ui_schema": self.form_ui_schema,
"parent": self.parent,
"event_definition": self.event_definition,
"call_activity_process_identifier": self.call_activity_process_identifier,
"calling_subprocess_task_id": self.calling_subprocess_task_id,
"error_message": self.error_message,
}

View File

@ -1337,7 +1337,7 @@ class ProcessInstanceProcessor:
for task in tasks:
if task.task_spec.description != "Call Activity":
continue
spec_to_check = task.task_spec.spec
spec_to_check = task.task_spec.bpmn_id
if spec_to_check not in loaded_specs:
lazy_subprocess_specs = self.element_unit_specs_loader(spec_to_check, spec_to_check)

View File

@ -502,7 +502,6 @@ class ProcessInstanceService:
processor: ProcessInstanceProcessor,
spiff_task: SpiffTask,
add_docs_and_forms: bool = False,
calling_subprocess_task_id: str | None = None,
) -> Task:
task_type = spiff_task.task_spec.description
@ -529,11 +528,6 @@ class ProcessInstanceService:
except UserDoesNotHaveAccessToTaskError:
can_complete = False
if hasattr(spiff_task.task_spec, "spec"):
call_activity_process_identifier = spiff_task.task_spec.spec
else:
call_activity_process_identifier = None
parent_id = None
if spiff_task.parent:
parent_id = spiff_task.parent.id
@ -561,8 +555,6 @@ class ProcessInstanceService:
properties=props,
parent=parent_id,
event_definition=serialized_task_spec.get("event_definition"),
call_activity_process_identifier=call_activity_process_identifier,
calling_subprocess_task_id=calling_subprocess_task_id,
error_message=error_message,
)

View File

@ -73,7 +73,6 @@ export interface ProcessInstanceTask {
id: string;
task_id: string;
can_complete: boolean;
calling_subprocess_task_id: string;
created_at_in_seconds: number;
current_user_is_potential_owner: number;
data: any;