This set up is for automatically building your LANSA application when changes are checked into GitLab.

Automatically building your application should be a controlled act on a specific machine that is solely used for build and deployment. Applying this to a developer's environment will mean that their environment will change whenever another developer checks a change in. This may make it very unstable.

A GitLab Runner is used to connect GitLab to the Development System. This means that it is not required for the Development System to be opened up to the Internet.

This works for all types of LANSA technologies.

Presumed Knowledge

First some set up is required. It requires manual configuration. As such you require some skills in using Git, GitLab, and the Windows command line to configure it correctly. If you are an existing GitLab user it should not be difficult for you to do this successfully.

Overview

Its presumed that you are already using a Visual LANSA IDE configured as a VCS Master for all your developers and you have setup a build machine in a similar fashion. So all that needs to be done is to install and configure a GitLab runner.

Summary of Steps

Here is a summary of the steps involved. Click on the links for more detail:

Install the GitLab Runner

Now you need to download and configure the GitLab Runner.

Here is the official documentation. Follow all the steps in the Installation section of:

Install GitLab Runner on Windows including the link - 4. Register the Runner.

When registering the runner, use this command line:
.\gitlab-runner.exe register --non-interactive --url "https://gitlab.com" --registration-token "<your project token" --executor "shell" --shell "powershell" --tag-list "master" --run-untagged

When installing the gitlab-runner, you may find it easiest to specify the user that's logged in when the Visual LANSA IDE is running so that that user's git security is used.

Configure GitLab Runner Server Settings

Now, if you go to your repository on GitLab, access "Settings > CI/CD" and expand the "Runners settings" you are able to see your runner already assigned to your project. If the green circle is not showing its probably because you haven't started the Runner on the Target System.



Beside the Specific Runners section, click on Disable shared Runners.



and then expand "Settings > CI/CD"  Environment Variables and setup these variables:

GIT_STRATEGY = none ensures that the Runner does not perform any git operations itself. It leaves it up to the jobs to do that task. LANSA requires the git operations to be performed in its own directory structure with web sites, etc, correctly configured

LANSA_VCS_PATH is the directory where the source code git repository is located.

LANSA_ROOT_PATH is the directory where the Visual LANSA configuration which contains the git repository is installed.

LANSA_PARTITION is the partition identifier.

Configure the GitLab Runner's repository

This step provides the configuration file for the GitLab Runner. It is automatically performed when the Git repository is created through the Visual LANSA IDE. Only perform this step if the Git repository was created from the Windows command line or using a third party tool.

On a developer's machine, copy the file <VLRootDirectory>\lansa \Tools\gitlab-ci.yml to the root directory of the git source code repository. The git source code repository will be located in <VLRootDirectory>\lansa\VersionControl or in one of its subdirectories.

Commit this change to the repository and push it to GitLab.

  • No labels