, 38 tweets, 14 min read
My Authors
Read all threads
Ok, time for some relax coding time :)

I'm going to continue the automation of creating SOW documents from Jira (see for more details)

First step is to make sure all code is checked in
actually the previous thread starts on this tweet:
At the moment the functionality (i.e. lambdas) can be triggered via our @SlackHQ bot:
The bot (via webhooks) calls this python method (running in a lambda)
which use the 'simple.html' file
that looks like this
but since @SlackHQ doesn't have a good way to provide JSON data (and eventually what we want is to use slack to provide an Jira ID), the next step is to create a separate Lambda function that receives the JSON payload ( at the moment hard coded in the the Sow_Views.default)
@SlackHQ To put this thread in context here is the current scenario

"@GlasswallGlobal is doing a project for one of our clients which required a number of improvements to our engine. As part of this project an SOW (Statement of Work) document was created which defines the outcomes"
This SOW requires the creation of a big (large and very unmaintainable) document which everybody usually hates (since it is really hard to: use, comment, maintain, update, diff, distribute, scale, etc..)

So our approach was to convert the SOW document into a Graph using @Jira
This is similar to the approach I took in the past in using Jira to manage security policies

Let's look at an example to see what it looks like

Here (pic) is one of the items from the SOW
The two links from the SOW Item above (i.e. it's children) point to the measurable requirements (i.e. the Key Result that we need to deliver and that is measurable)

for example :
In order to be able to assess the work done, the client as asked us to (for each item in the SOW) fill in all relevant details about that SOW line Item into this word template
Which brings us back full circle to where this thread started: the programatically creation of this template (using a serverless workflow)
now back to coding

For reference here is what my Dev UI looks like

- Code at the top left
- Test at the bottom left
- Browser at the right

When I run a test, the result is executed on the browser on the right
The code you can see on the screenshot above comes from these two repos (and branches)

github.com/filetrust/GW-B…

and

github.com/filetrust/OSBo…
Next step is to publish the Lambda Function which I've documented in this separate thread
(that tweet thread is quite long, since it explain in details how to run a local webserver in an lambda function and take a screenshot using chrome headless)
Here is the refactored code (from the version used by the bot) now running on a dedicated lambda function

this means that we can now just invoke the lambda function with the issue_data values passed as params
That UI (the SOW) is created (at the moment) from the html file 'simple.html'
Which means that if we change that file (see extra <h1> element in the example below) and update the lambda function, we will get the screenshot of the new version
Of course that when experimenting with UI changes it is much better, easier and faster to run it locally

note the reload=True in line 11 of the lambda file (that is needed to force reload of the page in the local browser, something is that is note needed when running in lambda)
Now that we have a Lambda function that is able to create the test results UI from a JSON what we need is able to get the data from Jira from another Lambda function

The setup of that Lambda function is documented on this Twitter thread
Now that we have the ability to load data from Jira programatically (in our lambda functions), we can get the data from the SOW Jira issue (in this case SOW-121) just by invoking that function
What we want to do next is to create the python/json object used by the sow view (rendered via chrome headless) using data from Jira
The power of having a lambda function that does one thing very well, is that it becomes really easy (and fast) to consume
Next we start to look at which fields should be used to populate the SOW template (note: we will add a number of fields later to this @jira issue type so that we get a 1 to 1 mapping between the data in the Jira issue and the data show in the SOW template)
next step is to refactor the code from the test to the lambda function

(I've added the Issues Links to the Setup field to help a little bit with the navigation)
Here is the diff of the recent changes to the sow lambda function
As before, if it runs ok locally it should also run ok in a lambda function

note: that now we see the result via the screenshot
Just to confirm that all is working as expected, I've just made a change to the HTML template file and (after publishing the lambda function) the screenshot shows the changes
Next we are going to wire this up to the @SlackHQ bot

At the moment here is what it looks like
By adding a new method to the 'SOW_Views' class we get a new method in @SlackHQ
which (after the test_update_lambda executes) is now available as a Slack command
Here is the view command that:
- retrieves an issue ID from the @SlackHQ params
- calls the lambda function with an issue_id (receiving back an string with png_data)
- if there is NOT an channel value just returns the png_data (to allow testing)
- else send png to slack as image
This means that we can now use Slack as a CLI to access the SOW data from JIRA, using the command

browser sow view SOW-121
and when we make a change in an Jira field

(See description below)
that data will be seen immediately in the Slack UI
What is VERY powerful with this workflow is that it creates a REPL:

1) view the status of a SOW result in Slack
2) make a change in Jira
3) see the changes shown in Slack
4) goto 2)

And this this will be even better when the JIra fields are auto-populated from tests executions
Missing some Tweet in this thread? You can try to force a refresh.

Enjoying this thread?

Keep Current with Dinis Cruz

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!