Personal Programming Notes

To err is human; to debug, divine.

Keep Gruntfile Clean With Load-grunt-config

In this post, we look into how to keep our Gruntfile clean and tidy. By keeping our Gruntfile clean and tidy, it is easier for us to refine and improve the Grunt build process with its numerous plugins.

DSL Implementation in Groovy

Domain-Specific Language is a mini language for a specific problem and/or in a narrow context. For example, internally used automation tools usually define some small DSL for configuration and most users understand the context and what DSL offers.

This blog post offers my simplistic view of how an internal DSL is implemented in Groovy via closure delegation. It shows the progression from standard Java-like implementation -> its fluent version -> final DSL form. This might help undrestanding the inner workings of a DSL such as Jenkins’s Pipeline steps. There are probably more advanced methods/frameworks for creating DSL. However, those are not in the scope of this post.

Github REST API Cookbook

The blog post shows some useful snippets for interacting with Github API. Jenkins pipelines regularly interacts with Github (public or Enterprise) API to perform some query/posting, for example, regarding the current pull request. For that reason, some of the following snippets are either in Groovy or curl commands embedded in Groovy-based Jenkinsfile code with some Jenkinsfile DSLs.