Travis almost a de facto standard for running unit tests for open source projects and private repositories. Since the rise of Docker infrastructure, more and more things being bundled with Docker and Docker images.

Quay.io have been around for a while and it is used by people for automatic Docker images building and deploying.

For recent project I had written a small Shell script to wait for Quay build for specific repository and branch (can be used not only in Travis):

Only curl and jq is the requirements for this script. The three required arguments is the following:

./wait_for_quay.sh -r ${REPOSITORY} -b${BRANCH} -d ${DELAY} Where REPOSITORY is the Quay organization and project in the form: org/project. BRANCH is the branch for pull request, due to some limitation, you may want to use ${BRANCH//\//_}, this will replace the slash to underscore, which Quay does internally for branch names.

The jq is used for nice JSON parsing and extraction.

.[] parses the input JSON, with the following map matching the entries which have branch in tags.

For the result, only started and phase is needed, with sorting and getting last available phase value the result will be what we need to wait for Quay.

As the result, the Travis build will wait for Quay to finish with the following output:

$./wait_for_quay.sh -r${REPOSITORY} -b \${BRANCH//\//_} -d 30
Quay build status: building
Quay build status: building
Quay build status: building
Quay build status: building
Quay build status: building
Quay build status: building
Quay build status: building
Quay build status: building
Quay build status: building
Quay build status: building
Quay build status: pushing
Quay build status: complete

And then continue pulling the Docker images and running unit tests.