Dynamic GitHub Templates

Templates are useful way to bootstrap a repository, once I see a pattern in repositories, I will create a template version of the repository locally and use rysnc to copy files across to a newly created repository. This works when you’re the only one producing the repositories, but that’s almost never the case. I wanted to share my template with others. I started by creating a template repository in GitHub, this works great for a simple template that contains dotfiles and GitHub workflows.

Global pre-commit

I made a mistake when committing to repo recently I was using terraform plan -generate-config-out=generate.tf to bring some infrastructure under management of a repo. And managed to commit some secrets in the process by adding generate.tf by accident. I ended up nuking the repo because it was new enough that this was the easiest option. But this got me thinking I should use gitleaks as pre-commit hook. And I wondered if I could do this globally.

Rise of the (GitHub) Bots

As an engineer I attempt to automate as much as possible. This is normally done locally first, and then naturally migrates to a pipeline. When a pipeline makes changes to the repo the challenge is giving it the required access. Some examples of pipelines that require access to GitHub are: Commenting on PR based on the build output Labeling a PR based on the build output Keeping documentation up to date with terraform-docs Keeping versions up to date with updatecli (for when dependabot doesn’t cut it) Automatically Backporting PRs based on labels using tibdex/backport Pipeline access can be solved in three ways:

Fixing Automating Terraform with GitHub Actions

I am involved in evaluating GitHub Actions as a part of migration activity, one of the technologies that is used in our CI/CD pipeline is Terraform. Hashicorp provides a tutorial as a start for Automating Terraform with GitHub Actions. Its a good start but in my opinion it is unusable for production environments as there is no Interactive Approval of Plans and instead it uses Auto-Approval of Plans something thats discouraged in the Terraform documentation for production environments.

Joining in Jolt

I stumbled across a question on stackoverflow that was asking how to perform lookup based on ids in a JSON document. After some initial thought and trial and error (because thats the only way you can develop JOLT), I came up with a solution that is repeatable allowing you to perform multiple joins. Firstly lets look at the input and outputs: Input JSON Contains a data array and relationships array.

Docker Shell Command

After adding docker to my utility belt, I haven’t looked back. One thing i often find myself needing to do is execute a bash session against my container.