Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Managed Service for GitLab
  • Getting started
    • All tutorials
    • Deploying GitLab Runner on a Yandex Compute Cloud VM
    • Secure storage of GitLab CI passwords as Yandex Lockbox secrets
    • Continuous deployment of containerized Managed Service for Kubernetes applications
    • Scanning Container Registry for vulnerabilities during continuous deployment of Managed Service for Kubernetes applications
    • Building a CI/CD pipeline with serverless products
    • Storing Docker images in Yandex Container Registry
    • App testing with GitLab
    • Creating test VMs via GitLab CI
    • Integration with Yandex Tracker
    • Invoking load testing from GitLab CI
    • Integration with Argo CD
  • Access management
  • Pricing policy
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • Get your cloud ready
  • Required paid resources
  • Create a GitLab VM
  • Configure GitLab
  • Set privacy settings
  • Create a project
  • Set up and run testing for the project
  • Configure and register a Runner
  • Create a test scenario
  • Create an error in the project
  • How to delete the resources you created
  1. Tutorials
  2. App testing with GitLab

Testing applications with GitLab

Written by
Yandex Cloud
Updated at May 7, 2025
  • Get your cloud ready
    • Required paid resources
  • Create a GitLab VM
  • Configure GitLab
    • Set privacy settings
  • Create a project
  • Set up and run testing for the project
    • Configure and register a Runner
    • Create a test scenario
    • Create an error in the project
  • How to delete the resources you created

GitLab is a web-based Git repository management site and system. GitLab also lets developers run a continuous process for writing, testing, and deploying code.

In this scenario, you will set up GitLab on a virtual machine, create a single project in the C++ programming language, configure a project test script, and test its execution.

To create and test a project in the GitLab environment:

  1. Get your cloud ready.
  2. Required paid resources.
  3. Create a VM with GitLab.
  4. Configure GitLab.
  5. Set privacy settings.
  6. Create a project.
  7. Set up and run testing for the project.
  8. Configure and register a Runner.
  9. Create a test scenario.
  10. Create an error in the project.
  11. How to delete the resources you created.

Get your cloud readyGet your cloud ready

Sign up in Yandex Cloud and create a billing account:

  1. Navigate to the management console and log in to Yandex Cloud or register a new account.
  2. On the Yandex Cloud Billing page, make sure you have a billing account linked and it has the ACTIVE or TRIAL_ACTIVE status. If you do not have a billing account, create one and link a cloud to it.

If you have an active billing account, you can navigate to the cloud page to create or select a folder for your infrastructure to operate in.

Learn more about clouds and folders.

Required paid resourcesRequired paid resources

The cost for maintaining a GitLab server includes:

  • Fee for a disk and a continuously running VM (see Yandex Compute Cloud pricing).
  • Fee for using a dynamic or static public IP address (see Yandex Virtual Private Cloud pricing).

Create a GitLab VMCreate a GitLab VM

  1. On the folder page in the management console, click Create resource and select Virtual machine instance.

  2. Under Boot disk image, in the Product search field, enter Gitlab and select a public GitLab image.

  3. Under Location, select the availability zone to create your VM in. If you do not know which availability zone you need, leave the default one.

  4. Under Disks and file storages, select the SSD disk type and set the 20 GB size.

  5. Under Computing resources, navigate to the Custom tab and specify the platform, number of vCPUs, and the amount of RAM:

    • Platform: Intel Ice Lake
    • vCPU: 4
    • Guaranteed vCPU performance: 100%
    • RAM: 8 GB
  6. Under Network settings:

    • In the Subnet field, select the network and subnet to connect your VM to. If the required network or subnet is not listed, create it.
    • Under Public IP address, keep Auto to assign your VM a random external IP address from the Yandex Cloud pool, or select a static address from the list if you reserved one in advance.
  7. Under Access, select SSH key and specify the VM access credentials:

    • Under Login, enter a username. Do not use root or other usernames reserved for the OS. To perform operations requiring root privileges, use the sudo command.
    • In the SSH key field, select the SSH key saved in your organization user profile.

      If there are no saved SSH keys in your profile, or you want to add a new key:

      • Click Add key.
      • Enter a name for the SSH key.
      • Upload or paste the contents of the public key file. You need to create a key pair for the SSH connection to a VM yourself.
      • Click Add.

      The SSH key will be added to your organization user profile.

      If users cannot add SSH keys to their profiles in the organization, the added public SSH key will only be saved to the user profile of the VM being created.

  8. Under General information, specify the VM name: gitlab.

  9. Click Create VM.

