Posted by & filed under CI, Deployments, DevOps, Web development.

It’s always wise to keep a non-git-log changelog in your code repository. A changelog provides a way to explain what changes were made in a more verbose and reader-friendly way than a terse commit log. Even more valuable is providing this information to your team.

While anyone can certainly look at your repository and view the recent additions to the changelog, if you’ve already integrated Slack into your workflow, it’s incredibly simple to leverage that same communication channel to broadcast the latest updates to your changelog.

Where ever your code deployments occur (we use CircleCI) a simple script that reads the top of your changelog and publishes that to a Slack channel can be really valuable.

While there are some Linux utilities that can do similar things, we use a short Python script that prints out the lines from the start of a file until it reaches a double newline:

#!/usr/bin/env python

import sys

line_list = []

for line in sys.stdin.xreadlines():
    if line == '\n':
        print ''.join(line_list),
        exit()

    line_list.append('{}\n'.format(line.strip()))

 

We send the output of this to our Slack channel at deployment time (a simple HTT POST to our webhook URL), alerting everyone in the channel to the updates.

 

Leave a Reply

Your email address will not be published. Required fields are marked *