Questions tagged [gitlab-ci.yml]
222 questions
44
votes
1 answer
What is difference between script: and before_script: inside a job in gitlab-ci.yml
In .gitlab-ci.yml it is possible to add a default before_script that runs before all script in defined jobs.
My question is why define before_script in a job instead of just using the script in the job? Is using before_script inside a job is only to…

Ouss
- 2,912
- 2
- 25
- 45
13
votes
3 answers
Array variable inside .gitlab-ci.yml yaml
I want to use arrays in variables of my gitlab ci/cd yml file, something like that:
variables:
myarrray: ['abc', 'dcef' ]
....
script: |
echo myarray[0] myarray[1]
But Lint tells me that file is incorrect:
variables config should be a hash…

Tadeusz
- 6,453
- 9
- 40
- 58
10
votes
3 answers
Is there a way to skip a pipeline when there are markdown changes only?
Goal
The release pipeline should start a deployment for specific branches.
This should not happen (skip the job), if there are only documentation changes. (*.md files)
The problem
If you change multiple files, but only one file ends in .md, the…

kapsiR
- 2,720
- 28
- 36
9
votes
1 answer
Run GitLab CI for a subdirectory in the same project
I have three subprojects (Angular and Node.js) in the same GitLab project. Now I want to create the gitlab-ci.yml file for building and deploying one of this subprojects. Can I create three different gitlab-ci.yml files and run them inside…

Tharindu Lakshan
- 3,995
- 6
- 24
- 44
7
votes
2 answers
Update Android Gitlab CI/CD pipeline from Java 1.8 to Java 11?
Project builds successfully on local PC in Android Studio after upgrade to Gradle 7 but not in Gitlab pipeline.
Gradle 7.0.2 requires Java 11.
The error message in Gitlab pipeline is
A problem occurred evaluating project ':app'.
Failed to apply…

Nexus7_2012
- 654
- 9
- 13
5
votes
1 answer
How to check if environment/devployment exists/successfull inside a job and decide to deploy/update it
In the gitlab ce omnibus 14.10.2 instance, there is a project in which it is necessary to make a pipeline in gitlab-ci.yml that would check for the existence of dynamical environment deployments
and if they are not there, then do nothing, and if…

Илья Бугримов
- 78
- 6
4
votes
1 answer
How do I cache conda environment when running gitlab CI jobs?
I am trying to add a .gitlab-ci.yml file to my gitlab project; the file looks like:
image: continuumio/miniconda3:latest
before_script:
- conda env create -f environment.yml
- conda activate py3p10
- export MY_PROJECT_ROOT=$PWD
- export…

acampove
- 41
- 1
4
votes
2 answers
How to override a gitlab group or project CD/CI variable in .gitlab-ci.yml?
I have a project in Gitlab having defined variables in the Gitlab UI in the project group folder. On a new branch of one of my git repositories I need to override some of these variables.
variables:
GLOBALLY_DEFINED_VARIABLE:…

foobar
- 43
- 1
- 5
4
votes
1 answer
Why Cypress service is failing?
Below is my pipeline on which I'm trying to get Cypress job to run tests against
Nginx service (which points to the main app) which is built at the build stage
The below is based on official template from here…

Mark
- 1,385
- 3
- 16
- 29
3
votes
2 answers
SSH connection refused from Gitlab CI
I am using Gitlab CI to build a static generated website and send it to my server. I am using a SSH keys pair to establish the connection from rsync, but my server is refusing the connection.
I tried several things: started with ED25519 key, changed…

user2540800
- 45
- 5
3
votes
2 answers
GitLab CI Pipeline: Pipeline cannot be run
I can't find out why the GitLab CI Pipelines for my Repo won't run. I have a .gitlab-ci.yml file and the feature enabled, but the pipeline won't run. Also if I try to trigger the pipeline manually I get the following error back.
Pipeline cannot be…

Thomas Venturini
- 3,500
- 4
- 34
- 43
3
votes
1 answer
Run a pre job before GitLab pipeline
I want to run a job each time a new pipeline gets triggered. It's a kind of preparation job which should always be executed before every other job defined inside the .gitlab-ci.yml
For Example
stages:
- build
- test
my-prep-job:
stage: .pre
…

Abid Khan
- 145
- 2
- 9
3
votes
1 answer
gitlab-ci.yml - before_script - how to only run it in specific stages
I have the following gitlab-ci.yml: (only showing relevant code)
stages:
- unitTest
- deploy-fn-development
- deploy-fn-rehearse
- deploy-fn-prod
include: "/ci_templates/.create-variables.yml"
And this is what the include file looks…

dot
- 14,928
- 41
- 110
- 218
2
votes
1 answer
Code Coverage Issue in GitLab - showing unknown
I added the coverage keyword and regular expression on stage, still not working.
run tests:
stage: test
coverage: '/coverage: ^TOTAL.+?(\d+\%)$/'

Shashikumar KL
- 1,007
- 1
- 10
- 25
2
votes
1 answer
Is it possible to set global rule in GitLab CI for branch run
I know how to make specific jobs to run only on certain branches, but I would like to set a global rule for the entire pipeline config, so I don't have to set it in each job separately.
Is that possible?
I'm currently putting this rule at the very…

Milkncookiez
- 6,817
- 10
- 57
- 96