Overview

This short guide will show you how to trigger image Builds in Beach through an HTTP request. The example given will be based on Gitlab, but most other continuous integration solutions will work more or less the same.

The Details

A build can be triggered through the Beach API by calling a specific URL which contains the identifier of the instance you want to run a build for, and a secret access token. You can call that URL either by sending an HTTP GET or a POST request.

The URL you need to call looks like this:

https://beach.flownative.com/api/v1/instances/{instance identifier}/checkfornewcommits?token={access token}

In order to find the instance identifier of your instance, log to the Beach user interface and navigate to the instance you want to trigger builds for. The URL of that page will look something like the following:

https://beach.flownative.com/organizations/…/projects/…/instances/abc1234-4567-1234-abcd-1234567890ab

The last part of the URL – in this case "abc1234-4567-1234-abcd-1234567890ab" – is your instance identifier.

In order to find the access token, navigate to your organization details page (that's where you can upload a logo of your organization and also find your deployment key). If there is no access token displayed yet, klick the button to generate one.

Finally insert the instance identifier and the access token into the URL. You can test the trigger by just calling the URL in your browser. If there's a new commit in your Git repository, Beach will start building an image for this code.

An example: Gitlab

In Gitlab navigate to the Settings > Integrations menu of the Git repository used in your Beach instance. You will set up a new webhook which will trigger the build in Beach.

Enter the full URL of the API call, including the instance identifier and the access token.

As for the "trigger", select the "Push events" option.

Add this webhook and test if it can trigger a build in Beach.