Wait about five minutes for the VM to be created and for all its services to start. After all of the services fully launch, GitLab will become available through its web interface in the browser.

Configure GitLabConfigure GitLab

  1. On the Compute Cloud page, select the created VM named gitlab and copy its public IP address.

  2. Connect to the VM over SSH.

  3. Get the GitLab administrator password with the following VM command:

    sudo cat /etc/gitlab/initial_root_password
    
  4. Copy the password without spaces from the Password line to the clipboard or a separate file.

  5. In your browser, open http://<VM_public_IP_address>. This will take you to the GitLab web interface.

  6. Log in as the administrator:

    • Username or email: root.
    • Password: Password you copied in the previous step.

    If you are unable to log in, reset the administrator password.

  7. Change the administrator password.

  8. Log in as the administrator with the new password.

Set privacy settingsSet privacy settings

Disable sign-up for other users on the login page:

  1. Go to Admin area.
  2. In the left-hand panel, go to Settings and select General.
  3. Under Sign-up restrictions, click Expand.
  4. Disable Sign-up enabled.
  5. Click Save changes.

Now, only the administrator can register a new user from the Users tab in Overview.

Create a projectCreate a project

To create a project:

  1. On the GitLab home page, select Create a project.

  2. On the page that opens, specify:

    • Project name: My Project.
    • Project group and project ID: root and my-project, respectively.
    • Set a description and the scope of the project if required.
  3. Click Create project.

    Creating a project

  4. Once you create the project, in the left-hand panel, go to Settings and select the CI/CD tab.

  5. Under Auto DevOps, click Expand, disable Default to Auto DevOps pipeline, and click Save changes.

    Disabling Auto DevOps

  6. Add a project file.

    1. In the left-hand panel, go to the GitLab project.

    2. Click in the repository navigation bar and select New file from the drop-down menu.

    3. Name your file test.cpp. Add into it the code of the program that checks the product of 2 × 2 and displays Hello World if the result is 4:

      #include <iostream>
      #include <cassert>
      
      int main() {
        assert(2 * 2 == 4);
        std::cout << "Hello world!" << std::endl;
        return 0;
      }
      

      Adding a file

    4. Enter a commit name in the Commit message field.

    5. Click Commit changes.

Set up and run testing for the projectSet up and run testing for the project

A Runner is a program that tests and builds projects in the GitLab environment by following provided instructions.

Configure and register a RunnerConfigure and register a Runner

  1. Use SSH to connect to the VM and switch to administrator mode in the console:

    sudo -i
    
  2. Download the Runner:

    curl --location --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
    
  3. Make the Runner executable:

    chmod +x /usr/local/bin/gitlab-runner
    
  4. Create a separate user to start the Runner:

    useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
    
  5. Install and start the Runner:

    gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
    gitlab-runner start
    
  6. Register the Runner in GitLab:

    1. Launch interactive registration with the gitlab-runner register command.

    2. Enter your GitLab server address. When you see the prompt:

      Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com)
      

      enter http://<public_IP_address_of_your_VM>.

    3. Enter the registration token for the Runner. To retrieve it, go to the project page in GitLab, select Settings on the left-hand panel, and click the CI/CD tab. Then click Expand under Runners. Under Set up a specific Runner manually, copy the token from step 3 and enter it in the request response:

      Please enter the gitlab-ci token for this runner
      <token>
      

      Getting a token

    4. When you see the prompt:

      Please enter the gitlab-ci description for this runner
      

      Enter a description for the Runner: My runner.

    5. Do not specify anything in the tag field, just press Enter. Otherwise, by default, the Runner will not run without specifying the appropriate tags for the project.

    6. Specify the runtime environment. In our case, when prompted:

      Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
      

      Enter: shell.

