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
27
votes
4 answers

Gitlab-CI: Specify that Job C should run after Job B if Job A fails

Imagine you have the following Pipeline: Job A (deploy) -> Job B (test) -> Job C (remove test deployment) The pipeline should deploy a test image and test it after a successful deployment. After the test I want to run a cleanup script regardless of…
Sebi2020
  • 1,966
  • 1
  • 23
  • 40
27
votes
4 answers

How to pass GitLab CI file variable to Dockerfile and docker container?

GitLab CI allows adding custom variables to a project. It allows to use a secret variable of type file where I specify a Key that is the variable name and Value that is the content of a file(e.g. content of certificate) Then during execution of the…
robliv
  • 1,351
  • 3
  • 15
  • 30
27
votes
5 answers

How to solve the "remote: You are not allowed to upload code." error on GitLab CI/CD job?

I am currently trying to use GitLab to run a CI/CD job that runs a Python file that makes changes to a particular repository and then commits and pushes those changes to master. I also have a role of Master in the repository. It appears that all git…
Chloe Bennett
  • 901
  • 2
  • 10
  • 23
27
votes
1 answer

Gitlab-Ci: How could I share data between jobs

I want to share a file between two jobs and modify it if there are changed files. The python script compare the cache.json file with changes and modify the cahce file sometimes. .gitlab-ci.yaml: image: ubuntu stages: - test cache: key:…
test42
  • 271
  • 1
  • 3
  • 5
27
votes
9 answers

Gitlab runner docker Could not resolve host

Im using 2 containers on my Ubuntu OS: Gitlab-ce and gitlab-runner Containers names are: gitlab_gitlab_1 and gitlab_gitlab-runner_1 I access to my gitlab app via gitlab.localhost.com:801 I register successfully a runner with this command: docker…
fliim
  • 2,059
  • 4
  • 18
  • 31
27
votes
4 answers

Gitlab CI using Badges for each job

Let's say I have configured multiple jobs for a project like following: build_win32: script: ... build_ios: script: ... unit_tests: script: ... server_tests: script: ... client_tests: script: ... What I want to achieve is to configure…
Matt
  • 1,424
  • 1
  • 13
  • 17
27
votes
2 answers

How to merge sequences in .gitlab-ci.yml?

I am trying to remove some redundancy in setting up several tasks within GitLab CI. As a (greatly) simplified example, I have two jobs involving a call to apt-get update: job1: before_script: - apt-get update - apt-get install foo job2: …
DaSourcerer
  • 6,288
  • 5
  • 32
  • 55
27
votes
2 answers

Use GitLab API from a GitLabCI build script

I have a GitLab CI build script like this: create release: stage: deploy tags: - basic only: - tags script: - GITLOG=$(echo "# Changes Log"; git log `git tag | tail -2 | head -1`..${CI_BUILD_TAG} --pretty=format:" - %s") -…
ETL
  • 9,281
  • 3
  • 29
  • 28
27
votes
2 answers

Displaying latex equation in gitlab wiki using the markdown editor

I am interested in building a wiki for my scientific computing code on gitlab which needs me to write equations and render them in the wiki in gitlab. How to do this. I tried to paste the mathjax rendering script but it doesn't work. Can KaTeX be…
datapanda
  • 437
  • 1
  • 5
  • 12
26
votes
3 answers

GitLab CI syntax to write FOR loop statement?

Below is the script mentioned in the gitlab-ci.yml file. This GitLab CI configuration is valid. But, when the CI/CD build is run, the job fails. Is it something to do with the FOR loop syntax? deploy_dv: stage: deploy_dv variables: …
user2301
  • 1,857
  • 6
  • 32
  • 63
26
votes
2 answers

How are Gitlab CI service ports exposed?

I have a .gitlab-ci.yml file: integration_test: services: - name: registry.gitlab.com/group/project/testmailserver:1.1 alias: "mail.email" stage: test script: - ./gradlew -g /cache/.gradle --stacktrace --info integrationTest The…
SLOBY
  • 1,007
  • 2
  • 10
  • 24
26
votes
7 answers

Gitlab CI - SSH Permission denied (publickey,password)

I've been trying to setup CD for my project. My Gitlab CI runner and my project will be on same server. I've followed https://docs.gitlab.com/ee/ci/examples/deployment/composer-npm-deploy.html but I keep getting SSH Permission denied…
kursat
  • 1,059
  • 5
  • 15
  • 32
26
votes
7 answers

Get value of package.json in gitLab CI YML

I'm using gitLab CI for my nodejs application. In my YML file I need to call a script to build a docker image. But instead of using latest I need to use the current version of the project. This version value can be find in the package.json file of…
user3142695
  • 15,844
  • 47
  • 176
  • 332
26
votes
5 answers

Gitlab CI runner not able to expose ports of nested Docker containers

When using GitLab CI, as well as the gitlab-ci-multi-runner, I'm unable to get internally-started Docker containers to expose their ports to the "host", which is the Docker image in which the build is running. My .gitlab-ci.yml file: test: image:…
Craig Otis
  • 31,257
  • 32
  • 136
  • 234
26
votes
2 answers

Deploy every build to a server using Gitlab CI

I've set up my own Gitlab server with one project and a Gitlab runner configured for it. I'm new to continuous integration server and therefore don't know how to accomplish the following. Every time I commit to the master branch of my project I…
Hedge
  • 16,142
  • 42
  • 141
  • 246