Skip to main content

GitLab

GitLab is a service that allows you to run automated workflows in response to events that are triggered in a repository. You can use GitLab to automate tasks such as building, testing, and deploying your code.

This guide will show you how to use GitLab to create and test on your Corellium devices.

Prerequisites

To use GitLab with Corellium, you will need:

  • A Corellium account
  • A code repository
  • A Corellium API token
  • A GitLab account connected to the repository

Create a Corellium API token

To use GitLab with Corellium, you will need to create a Corellium API token, which you can do in our Web UI.

Create a repository

To use GitLab with Corellium, you will need to create a repository in the code repository service of your choice. For example, GitLab, GitHub, Bitbucket, etc.

Add your environment variables

To use GitLab with Corellium, you will need to add your Corellium API token and Project ID to your GitLab environment variables.

To do this, go to your repository's settings in GitLab and add the following environment variables:

  • CORELLIUM_API_TOKEN: Your Corellium API token
  • CORELLIUM_PROJECT: Your Corellium project ID

When setting your environment variables, make sure they're accessible by the branch you're using. For example, if you're using a protected branch, you'll need to add the environment variables to the protected branch.

Create a GitLab workflow

To use GitLab with Corellium, you will need to create a GitLab workflow. You can do this by creating a file called .gitlab-ci.yml in your repository.

The following example workflow will run the following steps every push:

  1. Create a device (an iPhone 6 running iOS 12.5.6)
  2. Show the installed apps
  3. List the device's files
  4. Stop the device
  5. Delete the device

Let's go!

default:
tags:
- nodejs
image: node:16

variables:
CORELLIUM_API_TOKEN: $CORELLIUM_API_TOKEN
CORELLIUM_PROJECT: $CORELLIUM_PROJECT

before_script:
- npm install -g @corellium/corellium-cli

create_device:
stage: test
script:
# Login to Corellium
- corellium login --apitoken $CORELLIUM_API_TOKEN --endpoint https://app.corellium.com

# Create device
# The `true` argument will wait for the device to be ready before continuing, which is useful for CI.
# We'll store the device ID in an environment variable so we can use it later.
- id=$(corellium instance create iphone6 12.5.6 $CORELLIUM_PROJECT true)

# List apps
# This may take a few minutes to finish as the device restores.
- corellium agent apps --project $CORELLIUM_PROJECT --instance $id

# List files
- corellium agent files --project $CORELLIUM_PROJECT --instance $id

# Stop device
# The `true` argument will wait for the device to be fully stopped before continuing, which is useful for CI.
- corellium instance stop $id true

# Delete device
- corellium instance delete $id