Changelog w/Azure DevOps Git

Download this Project @ GitHub


Posted on August 30, 2020


Changelog

Changelogs are end-user easy to understand reports of code devleopment for applications and automations. They are to summarize and explain why the changes were essential. It is important for developers to be held accountable for each code modification. A changelog report is a chronologically ordered list of changes made on a project. It is organized by the version with the date followed by a list of added, improved, and removed features. Changelogs can be automated from the commits to a version control repository. Commit messages are vital in that they aim to explain the reason behind the code change; noting that a paragraph was changed is not as impactful as saying that updates were made to be compliant for a new privacy law. Here are some helpful tips for writing commit messages:

  • Proof-read every message, read it out loud to yourself
  • One commit per change
  • Be clear and concise
  • Detail what the change was and why
  • State the type of the change (fix, feature, etc)
  • Have a title and body for each commit
This can be automated for SVN or Git. This example will be over using Git from Azure DevOps.


Azure DevOps

Azure DevOps is a combination of five services that aid in application planning, development, delivery, and operations.

azurePipelinesAzure Pipelines
Automatically build and test code combining continuous integration (CI) and continuous delivery (CD).

azureBoardAzure Boards
Manage work tracking with Kanban boards, backlogs, team dashboards, and custom reporting.

azureArtifactAzure Artifacts
Maven, npm, and NuGet package feeds from public and private sources.

azureReposAzure Repos
Cloud-hosted private Git repos for versioning project development.

azurePipelinesAzure Test Plans
Browser-based test management solution provides for planned manual testing, user acceptance testing, exploratory testing, and gathering feedback from stakeholders.

Microsoft offers .NET client libraries to easily connect and pull data from a Team Foundation Server. The Team Foundation server hosts the Git repositories used in Azure Repos. A user can be tied to multiple Organizations, and each of those could house multiple repositories. The linked Github repo for this article gives the logic and code to iterate down through an Organization and read the data of each file changed for each commit.

Using the secrets post from before, right click on the project name in the Solution Explorer and click on Manage User Secrets.

manageSecret

secrets4azure

The image above shows the JSON structure needed for the newly created secrets.json file. The name of the Organization is stored as a secret. Another secret stores the Personal Access Token; that hyperlink will guide you through creating your own. Make sure to copy it once it is created or you will need to delete that token and create a new one.

copyPAT

The console application grabs each Project for the speicfied Organization and searches if it has a commit within the last seven days. The author and general stats are printed for each commit along with each file change type and file name. The commit comments are printed and with all this a Changelog could be automated.

I expanded on this project for my work by tracking the commits in the database and building out the Changelog for each deployment to Production. This makes it very quick and easy to record changes for a code repository for reporting.


ASCII Art

To add a little fun to a console application, the code gives examples for changing the font color of the terminal/command prompt but also prints out ascii art. The hyperlink above leads to a file upload that will reproduce the image using only ascii. ASCII is a 7-bit character set containing 128 characters. It contains the numbers from 0-9, the upper and lower case English letters from A to Z, and some special characters. The character sets used in modern computers, in HTML, and on the Internet, are all based on ASCII.

An ascii art class houses the array of the strings from the output and is called to print out each line within the array. These little printouts can be a fun harmless way to sign off on your code and likely surprise someone reviewing it.