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
Related
I have created a pipeline for running automation script from bitbucket, when I trigger build with docker container all custom variable is working (it pass the correct values) but when I run the same project in self.hosted machine and pass the variables it show blank values.
Below is the sample of pipeline file
# This is an example Starter pipeline configuration
# Use a skeleton to build, test and deploy using manual and parallel steps
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: atlassian/default-image:2
pipelines:
pull-requests: #Trigger pipeline project on each Pull-Request
'**':
- step:
name: 'version check'
image: maven:3.3.9
caches:
- maven
script:
- echo "Your versions here..."
- mvn --version
- step:
name: 'Clean and Build'
script:
- mvn -f TestAutomation/pom.xml clean compile
custom:
Automation-Run: #Name of this pipeline
- variables:
- name: testngFile
default: "src/test/resources/testng"
- name: browser
default: "CHROME"
allowed-values: # optionally restrict variable values
- "CHROME"
- "FIREFOX"
- name: environment
default: STAGING
allowed-values:
- "STAGING"
- "QA"
- "PROD"
- name: forkCount
default: "0"
- name: tags
default: Regression
- step:
name: 'Connect to Runner & Automation-Run'
runs-on:
- self.hosted
- windows
- testautomation
script:
- cd TestAutomation
- .\Example1.bat ${testngFile} ${browser} ${environment} ${tags}
artifacts:
- /target/surefire-reports/**.xml
inside Example1.bat file I have mentioned below command
mvn clean test -Dproject.testngFile=%1 -Dbrowser.name=%2 -Dproject.environment=%3 -Dcucumber.filter.tags=#%4
enter image description here
enter image description here
I am expecting when user enter any values, it picked and stored into variable and those variables are pass to Example1.bat as runtime command line args.
I'm going through the "Scalable FastAPI Application on AWS" course. My gitlab-ci.yml file is below.
stages:
- docker
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
cache:
key: ${CI_JOB_NAME}
paths:
- ${CI_PROJECT_DIR}/services/talk_booking/.venv/
build-python-ci-image:
image: docker:19.03.0
services:
- docker:19.03.0-dind
stage: docker
before_script:
- cd ci_cd/python/
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t registry.gitlab.com/chris_/talk-booking:cicd-python3.9-slim .
- docker push registry.gitlab.com/chris_/talk-booking:cicd-python3.9-slim
My Pipeline fails with this error:
See https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
$ docker build -t registry.gitlab.com/chris_/talk-booking:cicd-python3.9-slim .
invalid argument "registry.gitlab.com/chris_/talk-booking:cicd-python3.9-slim" for "-t, --tag" flag: invalid reference format
See 'docker build --help'.
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 125
It may or may not be relevant but the Container Registry for the GitLab project says there's a Docker connection error.
Thanks
I created a new GitLab account with a new username and things are working now. The underscore does appear to have been the issue.
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