The Ops Community ⚙️

Cover image for Tidy Cloud AWS issue #25 - Pre-commit and Phoenix Project
Erik Lundevall Zara
Erik Lundevall Zara

Posted on • Updated on • Originally published at cloudgnosis.org

Tidy Cloud AWS issue #25 - Pre-commit and Phoenix Project

Hello all!

Welcome to the next issue of the Tidy Cloud AWS bulletin!

Currently I am on vacation, spending some time in the Canary Islands. Time of can mean some time for readfing, so I want to include a reading suggestion, and a small tip for adding local and consistent validation and checks when you
commit updates to a Git version control system.

As mentioned in the previous bulletin, this is the last issue that ise sent out on a Thursday. From the next issue it will be on Tuesdays, and the next issue will thus be sent out on July 12th.

Enjoy!


Pre-commit

If you use Git as a version control system, you have the option to add various hooks, for specific tasks in your workflow. One such hook is the pre-commit hook, which runs before you perform a local commit, and which typically can be used to perform various validation tasks. In its simplest form you can add your own custom script here, and you can set different scripts for different repositories.
However, this may become cumbersome and a lot of custom work to manage. Also, for more complex setups with multiple languages and solutions in the same repository, it can become a bit messy to maintain.

A better alternative to handle this is to use the pre-commit framework, which is a separate framwork written in Python to manage all sorts of tasks that can be performed.

You can use this framework to set up multiple types of hooks that runs validations, performs formatting updates and checks, etc. These can be run at different stages, regular commits, push, merge commits and many more.

All the different tasks you want performed you can specify through a single configuration file .pre-commit-config.yaml and you can install and invoke specific hooks through a command-line interface.

A sample configuration in the documenation include a few hooks:

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.3.0
    hooks:
    -   id: check-yaml
    -   id: end-of-file-fixer
    -   id: trailing-whitespace
-   repo: https://github.com/psf/black
    rev: 21.12b0
    hooks:
    -   id: black
Enter fullscreen mode Exit fullscreen mode

another one which I have used for simple Terraform format checks/updates is

repos:

- repo: https://github.com/antonbabenko/pre-commit-terraform

rev: v1.71.0

hooks:

- id: terraform_fmt
Enter fullscreen mode Exit fullscreen mode

There are many more hooks you can add from https://github.com/antonbabenko/pre-commit-terraform, although many of them also requires additional software to be installed.

I highly recommend to take a look at the pre-commit framework and explore what can be applied to your setup.


The Phoenix Project

If you are working with (cloud) infrastructure, operations and/or development in some shape or form, chances are that you have encountered many of the challenges with delivery on schedule, with quality and communication between different teams in the organisation.

The book The Phoenix Project is a book describes some of these challenges and how to overcome them in the form of a fictional story.

The main character of the book, Bill, reluctanly accepts the job of head of IT operations and the company Parts Unlimited, a company that manufactures automotive parts. The company has many challenges in the business and find themselves being beaten by the competition in many areas.

A flagship project in the company, The Phoenix project, is intended to fix some of these issues and catch up with the competition. In the beginning, this does not go well, not all all...

The organisation and the people there, with a bit of help, finds new ways of working and working together in the company, allowing them to be more successful.

You will probably recognize some of the personas outlined in the story, in particular in a medium- to large-size organisation.

I definitely recommend reading this book, and not just developers or operations people - perhaps even more relevant for people in management positions to read. The idea with writing it in a fictional story format is a great idea to convey the information in a format accessible to a larger audience.


You can find the contents of this bulletin and older ones, and more at Tidy Cloud AWS. You will also find other useful articles around AWS automation and infrastructure-as-software.

Until next time,

/Erik

Latest comments (0)