Runner installation and setup is complete. If everything is done correctly, the Runners activated for this project section with the registered Runner should appear on the page where you copied the registration token.

Successful setup

Create a test scenarioCreate a test scenario

Create a test scenario to execute the Runner. The scenario is described in a special file named .gitlab-ci.yml, which should be stored in the project's root directory. According to the scenario, the Runner will compile the project source file, convert it to an executable file, and then run it.

As testing will take place on the VM operating system, you need to install the apps required for testing: git to clone the project from the repository and g++ to compile the project.

To create a test scenario:

  1. Connect to the VM via SSH and install the required apps:

    sudo apt update
    sudo apt install -y git g++
    
  2. Add a test scenario:

    1. Open the GitLab web interface.

    2. Open the GitLab project.

    3. On the page that opens, click Set up CI/CD.

    4. A page will open asking you to add a new file named .gitlab-ci.yml, in which you need to describe the scenario in YAML format. Add the scenario text:

      stages:
        - build
        - test
        - pack
      
      cache:
        paths:
          - hello
      
      build:
        stage: build
        script: g++ test.cpp -o hello
      
      test:
        stage: test
        script: ./hello
      
      pack:
        stage: pack
        script: gzip -c hello > hello.gz
        artifacts:
          paths:
            - hello.gz
      

      The scenario indicates that the process is divided into three stages that are performed sequentially:

      • build: At the first stage, the project is compiled and converted to an executable file named hello.
      • test: At the second stage, the executable file is run.
      • pack: At the third stage, an archive with the executable file is created, which you can download via the GitLab web interface after the scenario is successfully completed. Under artifacts, there is a list of files available for download.

      Under cache, specify which files and directories are to be transferred between stages. If you omit it, the hello file will not be available at the test stage and an error will occur.

      Test scenario

    5. Click Commit changes

After committing, the system will automatically start testing the last commit. To check its results, select Build on the left-hand panel in the GitLab project and then Pipelines from the drop-down menu. The line you will get should contain the first test with the passed status. By clicking the cloud icon, you can download the build artifacts.

Create an error in the projectCreate an error in the project

Now, make the project run with an error that the Runner should help you find during testing. To do this:

  1. Go to the project repository and open the test.cpp file.

  2. Click Edit.

  3. In the check, assert that the product of multiplying 2 x 2 should be 5. In this case, an error occurs when the program is run and it fails.

    ...
    assert(2 * 2 == 5);
    ...
    
  4. Name your commit: Wrong assert in test.cpp.

  5. Click Commit changes.

Open Build → Pipelines. In the Stages column, you can see that, as a result of the test, the first stage, build, was passed successfully and the second stage, test, returned an error. The third stage, pack, was skipped and the build artifacts were not generated.

If you click the failed progress status and go to Failed Jobs, you can see the error text saying that assert was not executed:

Runtime error

How to delete the resources you createdHow to delete the resources you created

To stop paying for your deployed server, it is enough to delete the gitlab VM you created.

If you reserved a static public IP address specifically for this VM:

  1. Select Virtual Private Cloud in your folder.
  2. Navigate to the IP addresses tab.
  3. Find the required address, click , and select Delete.

Was the article helpful?

Previous
Storing Docker images in Yandex Container Registry
Next
Creating test VMs via GitLab CI
Yandex project
© 2025 Yandex.Cloud LLC