This is an AMP version of the article, its original content can be found here.

How AppVeyor Helps Me to Validate Pull Requests Before Rultor Merges Them

AppVeyor is a great cloud continuous integration service that builds Windows projects. Rultor is a DevOps assistant, which automates release, merge and deploy operations, using Docker containers. These posts explain how Rultor works and what it's for:, a Merging Bot and Master Branch Must Be Read-Only.

The problem is that Rultor is running all scripts inside Docker containers and Docker can't build Windows projects. The only and the best logical solution is to trigger AppVeyor before running all other scripts in Docker. If AppVeyor gives a green light, we continue with our usual in-Docker script. Otherwise, we fail the entire build. Below I explain how this automation was configured in Takes framework.

First, I got a token from my AppVeyor account (at the time of writing it was here). I created a text file curl-appveyor.cfg with this content (it's not my real token inside, just an example):

Then, I encrypted this file, using rultor command line tool:

The file I created was called curl-appveyor.cfg.asc. I committed and pushed into yegor256/takes GitHub repository.

Then, I configured AppVeyor "pinging" from Docker script. This is what I did in .rultor.yml:

There is no magic here, it's very simple. First, I start a new build using /api/builds end-point of AppVeyor REST API. ${pull_id} is an environment variable that is coming from Rultor, it contains an integer number of current pull request.

I'm using jq in order to parse AppVeyor JSON output.

Once the build is started, I'm getting its unique version and start looping to check its status. I'm waiting for success or failed. Anything else will mean that the build is still in progress and I should keep looping.

You can see how it works in this pull request, for example: yegor256/takes#93.