Tirggerbuild

Automatically Trigger your own Build Process with our Standards Releases

Trigger a Build Process
with our Standards Releases

Posted on: January 8, 2021 | Last Updated: January 19, 2021


Forget manually searching for and downloading the new standards with every release.

Our release notification emails, newsletters and web pages inform our community when our new releases have been published. What if you want to eliminate the inconsistencies and errors that can arise because of this human intervention?

LIXI provides an easy way to automate a process that polls for changes and downloads all the latest LIXI2 Standards. This is perfect for triggering your own build process to automate more of your software delivery, deployment and testing regime.

Access Schemas in LIXILab Directly

Access to all our released schemas in LIXILab is available to all employees of LIXI Member Organisations by filling out this form. Once activated, you can log in to LIXILab and create an Access Token which you can then use for authorisation with Git and the Gitlab API (LIXILab is our private Gitlab Repository).

You will need to create a local directory, and use the git clone command to copy the LIXI2 schema project locally.

git clone https://standards.lixi.org.au/lixi2/schemas.git


Poll for Release Updates

The easiest way to automate this is to use the GitLab API to retrieve the latest tag on the master branch (the branch we merge the schemas into after release) of the LIXI2 Schemas Project and examine the datetime of creation.

The following example in Python demonstrates how to call the API to retrieve this data - you'll just need to update the code with your own Access Token.

import requests, json
url = "https://standards.lixi.org.au/api/v4/projects/294/repository/commits?ref=master"
response = requests.request("GET", url, headers={'PRIVATE-TOKEN': 'your_access_token'}, data={})

latest_commit_created_at = json.loads(response.text)[0]['created_at']


Using the polling step in the section above you can determine if you need to copy the latest schemas to use or if you need to trigger a build process to use the latest release. You can compare the datetime of the commit with the datetime of the latest commit when you last ran the process, and by comparing determine if you need to fetch the latest released schemas. To fetch, simply use the git pull and git clone commands to refresh your repository with the latest files. The following example shows how to do this in Python using the python-gitlab library - you'll just need to set the directory_location.

import git
g = git.Git("directory_location")
g.pull('origin','master')
g.checkout("master")  


What Next?

This is just the very first step in your automation journey - this is just the trigger for your own build process that incorporates the latest LIXI data standards. For example, you might automatically validate a library of sample message for regression testing purposes. Stay tuned for other posts that cover all aspects of automation.

Related Blogs


Written by:
Shane Rigby, LIXI Limited CEO
First Published: January 8, 2021 | Last Updated: January 19, 2021