Commit 75361309 authored by Marcel Amirault's avatar Marcel Amirault

Update yaml codeblocks

Ran yamllint on yaml codeblocks to identify
minor formatting inconsistencies
parent 142d2df5
...@@ -85,7 +85,7 @@ This can be solved by adding your CA's certificate to the kaniko certificate ...@@ -85,7 +85,7 @@ This can be solved by adding your CA's certificate to the kaniko certificate
store: store:
```yaml ```yaml
before_script: before_script:
- mkdir -p /kaniko/.docker - mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- | - |
......
...@@ -228,6 +228,7 @@ deploy_terraform: ...@@ -228,6 +228,7 @@ deploy_terraform:
stage: deploy stage: deploy
script: script:
# Your Review App deployment scripts - for a working example please check https://gitlab.com/Flockademic/Flockademic/blob/5a45f1c2412e93810fab50e2dab8949e2d0633c7/.gitlab-ci.yml#L315 # Your Review App deployment scripts - for a working example please check https://gitlab.com/Flockademic/Flockademic/blob/5a45f1c2412e93810fab50e2dab8949e2d0633c7/.gitlab-ci.yml#L315
- echo
e2e:firefox: e2e:firefox:
stage: confidence-check stage: confidence-check
services: services:
......
...@@ -566,15 +566,11 @@ Also set the variables `DB_HOST` to `mysql` and `DB_USERNAME` to `root`, which a ...@@ -566,15 +566,11 @@ Also set the variables `DB_HOST` to `mysql` and `DB_USERNAME` to `root`, which a
We define `DB_HOST` as `mysql` instead of `127.0.0.1`, as we use MySQL Docker image as a service which [is linked to the main Docker image](../../docker/using_docker_images.md#how-services-are-linked-to-the-job). We define `DB_HOST` as `mysql` instead of `127.0.0.1`, as we use MySQL Docker image as a service which [is linked to the main Docker image](../../docker/using_docker_images.md#how-services-are-linked-to-the-job).
```yaml ```yaml
...
variables: variables:
MYSQL_DATABASE: homestead MYSQL_DATABASE: homestead
MYSQL_ROOT_PASSWORD: secret MYSQL_ROOT_PASSWORD: secret
DB_HOST: mysql DB_HOST: mysql
DB_USERNAME: root DB_USERNAME: root
...
``` ```
#### Unit Test as the first job #### Unit Test as the first job
...@@ -584,8 +580,6 @@ We defined the required shell scripts as an array of the [script](../../yaml/REA ...@@ -584,8 +580,6 @@ We defined the required shell scripts as an array of the [script](../../yaml/REA
These scripts are some Artisan commands to prepare the Laravel, and, at the end of the script, we'll run the tests by `PHPUnit`. These scripts are some Artisan commands to prepare the Laravel, and, at the end of the script, we'll run the tests by `PHPUnit`.
```yaml ```yaml
...
unit_test: unit_test:
script: script:
# Install app dependencies # Install app dependencies
...@@ -598,8 +592,6 @@ unit_test: ...@@ -598,8 +592,6 @@ unit_test:
- php artisan migrate - php artisan migrate
# Run tests # Run tests
- vendor/bin/phpunit - vendor/bin/phpunit
...
``` ```
#### Deploy to production #### Deploy to production
...@@ -615,8 +607,6 @@ The `only` keyword tells GitLab CI/CD that the job should be executed only when ...@@ -615,8 +607,6 @@ The `only` keyword tells GitLab CI/CD that the job should be executed only when
Lastly, `when: manual` is used to turn the job from running automatically to a manual action. Lastly, `when: manual` is used to turn the job from running automatically to a manual action.
```yaml ```yaml
...
deploy_production: deploy_production:
script: script:
# Add the private SSH key to the build environment # Add the private SSH key to the build environment
......
...@@ -73,24 +73,16 @@ Now that we created the script that contains all prerequisites for our build ...@@ -73,24 +73,16 @@ Now that we created the script that contains all prerequisites for our build
environment, let's add it in `.gitlab-ci.yml`: environment, let's add it in `.gitlab-ci.yml`:
```yaml ```yaml
...
before_script: before_script:
- bash ci/docker_install.sh > /dev/null - bash ci/docker_install.sh > /dev/null
...
``` ```
Last step, run the actual tests using `phpunit`: Last step, run the actual tests using `phpunit`:
```yaml ```yaml
...
test:app: test:app:
script: script:
- phpunit --configuration phpunit_myapp.xml - phpunit --configuration phpunit_myapp.xml
...
``` ```
Finally, commit your files and push them to GitLab to see your build succeeding Finally, commit your files and push them to GitLab to see your build succeeding
...@@ -103,7 +95,7 @@ The final `.gitlab-ci.yml` should look similar to this: ...@@ -103,7 +95,7 @@ The final `.gitlab-ci.yml` should look similar to this:
image: php:5.6 image: php:5.6
before_script: before_script:
# Install dependencies # Install dependencies
- bash ci/docker_install.sh > /dev/null - bash ci/docker_install.sh > /dev/null
test:app: test:app:
...@@ -118,7 +110,7 @@ with a different Docker image version and the runner will do the rest: ...@@ -118,7 +110,7 @@ with a different Docker image version and the runner will do the rest:
```yaml ```yaml
before_script: before_script:
# Install dependencies # Install dependencies
- bash ci/docker_install.sh > /dev/null - bash ci/docker_install.sh > /dev/null
# We test PHP5.6 # We test PHP5.6
...@@ -231,8 +223,6 @@ In order to execute Composer before running your tests, simply add the ...@@ -231,8 +223,6 @@ In order to execute Composer before running your tests, simply add the
following in your `.gitlab-ci.yml`: following in your `.gitlab-ci.yml`:
```yaml ```yaml
...
# Composer stores all downloaded packages in the vendor/ directory. # Composer stores all downloaded packages in the vendor/ directory.
# Do not use the following if the vendor/ directory is committed to # Do not use the following if the vendor/ directory is committed to
# your git repository. # your git repository.
...@@ -241,15 +231,13 @@ cache: ...@@ -241,15 +231,13 @@ cache:
- vendor/ - vendor/
before_script: before_script:
# Install composer dependencies # Install composer dependencies
- wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig - wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" - php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php - php composer-setup.php
- php -r "unlink('composer-setup.php'); unlink('installer.sig');" - php -r "unlink('composer-setup.php'); unlink('installer.sig');"
- php composer.phar install - php composer.phar install
...
``` ```
## Access private packages or dependencies ## Access private packages or dependencies
......
...@@ -238,7 +238,6 @@ case it will apply to all jobs in the pipeline: ...@@ -238,7 +238,6 @@ case it will apply to all jobs in the pipeline:
```yaml ```yaml
my_job: my_job:
image: alpine image: alpine
...
``` ```
#### `post` #### `post`
...@@ -284,7 +283,6 @@ stages: ...@@ -284,7 +283,6 @@ stages:
my_job: my_job:
stage: build stage: build
...
``` ```
#### `steps` #### `steps`
...@@ -297,7 +295,6 @@ my_job: ...@@ -297,7 +295,6 @@ my_job:
script: script:
- echo "hello! the current time is:" - echo "hello! the current time is:"
- time - time
...
``` ```
### Directives ### Directives
......
...@@ -91,8 +91,8 @@ to access it. This is where an SSH key pair comes in handy. ...@@ -91,8 +91,8 @@ to access it. This is where an SSH key pair comes in handy.
## Optionally, if you will be using any Git commands, set the user name and ## Optionally, if you will be using any Git commands, set the user name and
## and email. ## and email.
## ##
#- git config --global user.email "user@example.com" # - git config --global user.email "user@example.com"
#- git config --global user.name "User name" # - git config --global user.name "User name"
``` ```
NOTE: **Note:** NOTE: **Note:**
...@@ -193,8 +193,8 @@ before_script: ...@@ -193,8 +193,8 @@ before_script:
## Replace example.com with your private server's domain name. Repeat that ## Replace example.com with your private server's domain name. Repeat that
## command if you have more than one server to connect to. ## command if you have more than one server to connect to.
## ##
#- ssh-keyscan example.com >> ~/.ssh/known_hosts # - ssh-keyscan example.com >> ~/.ssh/known_hosts
#- chmod 644 ~/.ssh/known_hosts # - chmod 644 ~/.ssh/known_hosts
## ##
## You can optionally disable host key checking. Be aware that by adding that ## You can optionally disable host key checking. Be aware that by adding that
...@@ -202,7 +202,7 @@ before_script: ...@@ -202,7 +202,7 @@ before_script:
## WARNING: Use this only with the Docker executor, if you use it with shell ## WARNING: Use this only with the Docker executor, if you use it with shell
## you will overwrite your user's SSH config. ## you will overwrite your user's SSH config.
## ##
#- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config' # - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'
``` ```
## Example project ## Example project
......
...@@ -3080,7 +3080,7 @@ For example, to match a single file: ...@@ -3080,7 +3080,7 @@ For example, to match a single file:
```yaml ```yaml
test: test:
script: [ "echo 'test' > file.txt" ] script: ["echo 'test' > file.txt"]
artifacts: artifacts:
expose_as: 'artifact 1' expose_as: 'artifact 1'
paths: ['file.txt'] paths: ['file.txt']
...@@ -3093,7 +3093,7 @@ An example that will match an entire directory: ...@@ -3093,7 +3093,7 @@ An example that will match an entire directory:
```yaml ```yaml
test: test:
script: [ "mkdir test && echo 'test' > test/file.txt" ] script: ["mkdir test && echo 'test' > test/file.txt"]
artifacts: artifacts:
expose_as: 'artifact 1' expose_as: 'artifact 1'
paths: ['test/'] paths: ['test/']
...@@ -3976,17 +3976,16 @@ tags. These options cannot be used together, so choose one: ...@@ -3976,17 +3976,16 @@ tags. These options cannot be used together, so choose one:
- 'm1' - 'm1'
- 'm2' - 'm2'
- 'm3' - 'm3'
released_at: '2020-07-15T08:00:00Z' # Optional, will auto generate if not defined, released_at: '2020-07-15T08:00:00Z' # Optional, will auto generate if not defined, or can use a variable.
# or can use a variable.
``` ```
- To create a release automatically when commits are pushed or merged to the default branch, - To create a release automatically when commits are pushed or merged to the default branch,
using a new Git tag that is defined with variables: using a new Git tag that is defined with variables:
NOTE: **Note:** NOTE: **Note:**
Environment variables set in `before_script` or `script` are not available for expanding Environment variables set in `before_script` or `script` are not available for expanding
in the same job. Read more about in the same job. Read more about
[potentially making variables available for expanding](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/6400). [potentially making variables available for expanding](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/6400).
```yaml ```yaml
prepare_job: prepare_job:
...@@ -4023,8 +4022,7 @@ in the same job. Read more about ...@@ -4023,8 +4022,7 @@ in the same job. Read more about
- 'm1' - 'm1'
- 'm2' - 'm2'
- 'm3' - 'm3'
released_at: '2020-07-15T08:00:00Z' # Optional, will auto generate if not defined, released_at: '2020-07-15T08:00:00Z' # Optional, will auto generate if not defined, or can use a variable.
# or can use a variable.
``` ```
#### `releaser-cli` command line #### `releaser-cli` command line
...@@ -4659,7 +4657,7 @@ If you want to temporarily 'disable' a job, rather than commenting out all the ...@@ -4659,7 +4657,7 @@ If you want to temporarily 'disable' a job, rather than commenting out all the
lines where the job is defined: lines where the job is defined:
```yaml ```yaml
#hidden_job: # hidden_job:
# script: # script:
# - run test # - run test
``` ```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment