Deployments and Testing/CI/CD Tools

GitLab Template

This guide shows how to utilize Descope's GitLab CI/CD template to facilitate a smoother transition of resources from development projects to production environments.

Prerequisites

Before you begin utilizing the GitLab CI/CD template, you will need to have a few items outlined below.

  1. The Descope project IDs for both your development/sandbox and production environments. Essentially, you will need the project IDs for the project you are exporting from and the project you are importing to. These can be found on the Project settings page of the console.
  2. A management key created on the Company Settings page of the console. When scoping the management key, ensure it has access to both projects you are exporting/importing from/to.

For this guide, we'll be using the projects referenced below.

Projects used for the CI/CD template explanation within Descope docs

Using the CI/CD Template

  1. Create a new repository in GitLab.

  2. Navigate to Descope's GitLab CI/CD Template within GitHub.

  3. In order to use the template, all you need to worry about is the .gitlab-ci.yml file - copy it over to your new GitLab repository.

Configure Variables and Secrets

  1. Once the repository has been created, you need to create a GitLab Project Access Token, as shown in the GitLab guide

  2. After creating the Project Access Token, you must add the project IDs and management key to the CI/CD variables section of the GitLab repository. This can be done by clicking into the repository's settings, then going to CI/CD and expanding the Variables section:

  • GITHUB_PUSH_TOKEN - the Project Access Token created in the previous step.
  • MANAGEMENT_KEY - the Management Key created in the Company Settings page.
  • PRODUCTION_PROJECT_ID - the Project ID of the Descope project you are importing to.
  • STAGING_PROJECT_ID - the Project ID of the Descope project you are exporting from.

Configure Variables for use with the Descope CI/CD template within GitLab

Usage

  1. Click Build → Pipeline editor and select Configure pipeline.
  2. Copy the content of the .gitlab-ci.yml file from the template to the text editor and commit the change.

Descope CI/CD template within GitLab pipline editor

  1. A validate_and_deploy job will automatically run without changes. At first, the repository will be empty (Except the .gitlab-ci.yml file). We'll want to get the current state of the Descope project into the repository.

  2. Go to Build → Pipelines in your GitLab project.

  3. Select New pipeline → Select main branch → New pipeline.

GitLab pipelines overview

  1. Click the ▶️ play button next to export_and_create_mr.

GitLab pipeline run

  1. After a short while, a new Merge Request will be created.
  2. You can confirm that the added files contain your staging project's settings and configurations.
  3. Approve and merge the Merge Request to trigger an automatic deployment into your production project.

GitLab merge request

Was this helpful?

On this page