Gestalt Gitlab Integrations - Lambdas

Repository - https://github.com/GalacticFog/gitlab-ci-integrations

Overview

This example Gestalt Platform / Gitlab integration provides automatic deployments of Lambdas from Gitlab as part of the CI build process. On build, Gitlab CI invokes Gestalt via REST API to create Lambda resources with exposed API endpoints in a target environment. Optionally, Gestalt Platform may be configured to call back to Gitlab with the published endpoint for the deployed lambdas.

Requirements

  • GitLab, Gestalt Platform, and Amazon S3 with network connectivity between each.

How to Use

In order to use this example, clone or access the https://github.com/GalacticFog/gitlab-ci-integrations repository to gain access to the deployment artifacts.

1) Configure Deployment Lambda

1) Create a Nashorn Lambda using the code from Example Gitlab Deploy Lambda

2) Configure the required environment variables as described in the README

3) Create an API endpoint for the lambda, and save the resulting URL for the Gitlab configuration step.

2) Create Target Gestalt Environment for Deployment from Gitlab project

1) In Gestalt, create or use an existing target environment (typically of type 'development') in the desired Org / Workspace. Note the UUID of the Environment by navigating to the environment and expanding the details view - this is used in a later configuration step.

2) In the target environment, create an API (or use an existing API) and note the name for a later configuration step.

3) Configure Gitlab Project

From the desired Gitlab Project:

1) Copy .ci-lambda-deploy.sh, .ci-functions.sh, and .gitlab-ci.yaml to your Gitlab project. If the project doesn't already have lambdas, you may copy lambda1.py and lambda2.py to the project as examples.

2) Configure the required environment variables as described in the README

4) Perform a test build

Pushing a commit to the Git Repository should result in the CI/CD process defined by .gitlab-ci.yml to be executed. To view the process, navigate to Gitlab > CI/CD > Pipelines and view the latest pipeline and deploy output.

View the Pipeline:

Pipeline Running

View the deployment job details:

Job Details

Once the pipeline completes, note that the merge request contains a review/<branch> environment with an external link to the lambda.

Pipeline Completed

Once the deploy stage of the pipeline completes successfully, navigate to Gestalt to view the deployed lambda(s).

Lambdas Created