Skip to content

dmartinol/escalation-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple escalation workflow

An escalation workflow integrated with Atlassian JIRA using SonataFlow.

Email service is using MailTrap Send email API API

Prerequisite

Escalation flow

Create a new JIRA ticket ->

Watch Jira ticket status (Wait for 'done' status) ->

    if approved before timeout ->
        Create the namespace in configured Red Hat Openshift Cluster

    if timeout has reached ->
        Send email to provided email address

Note: The value of the .jiraIssue.fields.status.statusCategory.key field is the one to be used to identify when the done status is reached, all the other similar fields are subject to translation to the configured language and cannot be used for a consistent check.

Hardcoded settings

Some settings are hardcoded in ticketEscalation.sw.yaml, see below details.

Jira project name is hardcoded in:

states:
  - name: CreateJiraIssue
...
              project:
                key: "TEST"
...

Polling periodicity and escalation timeout are hardcoded in:

states:
...
  - name: GetJiraIssue
...
        sleep:
          before: PT6S
...
  - name: TicketDone
    type: switch
    dataConditions:
      - condition: (.jiraIssue.fields.status.statusCategory.key == "done")
        transition:
          nextState: CreateK8sNamespace
      - condition: (.jiraIssue.fields.status.statusCategory.key != "done" and .timer.triggered == false and .timer.elapsedSeconds > 60)
        transition:
          nextState: Escalate
...

The sender email and inbox ID are hardcoded in:

states:
...
  - name: Escalate
...
      - name: "sendEmail"
...
          arguments:
            inbox_id: 2403453
...
            from:
              email: escalation@gmail.com

How to run

Application properties can be initialized from environment variables before running the application:

export JIRA_URL=_YOUR_JIRA_URL_
export JIRA_USERNAME=_YOUR_JIRA_USERNAME_
export JIRA_PASSWORD=_YOUR_JIRA_TOKEN_

export MAILTRAPIO_TOKEN=_YOUR_MAINTRAPIO_API_TOKEN_

export OCP_API_SERVER_URL=_YOUR_OPENSHIFT_API_SERVER_URL_
export OCP_API_SERVER_TOKEN=_YOUR_OPENSHIFT_API_TOKEN_
mvn clean quarkus:dev

Example of POST to trigger the flow (see input schema in ocp-onboarding-schema.json):

curl -XPOST -H "Content-Type: application/json" http://localhost:8080/ticket-escalation -d '{"namespace": "_YOUR_NAMESPACE_", "manager": "_YOUR_EMAIL_"}'

Tips:

  • Visit Workflow Instances
  • Visit (Data Index Query Service)[http://localhost:8080/q/graphql-ui/]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors