Questions tagged [gitlab-ci]

GitLab CI is a continuous integration server from GitLab.

GitLab CI integrates with your GitLab instance to build the projects and run tests on top. GitLab CI supports the Linux operating system.

GitLab CI pipelines are defined by a .gitlab-ci.yml file placed inside the project directory. For details on writing a .gitlab-ci.yml file visit https://docs.gitlab.com/ee/ci/yaml/.

More information is in https://about.gitlab.com/features/gitlab-ci-cd/.

8228 questions
55
votes
5 answers

How do I add a .env file in gitlab ci during deployment stage?

So I have a react/typescript app in my repo that I'm working on and in my repo I have a .env file that I'm ignoring so that my secrets don't get exposed and a .env-example file of important environment variables to configure. My problem is, since…
55
votes
2 answers

How to publish docker images to docker hub from gitlab-ci

Gitlab provides a .gitlab-ci.yml template for building and publishing images to its own registry (click "new file" in one of your project, select .gitlab-ci.yml and docker). The file looks like this and it works out of the box :) # This file is a…
GabLeRoux
  • 16,715
  • 16
  • 63
  • 81
55
votes
7 answers

Change Gitlab CI Runner user

Currently when I start a build in GitlabCI it is running under gitlab-runner user. I want to change it the company's internal user. I didn't find any parameter to the /etc/gitlab-runner/config.toml which is solve that. My current configuration:…
PumpkinSeed
  • 2,945
  • 9
  • 36
  • 62
54
votes
3 answers

"Error while loading shared libraries: libnss3.so" while running Gtlab CI job to perform automated testing using webdriverio

I'm setting up the CI job for automated testing in selenium inside Gitlab CI, but the test is failing due to the issue. 019-09-27T11:03:17.404Z INFO @wdio/cli:Launcher: Run onPrepare…
shaurya
  • 581
  • 1
  • 4
  • 8
53
votes
2 answers

gitlab-ci.yml jobs:build-production config key may not be used with `rules`: only

I am having a syntax error when I test my gitlab-ci.yml in CI Lint. Can someone suggest a solution to this problem? build-production: stage: build only: - master image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] …
genshuwoodswind
  • 742
  • 1
  • 4
  • 8
53
votes
2 answers

Get Branch name in gitlab ci

In my Gitlab CI, I have a stage that triggers another stage by api call trigger and I want to pass the current branch name as parameter to the other project holding the trigger. I used the CI_COMMIT_REF_NAME for this, it seemed to work, but now…
Max R.
  • 1,574
  • 2
  • 12
  • 27
53
votes
3 answers

How to create repository badges in gitlab?

How do I create badges for my project in gitlab? I know there is a webpage for it here https://docs.gitlab.com/ee/user/project/badges.html but I have no idea what they are saying. suppose my project is…
trial guy
  • 561
  • 1
  • 4
  • 4
53
votes
4 answers

GitLab CI Pipeline on specific branch only

I'm trying to implement GitLab CI Pipelines to build and deploy an Angular app. In our project we have two general branches: master (for production only) and develop. For development we create feature/some-feature branches from develop branch. When…
ProximaCygni
  • 887
  • 1
  • 6
  • 9
53
votes
2 answers

How to fail a build on Gitlab CI shell runner

I have a Gitlab CI runner running on windows 10: before_script: - "echo off" - 'call "%VS120COMNTOOLS%\vsvars32.bat"' - echo. - set - echo. stages: - build build: stage: build script: - 'StatusTest.exe' #- msbuild... I am…
Vojtech B
  • 2,837
  • 7
  • 31
  • 59
52
votes
6 answers

Using GitLabCI with C#

I've been working on a C# application and wanted to try the GitLab CI out. All I can see is Ruby and can't find any information on how to build a C# application using it. When I run the test settings, I make the commit, but I don't have my…
Andres Rojano Ruiz
  • 1,009
  • 1
  • 11
  • 17
51
votes
1 answer

How gitlab runner concurrency works?

Q1: Whats the difference between concurrent = 3 [[runners]] .. executor = "shell" and concurrent = 3 [[runners]] ... executor = "shell" [[runners]] ... executor = "shell" [[runners]] ... executor = "shell" Q2: Does it makes…
Slimer
  • 1,123
  • 2
  • 10
  • 22
49
votes
1 answer

Gitlab-ci: extend script section

I have an unity ci-project. .gitlab-ci.yml contains base .build job with one script command. Also I have multiple specified jobs for build each platform which extended base .build. I want to execute some platform-specific commands for android, so I…
orion_tvv
  • 1,681
  • 4
  • 17
  • 29
48
votes
11 answers

How to delete gitlab CI jobs pipelines logs/builds and history

How can we configure gitlab to keep only the last 10 CI jobs/builds and keep deleting the rest? For example , in Jenkins , we can configure the job to keep only last X builds.
Ijaz Ahmad
  • 11,198
  • 9
  • 53
  • 73
47
votes
2 answers

Gitlab CI + DinD + MySQL services permission issue

I created two GitLab jobs: Test unit (using a PHP registered docker on GitLab) Sonar (using docker service to run "Letsdeal/docker-sonar-scanner") I use the following gitlab-ci-multi-runner configuration: concurrent = 1 check_interval =…
Bruno Maurice
  • 599
  • 3
  • 9
47
votes
4 answers

Exporting environment variables from one stage to the next in GitLab CI

Is there a way to export environment variables from one stage to the next in GitLab CI? I'm looking for something similar to the job artifacts feature, only for environment variables instead of files. Let's say I'm configuring the build in a…
Bastian Venthur
  • 12,515
  • 5
  • 44
  • 78