I'm trying to add a gitlab-ci.yml to my project but I get the following error:
Error: (<unknown>): mapping values are not allowed in this context at line 10 column 15
before-script:
- bash ci/install.sh > /dev/null
cache:
paths:
- vendor/
test:5.6:
image: php:5.6
script:
- vendor/bin/codecept run
test:7.0:
image: php:7.0
script:
- vendor/bin/codecept run
After a play with the linter I found the correct syntax is:
before_script:
- bash ci/install.sh > /dev/null
test:5.6:
image: php:5.6
script:
- vendor/bin/codecept run
test:7.0:
image: php:7.0
script:
- vendor/bin/codecept run
Related
stages:
- deploy
deploy_ssh:
stage: deploy
image:
name: registry.gitlab.com/torese/docker-ansible
variables:
ANSIBLE_HOST_KEY_CHECKING: 'false'
ANSIBLE_FORCE_COLOR: 'true'
ANSIBLE_PYTHON_INTERPRRTER: /usr/bin/python3
GIT_CLEAN_FLAGS: none
before_script:
- export AWS_ACCESS_KEY_ID=$TEST_AWS_ACCESS_KEY_ID
- export AWS_SECRET_ACCESS_KEY=$TEST_AWS_SECRET_ACCESS_KEY
- export AWS_DEFAULT_REGION=$TEST_AWS_DEFAULT_REGION
script:
- mkdir ./subba
- touch ./subba/demo
- echo "Hello world" >> ./subba/demo
tags:
- devaws # my gitlabrunner tag
see the above info while run pipeline job succeeded but when i goto runner instance I'm unable to find the ./subba directory ?
can anyone help me with this
thanks
I getting an error on stages on that pipeline.
GitLab CI configuration is invalid: stages config should be an array of strings.
stages:
-test
-run
image: python:latest
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv/
test-asamasi:
stage: test
script:
- python --version
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- python sslkontrol.py test
calistirma:
stage: run
script:
- python sslkontrol.py
On small mistake on the stages, you need to add an extra space between the - and test
I have tested your pipeline file above and I was able to get it working by adding space between - character and stage name(e.g - test) as shown below:
stages:
- test
- run
image: python:latest
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip
- venv/
test-asamasi:
stage: test
script:
- python --version
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- python sslkontrol.py test
calistirma:
stage: run
script:
- python sslkontrol.py
Recommendations
Now its easier to visualize, lint/validate your gitlab pipeline(e.g ) from within Gitlab console using this instructions Validate GitLab CI/CD configuration
I need to run unit tests on gitlab pipeline.
Here's my .gitlab-ci.yml:
stages:
- build
image: napp/php-ci:7.4-fpm
services:
- name: mysql:5.7
alias: mysql
variables:
MYSQL_ROOT_PASSWORD: pass_root
MYSQL_DATABASE: db_test
MYSQL_USER: user
MYSQL_PASSWORD: test
DATABASE_URL: 'mysql://user:test#mysql:3306/db_test'
build:
stage: build
only:
- master
- staging
services:
- mysql:5.7
script:
- apt-get update
- apt-get install zip unzip
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php
- php -r "unlink('composer-setup.php');"
- php composer.phar install
- php bin/console app:deploy:symfony:local
- ./vendor/bin/phpunit
On gitlab I have error: Access denied for user 'user'#'%' to database 'db_test_test'
Why it does not make tests on db_test but on 'db_test_test'`?
Can you please help me so I could run it appropriate db - db_test
Check your env.test file or any other environment file that you are using for testing. There will be a line which adds a prefix _test to your database name.
I am trying to migrating circleci 1.0 to 2.0 ,
and I got this error.
in job ‘build’: steps is not a list
can someone help me what is the reason ?
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.2.3-jessie
environment:
AWS_REGION: eu-central-1
steps:
- checkout
- run: echo "Tests are skipped because of static site."
- run: mkdir -p /tmp/test-data
deploy:
production:
branch: master
commands:
- bundle exec middleman s3_sync
The identation of the array below steps seems to be off. Try this:
steps:
- checkout
- run: echo "Tests are skipped because of static site."
- run: mkdir -p /tmp/test-data
Is it possible to configure the gitlab-yml of the project in such a way that after the tag has been pushed out it can run several commands ? If so, how do you get it? I would also like to define the variables that I would like to use in these several commands.
My gitlab-ci looks like:
stages:
- build
- deploy
build:
stage: build
script:
- composer install --no-ansi
- vendor/bin/phar-composer build
artifacts:
paths:
- example.phar
tags:
- php:7.0
deploy:
stage: deploy
only:
- tags
dependencies:
- build
script:
- cp example.phar /opt/example/
tags:
- php:7.0
It's about running example.phar bin/console command1 $VARIABLE1 $VARIABLE2 $VARIABLE3 $VARIABLE4.
Please help me because I am not completely familiar with these matters.
You can trigger a job when one tag is pushed using only parameter:
build:
stage: build
image: alpine:3.6
script:
- echo "A tag has been pushed!"
only:
- tags