Commit 2507dfd2 authored by Marcel Amirault's avatar Marcel Amirault

Merge branch 'patch-171' into 'master'

Use consistent spacing with yaml arrays in docs

See merge request gitlab-org/gitlab!35894
parents ab2aa5d4 540a9fac
...@@ -165,54 +165,54 @@ To use an external Prometheus server: ...@@ -165,54 +165,54 @@ To use an external Prometheus server:
```yaml ```yaml
scrape_configs: scrape_configs:
- job_name: nginx - job_name: nginx
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:8060 - 1.1.1.1:8060
- job_name: redis - job_name: redis
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:9121 - 1.1.1.1:9121
- job_name: postgres - job_name: postgres
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:9187 - 1.1.1.1:9187
- job_name: node - job_name: node
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:9100 - 1.1.1.1:9100
- job_name: gitlab-workhorse - job_name: gitlab-workhorse
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:9229 - 1.1.1.1:9229
- job_name: gitlab-rails - job_name: gitlab-rails
metrics_path: "/-/metrics" metrics_path: "/-/metrics"
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:8080 - 1.1.1.1:8080
- job_name: gitlab-sidekiq - job_name: gitlab-sidekiq
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:8082 - 1.1.1.1:8082
- job_name: gitlab_exporter_database - job_name: gitlab_exporter_database
metrics_path: "/database" metrics_path: "/database"
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:9168 - 1.1.1.1:9168
- job_name: gitlab_exporter_sidekiq - job_name: gitlab_exporter_sidekiq
metrics_path: "/sidekiq" metrics_path: "/sidekiq"
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:9168 - 1.1.1.1:9168
- job_name: gitlab_exporter_process - job_name: gitlab_exporter_process
metrics_path: "/process" metrics_path: "/process"
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:9168 - 1.1.1.1:9168
- job_name: gitaly - job_name: gitaly
static_configs: static_configs:
- targets: - targets:
- 1.1.1.1:9236 - 1.1.1.1:9236
``` ```
1. Reload the Prometheus server. 1. Reload the Prometheus server.
......
...@@ -226,14 +226,14 @@ image: node:latest ...@@ -226,14 +226,14 @@ image: node:latest
cache: cache:
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- .npm/ - .npm/
before_script: before_script:
- npm ci --cache .npm --prefer-offline - npm ci --cache .npm --prefer-offline
test_async: test_async:
script: script:
- node ./specs/start.js ./specs/async.spec.js - node ./specs/start.js ./specs/async.spec.js
``` ```
### Caching PHP dependencies ### Caching PHP dependencies
...@@ -253,16 +253,16 @@ image: php:7.2 ...@@ -253,16 +253,16 @@ image: php:7.2
cache: cache:
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- vendor/ - vendor/
before_script: before_script:
# Install and run Composer # Install and run Composer
- curl --show-error --silent https://getcomposer.org/installer | php - curl --show-error --silent https://getcomposer.org/installer | php
- php composer.phar install - php composer.phar install
test: test:
script: script:
- vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never - vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never
``` ```
### Caching Python dependencies ### Caching Python dependencies
...@@ -301,9 +301,9 @@ before_script: ...@@ -301,9 +301,9 @@ before_script:
test: test:
script: script:
- python setup.py test - python setup.py test
- pip install flake8 - pip install flake8
- flake8 . - flake8 .
``` ```
### Caching Ruby dependencies ### Caching Ruby dependencies
...@@ -330,7 +330,7 @@ before_script: ...@@ -330,7 +330,7 @@ before_script:
rspec: rspec:
script: script:
- rspec spec - rspec spec
``` ```
### Caching Go dependencies ### Caching Go dependencies
...@@ -354,7 +354,7 @@ test: ...@@ -354,7 +354,7 @@ test:
image: golang:1.13 image: golang:1.13
extends: .go-cache extends: .go-cache
script: script:
- go test ./... -v -short - go test ./... -v -short
``` ```
## Availability of the cache ## Availability of the cache
...@@ -391,28 +391,28 @@ stages: ...@@ -391,28 +391,28 @@ stages:
```yaml ```yaml
stages: stages:
- build - build
- test - test
before_script: before_script:
- echo "Hello" - echo "Hello"
job A: job A:
stage: build stage: build
script: script:
- mkdir vendor/ - mkdir vendor/
- echo "build" > vendor/hello.txt - echo "build" > vendor/hello.txt
cache: cache:
key: build-cache key: build-cache
paths: paths:
- vendor/ - vendor/
after_script: after_script:
- echo "World" - echo "World"
job B: job B:
stage: test stage: test
script: script:
- cat vendor/hello.txt - cat vendor/hello.txt
cache: cache:
key: build-cache key: build-cache
``` ```
...@@ -483,8 +483,8 @@ cache when the pipeline is run for a second time. ...@@ -483,8 +483,8 @@ cache when the pipeline is run for a second time.
```yaml ```yaml
stages: stages:
- build - build
- test - test
job A: job A:
stage: build stage: build
...@@ -492,7 +492,7 @@ job A: ...@@ -492,7 +492,7 @@ job A:
cache: cache:
key: same-key key: same-key
paths: paths:
- public/ - public/
job B: job B:
stage: test stage: test
...@@ -500,7 +500,7 @@ job B: ...@@ -500,7 +500,7 @@ job B:
cache: cache:
key: same-key key: same-key
paths: paths:
- vendor/ - vendor/
``` ```
1. `job A` runs. 1. `job A` runs.
...@@ -520,8 +520,8 @@ will be different): ...@@ -520,8 +520,8 @@ will be different):
```yaml ```yaml
stages: stages:
- build - build
- test - test
job A: job A:
stage: build stage: build
...@@ -529,7 +529,7 @@ job A: ...@@ -529,7 +529,7 @@ job A:
cache: cache:
key: keyA key: keyA
paths: paths:
- vendor/ - vendor/
job B: job B:
stage: test stage: test
...@@ -537,7 +537,7 @@ job B: ...@@ -537,7 +537,7 @@ job B:
cache: cache:
key: keyB key: keyB
paths: paths:
- vendor/ - vendor/
``` ```
In that case, even if the `key` is different (no fear of overwriting), you In that case, even if the `key` is different (no fear of overwriting), you
......
...@@ -149,14 +149,14 @@ the job will fail: ...@@ -149,14 +149,14 @@ the job will fail:
```yaml ```yaml
job: job:
services: services:
- php:7 - php:7
- node:latest - node:latest
- golang:1.10 - golang:1.10
image: alpine:3.7 image: alpine:3.7
script: script:
- php -v - php -v
- node -v - node -v
- go version - go version
``` ```
If you need to have `php`, `node` and `go` available for your script, you should If you need to have `php`, `node` and `go` available for your script, you should
...@@ -176,7 +176,7 @@ You can then use for example the [tutum/wordpress](https://hub.docker.com/r/tutu ...@@ -176,7 +176,7 @@ You can then use for example the [tutum/wordpress](https://hub.docker.com/r/tutu
```yaml ```yaml
services: services:
- tutum/wordpress:latest - tutum/wordpress:latest
``` ```
If you don't [specify a service alias](#available-settings-for-services), If you don't [specify a service alias](#available-settings-for-services),
...@@ -219,7 +219,7 @@ default: ...@@ -219,7 +219,7 @@ default:
test: test:
script: script:
- bundle exec rake spec - bundle exec rake spec
``` ```
The image name must be in one of the following formats: The image name must be in one of the following formats:
...@@ -238,16 +238,16 @@ default: ...@@ -238,16 +238,16 @@ default:
test:2.6: test:2.6:
image: ruby:2.6 image: ruby:2.6
services: services:
- postgres:11.7 - postgres:11.7
script: script:
- bundle exec rake spec - bundle exec rake spec
test:2.7: test:2.7:
image: ruby:2.7 image: ruby:2.7
services: services:
- postgres:12.2 - postgres:12.2
script: script:
- bundle exec rake spec - bundle exec rake spec
``` ```
Or you can pass some [extended configuration options](#extended-docker-configuration-options) Or you can pass some [extended configuration options](#extended-docker-configuration-options)
...@@ -260,17 +260,17 @@ default: ...@@ -260,17 +260,17 @@ default:
entrypoint: ["/bin/bash"] entrypoint: ["/bin/bash"]
services: services:
- name: my-postgres:11.7 - name: my-postgres:11.7
alias: db-postgres alias: db-postgres
entrypoint: ["/usr/local/bin/db-postgres"] entrypoint: ["/usr/local/bin/db-postgres"]
command: ["start"] command: ["start"]
before_script: before_script:
- bundle install - bundle install
test: test:
script: script:
- bundle exec rake spec - bundle exec rake spec
``` ```
## Passing environment variables to services ## Passing environment variables to services
...@@ -292,21 +292,21 @@ variables: ...@@ -292,21 +292,21 @@ variables:
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --data-checksums" POSTGRES_INITDB_ARGS: "--encoding=UTF8 --data-checksums"
services: services:
- name: postgres:11.7 - name: postgres:11.7
alias: db alias: db
entrypoint: ["docker-entrypoint.sh"] entrypoint: ["docker-entrypoint.sh"]
command: ["postgres"] command: ["postgres"]
image: image:
name: ruby:2.6 name: ruby:2.6
entrypoint: ["/bin/bash"] entrypoint: ["/bin/bash"]
before_script: before_script:
- bundle install - bundle install
test: test:
script: script:
- bundle exec rake spec - bundle exec rake spec
``` ```
## Extended Docker configuration options ## Extended Docker configuration options
...@@ -330,8 +330,8 @@ For example, the following two definitions are equal: ...@@ -330,8 +330,8 @@ For example, the following two definitions are equal:
image: "registry.example.com/my/image:latest" image: "registry.example.com/my/image:latest"
services: services:
- postgresql:9.4 - postgresql:9.4
- redis:latest - redis:latest
``` ```
1. Using a map as an option to `image` and `services`. The use of `image:name` is 1. Using a map as an option to `image` and `services`. The use of `image:name` is
...@@ -342,8 +342,8 @@ For example, the following two definitions are equal: ...@@ -342,8 +342,8 @@ For example, the following two definitions are equal:
name: "registry.example.com/my/image:latest" name: "registry.example.com/my/image:latest"
services: services:
- name: postgresql:9.4 - name: postgresql:9.4
- name: redis:latest - name: redis:latest
``` ```
### Available settings for `image` ### Available settings for `image`
...@@ -378,8 +378,8 @@ would not work properly: ...@@ -378,8 +378,8 @@ would not work properly:
```yaml ```yaml
services: services:
- mysql:latest - mysql:latest
- mysql:latest - mysql:latest
``` ```
The Runner would start two containers using the `mysql:latest` image, but both The Runner would start two containers using the `mysql:latest` image, but both
...@@ -392,10 +392,10 @@ look like: ...@@ -392,10 +392,10 @@ look like:
```yaml ```yaml
services: services:
- name: mysql:latest - name: mysql:latest
alias: mysql-1 alias: mysql-1
- name: mysql:latest - name: mysql:latest
alias: mysql-2 alias: mysql-2
``` ```
The Runner will still start two containers using the `mysql:latest` image, The Runner will still start two containers using the `mysql:latest` image,
...@@ -427,7 +427,7 @@ CMD ["/usr/bin/super-sql", "run"] ...@@ -427,7 +427,7 @@ CMD ["/usr/bin/super-sql", "run"]
# .gitlab-ci.yml # .gitlab-ci.yml
services: services:
- my-super-sql:latest - my-super-sql:latest
``` ```
After the new extended Docker configuration options, you can now simply After the new extended Docker configuration options, you can now simply
...@@ -437,8 +437,8 @@ set a `command` in `.gitlab-ci.yml`, like: ...@@ -437,8 +437,8 @@ set a `command` in `.gitlab-ci.yml`, like:
# .gitlab-ci.yml # .gitlab-ci.yml
services: services:
- name: super/sql:latest - name: super/sql:latest
command: ["/usr/bin/super-sql", "run"] command: ["/usr/bin/super-sql", "run"]
``` ```
As you can see, the syntax of `command` is similar to [Dockerfile's `CMD`](https://docs.docker.com/engine/reference/builder/#cmd). As you can see, the syntax of `command` is similar to [Dockerfile's `CMD`](https://docs.docker.com/engine/reference/builder/#cmd).
......
...@@ -94,7 +94,7 @@ deploy_staging: ...@@ -94,7 +94,7 @@ deploy_staging:
name: staging name: staging
url: https://staging.example.com url: https://staging.example.com
only: only:
- master - master
``` ```
We have defined three [stages](../yaml/README.md#stages): We have defined three [stages](../yaml/README.md#stages):
...@@ -259,7 +259,7 @@ deploy_staging: ...@@ -259,7 +259,7 @@ deploy_staging:
name: staging name: staging
url: https://staging.example.com url: https://staging.example.com
only: only:
- master - master
deploy_prod: deploy_prod:
stage: deploy stage: deploy
...@@ -270,7 +270,7 @@ deploy_prod: ...@@ -270,7 +270,7 @@ deploy_prod:
url: https://example.com url: https://example.com
when: manual when: manual
only: only:
- master - master
``` ```
The `when: manual` action: The `when: manual` action:
...@@ -402,7 +402,7 @@ deploy: ...@@ -402,7 +402,7 @@ deploy:
kubernetes: kubernetes:
namespace: production namespace: production
only: only:
- master - master
``` ```
When deploying to a Kubernetes cluster using GitLab's Kubernetes integration, When deploying to a Kubernetes cluster using GitLab's Kubernetes integration,
...@@ -483,7 +483,7 @@ deploy_staging: ...@@ -483,7 +483,7 @@ deploy_staging:
name: staging name: staging
url: https://staging.example.com url: https://staging.example.com
only: only:
- master - master
deploy_prod: deploy_prod:
stage: deploy stage: deploy
...@@ -494,7 +494,7 @@ deploy_prod: ...@@ -494,7 +494,7 @@ deploy_prod:
url: https://example.com url: https://example.com
when: manual when: manual
only: only:
- master - master
``` ```
A more realistic example would also include copying files to a location where a A more realistic example would also include copying files to a location where a
......
...@@ -61,10 +61,10 @@ content: ...@@ -61,10 +61,10 @@ content:
```yaml ```yaml
--- ---
applications: applications:
- name: gitlab-hello-world - name: gitlab-hello-world
random-route: true random-route: true
memory: 1G memory: 1G
path: target/demo-0.0.1-SNAPSHOT.jar path: target/demo-0.0.1-SNAPSHOT.jar
``` ```
## Configure GitLab CI/CD to deploy your application ## Configure GitLab CI/CD to deploy your application
...@@ -96,11 +96,11 @@ build: ...@@ -96,11 +96,11 @@ build:
production: production:
stage: deploy stage: deploy
script: script:
- curl --location "https://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar zx - curl --location "https://cli.run.pivotal.io/stable?release=linux64-binary&source=github" | tar zx
- ./cf login -u $CF_USERNAME -p $CF_PASSWORD -a api.run.pivotal.io - ./cf login -u $CF_USERNAME -p $CF_PASSWORD -a api.run.pivotal.io
- ./cf push - ./cf push
only: only:
- master - master
``` ```
We've used the `java:8` [Docker We've used the `java:8` [Docker
......
...@@ -45,8 +45,8 @@ All possible parameters can be found here: <https://github.com/travis-ci/dpl#her ...@@ -45,8 +45,8 @@ All possible parameters can be found here: <https://github.com/travis-ci/dpl#her
staging: staging:
stage: deploy stage: deploy
script: script:
- gem install dpl - gem install dpl
- dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY - dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY
``` ```
In the above example we use Dpl to deploy `my-app-staging` to Heroku server with API key stored in `HEROKU_STAGING_API_KEY` secure variable. In the above example we use Dpl to deploy `my-app-staging` to Heroku server with API key stored in `HEROKU_STAGING_API_KEY` secure variable.
...@@ -64,12 +64,12 @@ You will have to install it: ...@@ -64,12 +64,12 @@ You will have to install it:
staging: staging:
stage: deploy stage: deploy
script: script:
- apt-get update -yq - apt-get update -yq
- apt-get install -y ruby-dev - apt-get install -y ruby-dev
- gem install dpl - gem install dpl
- dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY - dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY
only: only:
- master - master
``` ```
The first line `apt-get update -yq` updates the list of available packages, The first line `apt-get update -yq` updates the list of available packages,
...@@ -89,18 +89,18 @@ The final `.gitlab-ci.yml` for that setup would look like this: ...@@ -89,18 +89,18 @@ The final `.gitlab-ci.yml` for that setup would look like this:
staging: staging:
stage: deploy stage: deploy
script: script:
- gem install dpl - gem install dpl
- dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY - dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY
only: only:
- master - master
production: production:
stage: deploy stage: deploy
script: script:
- gem install dpl - gem install dpl
- dpl --provider=heroku --app=my-app-production --api-key=$HEROKU_PRODUCTION_API_KEY - dpl --provider=heroku --app=my-app-production --api-key=$HEROKU_PRODUCTION_API_KEY
only: only:
- tags - tags
``` ```
We created two deploy jobs that are executed on different events: We created two deploy jobs that are executed on different events:
......
...@@ -150,7 +150,7 @@ before_script: ...@@ -150,7 +150,7 @@ before_script:
stage_deploy: stage_deploy:
artifacts: artifacts:
paths: paths:
- build/ - build/
only: only:
- dev - dev
script: script:
......
...@@ -274,19 +274,19 @@ just pack them up in the cache. Here is the full `build` job: ...@@ -274,19 +274,19 @@ just pack them up in the cache. Here is the full `build` job:
```yaml ```yaml
build: build:
stage: build stage: build
script: script:
- npm i gulp -g - npm i gulp -g
- npm i - npm i
- gulp - gulp
- gulp build-test - gulp build-test
cache: cache:
policy: push policy: push
paths: paths:
- node_modules - node_modules
artifacts: artifacts:
paths: paths:
- built - built
``` ```
### Test your game with GitLab CI/CD ### Test your game with GitLab CI/CD
...@@ -301,18 +301,18 @@ Following the YAML structure, the `test` job should look like this: ...@@ -301,18 +301,18 @@ Following the YAML structure, the `test` job should look like this:
```yaml ```yaml
test: test:
stage: test stage: test
script: script:
- npm i gulp -g - npm i gulp -g
- npm i - npm i
- gulp run-test - gulp run-test
cache: cache:
policy: push policy: push
paths: paths:
- node_modules/ - node_modules/
artifacts: artifacts:
paths: paths:
- built/ - built/
``` ```
We have added unit tests for a `Weapon` class that shoots on a specified interval. We have added unit tests for a `Weapon` class that shoots on a specified interval.
...@@ -325,33 +325,33 @@ Our entire `.gitlab-ci.yml` file should now look like this: ...@@ -325,33 +325,33 @@ Our entire `.gitlab-ci.yml` file should now look like this:
image: node:10 image: node:10
build: build:
stage: build stage: build
script: script:
- npm i gulp -g - npm i gulp -g
- npm i - npm i
- gulp - gulp
- gulp build-test - gulp build-test
cache: cache:
policy: push policy: push
paths: paths:
- node_modules/ - node_modules/
artifacts: artifacts:
paths: paths:
- built/ - built/
test: test:
stage: test stage: test
script: script:
- npm i gulp -g - npm i gulp -g
- npm i - npm i
- gulp run-test - gulp run-test
cache: cache:
policy: pull policy: pull
paths: paths:
- node_modules/ - node_modules/
artifacts: artifacts:
paths: paths:
- built/ - built/
``` ```
### Run your CI/CD pipeline ### Run your CI/CD pipeline
...@@ -445,18 +445,18 @@ trigger the `deploy` job of our pipeline. Put these together to get the followin ...@@ -445,18 +445,18 @@ trigger the `deploy` job of our pipeline. Put these together to get the followin
```yaml ```yaml
deploy: deploy:
stage: deploy stage: deploy
variables: variables:
AWS_ACCESS_KEY_ID: "$AWS_KEY_ID" AWS_ACCESS_KEY_ID: "$AWS_KEY_ID"
AWS_SECRET_ACCESS_KEY: "$AWS_KEY_SECRET" AWS_SECRET_ACCESS_KEY: "$AWS_KEY_SECRET"
script: script:
- apt-get update - apt-get update
- apt-get install -y python3-dev python3-pip - apt-get install -y python3-dev python3-pip
- easy_install3 -U pip - easy_install3 -U pip
- pip3 install --upgrade awscli - pip3 install --upgrade awscli
- aws s3 sync ./built s3://gitlab-game-demo --region "us-east-1" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --cache-control "no-cache, no-store, must-revalidate" --delete - aws s3 sync ./built s3://gitlab-game-demo --region "us-east-1" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --cache-control "no-cache, no-store, must-revalidate" --delete
only: only:
- master - master
``` ```
Be sure to update the region and S3 URL in that last script command to fit your setup. Be sure to update the region and S3 URL in that last script command to fit your setup.
...@@ -466,46 +466,46 @@ Our final configuration file `.gitlab-ci.yml` looks like: ...@@ -466,46 +466,46 @@ Our final configuration file `.gitlab-ci.yml` looks like:
image: node:10 image: node:10
build: build:
stage: build stage: build
script: script:
- npm i gulp -g - npm i gulp -g
- npm i - npm i
- gulp - gulp
- gulp build-test - gulp build-test
cache: cache:
policy: push policy: push
paths: paths:
- node_modules/ - node_modules/
artifacts: artifacts:
paths: paths:
- built/ - built/
test: test:
stage: test stage: test
script: script:
- npm i gulp -g - npm i gulp -g
- gulp run-test - gulp run-test
cache: cache:
policy: pull policy: pull
paths: paths:
- node_modules/ - node_modules/
artifacts: artifacts:
paths: paths:
- built/ - built/
deploy: deploy:
stage: deploy stage: deploy
variables: variables:
AWS_ACCESS_KEY_ID: "$AWS_KEY_ID" AWS_ACCESS_KEY_ID: "$AWS_KEY_ID"
AWS_SECRET_ACCESS_KEY: "$AWS_KEY_SECRET" AWS_SECRET_ACCESS_KEY: "$AWS_KEY_SECRET"
script: script:
- apt-get update - apt-get update
- apt-get install -y python3-dev python3-pip - apt-get install -y python3-dev python3-pip
- easy_install3 -U pip - easy_install3 -U pip
- pip3 install --upgrade awscli - pip3 install --upgrade awscli
- aws s3 sync ./built s3://gitlab-game-demo --region "us-east-1" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --cache-control "no-cache, no-store, must-revalidate" --delete - aws s3 sync ./built s3://gitlab-game-demo --region "us-east-1" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --cache-control "no-cache, no-store, must-revalidate" --delete
only: only:
- master - master
``` ```
## Conclusion ## Conclusion
......
...@@ -76,7 +76,7 @@ environment, let's add it in `.gitlab-ci.yml`: ...@@ -76,7 +76,7 @@ environment, let's add it in `.gitlab-ci.yml`:
... ...
before_script: before_script:
- bash ci/docker_install.sh > /dev/null - bash ci/docker_install.sh > /dev/null
... ...
``` ```
...@@ -88,7 +88,7 @@ Last step, run the actual tests using `phpunit`: ...@@ -88,7 +88,7 @@ Last step, run the actual tests using `phpunit`:
test:app: test:app:
script: script:
- phpunit --configuration phpunit_myapp.xml - phpunit --configuration phpunit_myapp.xml
... ...
``` ```
...@@ -104,11 +104,11 @@ image: php:5.6 ...@@ -104,11 +104,11 @@ 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:
script: script:
- phpunit --configuration phpunit_myapp.xml - phpunit --configuration phpunit_myapp.xml
``` ```
### Test against different PHP versions in Docker builds ### Test against different PHP versions in Docker builds
...@@ -119,19 +119,19 @@ with a different Docker image version and the runner will do the rest: ...@@ -119,19 +119,19 @@ 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
test:5.6: test:5.6:
image: php:5.6 image: php:5.6
script: script:
- phpunit --configuration phpunit_myapp.xml - phpunit --configuration phpunit_myapp.xml
# We test PHP7.0 (good luck with that) # We test PHP7.0 (good luck with that)
test:7.0: test:7.0:
image: php:7.0 image: php:7.0
script: script:
- phpunit --configuration phpunit_myapp.xml - phpunit --configuration phpunit_myapp.xml
``` ```
### Custom PHP configuration in Docker builds ### Custom PHP configuration in Docker builds
...@@ -142,7 +142,7 @@ add a `before_script` action: ...@@ -142,7 +142,7 @@ add a `before_script` action:
```yaml ```yaml
before_script: before_script:
- cp my_php.ini /usr/local/etc/php/conf.d/test.ini - cp my_php.ini /usr/local/etc/php/conf.d/test.ini
``` ```
Of course, `my_php.ini` must be present in the root directory of your repository. Of course, `my_php.ini` must be present in the root directory of your repository.
...@@ -166,7 +166,7 @@ Next, add the following snippet to your `.gitlab-ci.yml`: ...@@ -166,7 +166,7 @@ Next, add the following snippet to your `.gitlab-ci.yml`:
```yaml ```yaml
test:app: test:app:
script: script:
- phpunit --configuration phpunit_myapp.xml - phpunit --configuration phpunit_myapp.xml
``` ```
Finally, push to GitLab and let the tests begin! Finally, push to GitLab and let the tests begin!
...@@ -217,11 +217,11 @@ you can use [atoum](https://github.com/atoum/atoum): ...@@ -217,11 +217,11 @@ you can use [atoum](https://github.com/atoum/atoum):
```yaml ```yaml
before_script: before_script:
- wget http://downloads.atoum.org/nightly/mageekguy.atoum.phar - wget http://downloads.atoum.org/nightly/mageekguy.atoum.phar
test:atoum: test:atoum:
script: script:
- php mageekguy.atoum.phar - php mageekguy.atoum.phar
``` ```
### Using Composer ### Using Composer
...@@ -238,16 +238,16 @@ following in your `.gitlab-ci.yml`: ...@@ -238,16 +238,16 @@ following in your `.gitlab-ci.yml`:
# your git repository. # your git repository.
cache: cache:
paths: paths:
- 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
... ...
``` ```
......
...@@ -23,32 +23,32 @@ stages: ...@@ -23,32 +23,32 @@ stages:
test: test:
stage: test stage: test
script: script:
# this configures Django application to use attached postgres database that is run on `postgres` host # this configures Django application to use attached postgres database that is run on `postgres` host
- export DATABASE_URL=postgres://postgres:@postgres:5432/python-test-app - export DATABASE_URL=postgres://postgres:@postgres:5432/python-test-app
- apt-get update -qy - apt-get update -qy
- apt-get install -y python-dev python-pip - apt-get install -y python-dev python-pip
- pip install -r requirements.txt - pip install -r requirements.txt
- python manage.py test - python manage.py test
staging: staging:
stage: deploy stage: deploy
script: script:
- apt-get update -qy - apt-get update -qy
- apt-get install -y ruby-dev - apt-get install -y ruby-dev
- gem install dpl - gem install dpl
- dpl --provider=heroku --app=gitlab-ci-python-test-staging --api-key=$HEROKU_STAGING_API_KEY - dpl --provider=heroku --app=gitlab-ci-python-test-staging --api-key=$HEROKU_STAGING_API_KEY
only: only:
- master - master
production: production:
stage: deploy stage: deploy
script: script:
- apt-get update -qy - apt-get update -qy
- apt-get install -y ruby-dev - apt-get install -y ruby-dev
- gem install dpl - gem install dpl
- dpl --provider=heroku --app=gitlab-ci-python-test-prod --api-key=$HEROKU_PRODUCTION_API_KEY - dpl --provider=heroku --app=gitlab-ci-python-test-prod --api-key=$HEROKU_PRODUCTION_API_KEY
only: only:
- tags - tags
``` ```
This project has three jobs: This project has three jobs:
......
...@@ -181,8 +181,8 @@ pdf: ...@@ -181,8 +181,8 @@ pdf:
script: xelatex mycv.tex script: xelatex mycv.tex
artifacts: artifacts:
paths: paths:
- ./mycv.pdf - ./mycv.pdf
- ./output/ - ./output/
expire_in: 1 week expire_in: 1 week
``` ```
......
...@@ -65,19 +65,19 @@ build: ...@@ -65,19 +65,19 @@ build:
stage: build stage: build
script: ./build script: ./build
only: only:
- master - master
test: test:
stage: test stage: test
script: ./test script: ./test
only: only:
- merge_requests - merge_requests
deploy: deploy:
stage: deploy stage: deploy
script: ./deploy script: ./deploy
only: only:
- master - master
``` ```
#### Excluding certain jobs #### Excluding certain jobs
......
...@@ -250,14 +250,14 @@ image: node:latest ...@@ -250,14 +250,14 @@ image: node:latest
cache: cache:
key: $CI_COMMIT_REF_SLUG key: $CI_COMMIT_REF_SLUG
paths: paths:
- .npm/ - .npm/
before_script: before_script:
- npm ci --cache .npm --prefer-offline - npm ci --cache .npm --prefer-offline
test_async: test_async:
script: script:
- node ./specs/start.js ./specs/async.spec.js - node ./specs/start.js ./specs/async.spec.js
``` ```
## Contexts and variables ## Contexts and variables
......
...@@ -348,17 +348,17 @@ For example, these three jobs will be in a group named `build ruby`: ...@@ -348,17 +348,17 @@ For example, these three jobs will be in a group named `build ruby`:
build ruby 1/3: build ruby 1/3:
stage: build stage: build
script: script:
- echo "ruby1" - echo "ruby1"
build ruby 2/3: build ruby 2/3:
stage: build stage: build
script: script:
- echo "ruby2" - echo "ruby2"
build ruby 3/3: build ruby 3/3:
stage: build stage: build
script: script:
- echo "ruby3" - echo "ruby3"
``` ```
In the pipeline, the result is a group named `build ruby` with three jobs: In the pipeline, the result is a group named `build ruby` with three jobs:
......
...@@ -33,7 +33,7 @@ pdf: ...@@ -33,7 +33,7 @@ pdf:
script: xelatex mycv.tex script: xelatex mycv.tex
artifacts: artifacts:
paths: paths:
- mycv.pdf - mycv.pdf
expire_in: 1 week expire_in: 1 week
``` ```
...@@ -87,8 +87,8 @@ Below is an example of collecting a JUnit XML file from Ruby's RSpec test tool: ...@@ -87,8 +87,8 @@ Below is an example of collecting a JUnit XML file from Ruby's RSpec test tool:
rspec: rspec:
stage: test stage: test
script: script:
- bundle install - bundle install
- rspec --format RspecJunitFormatter --out rspec.xml - rspec --format RspecJunitFormatter --out rspec.xml
artifacts: artifacts:
reports: reports:
junit: rspec.xml junit: rspec.xml
......
...@@ -62,9 +62,9 @@ and it creates a dependent pipeline relation visible on the ...@@ -62,9 +62,9 @@ and it creates a dependent pipeline relation visible on the
build_docs: build_docs:
stage: deploy stage: deploy
script: script:
- curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.example.com/api/v4/projects/9/trigger/pipeline - curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.example.com/api/v4/projects/9/trigger/pipeline
only: only:
- tags - tags
``` ```
Pipelines triggered that way also expose a special variable: Pipelines triggered that way also expose a special variable:
...@@ -86,11 +86,11 @@ build_submodule: ...@@ -86,11 +86,11 @@ build_submodule:
image: debian image: debian
stage: test stage: test
script: script:
- apt update && apt install -y unzip - apt update && apt install -y unzip
- curl --location --output artifacts.zip "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test&job_token=$CI_JOB_TOKEN" - curl --location --output artifacts.zip "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test&job_token=$CI_JOB_TOKEN"
- unzip artifacts.zip - unzip artifacts.zip
only: only:
- tags - tags
``` ```
This allows you to use that for multi-project pipelines and download artifacts This allows you to use that for multi-project pipelines and download artifacts
...@@ -179,9 +179,9 @@ need to add in project A's `.gitlab-ci.yml`: ...@@ -179,9 +179,9 @@ need to add in project A's `.gitlab-ci.yml`:
build_docs: build_docs:
stage: deploy stage: deploy
script: script:
- "curl --request POST --form token=TOKEN --form ref=master https://gitlab.example.com/api/v4/projects/9/trigger/pipeline" - "curl --request POST --form token=TOKEN --form ref=master https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"
only: only:
- tags - tags
``` ```
This means that whenever a new tag is pushed on project A, the job will run and the This means that whenever a new tag is pushed on project A, the job will run and the
...@@ -235,24 +235,24 @@ variable is non-zero, `make upload` is run. ...@@ -235,24 +235,24 @@ variable is non-zero, `make upload` is run.
```yaml ```yaml
stages: stages:
- test - test
- build - build
- package - package
run_tests: run_tests:
stage: test stage: test
script: script:
- make test - make test
build_package: build_package:
stage: build stage: build
script: script:
- make build - make build
upload_package: upload_package:
stage: package stage: package
script: script:
- if [ -n "${UPLOAD_TO_S3}" ]; then make upload; fi - if [ -n "${UPLOAD_TO_S3}" ]; then make upload; fi
``` ```
You can then trigger a rebuild while you pass the `UPLOAD_TO_S3` variable You can then trigger a rebuild while you pass the `UPLOAD_TO_S3` variable
......
...@@ -3744,9 +3744,9 @@ Combining the individual examples given above for `release`, we'd have the follo ...@@ -3744,9 +3744,9 @@ Combining the individual examples given above for `release`, we'd have the follo
```yaml ```yaml
stages: stages:
- build - build
- test - test
- release-stg - release-stg
release_job: release_job:
stage: release stage: release
...@@ -4332,11 +4332,11 @@ Example: ...@@ -4332,11 +4332,11 @@ Example:
```yaml ```yaml
.something_before: &something_before .something_before: &something_before
- echo 'something before' - echo 'something before'
.something_after: &something_after .something_after: &something_after
- echo 'something after' - echo 'something after'
- echo 'another thing after' - echo 'another thing after'
job_name: job_name:
before_script: before_script:
...@@ -4358,7 +4358,7 @@ For example: ...@@ -4358,7 +4358,7 @@ For example:
```yaml ```yaml
.something: &something .something: &something
- echo 'something' - echo 'something'
job_name: job_name:
script: script:
......
...@@ -152,9 +152,9 @@ Suppose we have the `content/_data/versions.yaml` file with the content: ...@@ -152,9 +152,9 @@ Suppose we have the `content/_data/versions.yaml` file with the content:
```yaml ```yaml
versions: versions:
- 10.6 - 10.6
- 10.5 - 10.5
- 10.4 - 10.4
``` ```
We can then loop over the `versions` array with something like: We can then loop over the `versions` array with something like:
......
...@@ -11,16 +11,16 @@ The requirement for adding a new metric is to make each query to have an unique ...@@ -11,16 +11,16 @@ The requirement for adding a new metric is to make each query to have an unique
```yaml ```yaml
- group: Response metrics (NGINX Ingress) - group: Response metrics (NGINX Ingress)
metrics: metrics:
- title: "Throughput" - title: "Throughput"
y_axis: y_axis:
name: "Requests / Sec" name: "Requests / Sec"
format: "number" format: "number"
precision: 2 precision: 2
queries: queries:
- id: response_metrics_nginx_ingress_throughput_status_code - id: response_metrics_nginx_ingress_throughput_status_code
query_range: 'sum(rate(nginx_upstream_responses_total{upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[2m])) by (status_code)' query_range: 'sum(rate(nginx_upstream_responses_total{upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[2m])) by (status_code)'
unit: req / sec unit: req / sec
label: Status Code label: Status Code
``` ```
### Update existing metrics ### Update existing metrics
......
...@@ -451,7 +451,7 @@ QA testing: ...@@ -451,7 +451,7 @@ QA testing:
environment: environment:
name: qa name: qa
script: script:
- deploy foo - deploy foo
``` ```
The track `foo` being referenced must also be defined in the application's Helm chart, like: The track `foo` being referenced must also be defined in the application's Helm chart, like:
......
...@@ -469,16 +469,16 @@ workers: ...@@ -469,16 +469,16 @@ workers:
sidekiq: sidekiq:
replicaCount: 1 replicaCount: 1
command: command:
- /bin/herokuish - /bin/herokuish
- procfile - procfile
- exec - exec
- sidekiq - sidekiq
preStopCommand: preStopCommand:
- /bin/herokuish - /bin/herokuish
- procfile - procfile
- exec - exec
- sidekiqctl - sidekiqctl
- quiet - quiet
terminationGracePeriodSeconds: 60 terminationGracePeriodSeconds: 60
``` ```
...@@ -524,12 +524,12 @@ networkPolicy: ...@@ -524,12 +524,12 @@ networkPolicy:
matchLabels: matchLabels:
app.gitlab.com/env: staging app.gitlab.com/env: staging
ingress: ingress:
- from: - from:
- podSelector: - podSelector:
matchLabels: {} matchLabels: {}
- namespaceSelector: - namespaceSelector:
matchLabels: matchLabels:
app.gitlab.com/managed_by: gitlab app.gitlab.com/managed_by: gitlab
``` ```
For more information on installing Network Policies, see For more information on installing Network Policies, see
......
...@@ -55,18 +55,18 @@ export REGION=us-central1 # the GCP region where the GKE cluster is provisioned. ...@@ -55,18 +55,18 @@ export REGION=us-central1 # the GCP region where the GKE cluster is provisioned.
labels: labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true" rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules: rules:
- apiGroups: - apiGroups:
- database.crossplane.io - database.crossplane.io
resources: resources:
- postgresqlinstances - postgresqlinstances
verbs: verbs:
- get - get
- list - list
- create - create
- update - update
- delete - delete
- patch - patch
- watch - watch
``` ```
1. Apply the cluster role to the cluster: 1. Apply the cluster role to the cluster:
......
...@@ -97,7 +97,7 @@ Development, Staging, and Production cluster respectively. ...@@ -97,7 +97,7 @@ Development, Staging, and Production cluster respectively.
```yaml ```yaml
stages: stages:
- deploy - deploy
configure development cluster: configure development cluster:
stage: deploy stage: deploy
......
...@@ -337,9 +337,9 @@ Windows Shared Runners: ...@@ -337,9 +337,9 @@ Windows Shared Runners:
```yaml ```yaml
.shared_windows_runners: .shared_windows_runners:
tags: tags:
- shared-windows - shared-windows
- windows - windows
- windows-1809 - windows-1809
stages: stages:
- build - build
...@@ -352,17 +352,17 @@ before_script: ...@@ -352,17 +352,17 @@ before_script:
build: build:
extends: extends:
- .shared_windows_runners - .shared_windows_runners
stage: build stage: build
script: script:
- echo "running scripts in the build job" - echo "running scripts in the build job"
test: test:
extends: extends:
- .shared_windows_runners - .shared_windows_runners
stage: test stage: test
script: script:
- echo "running scripts in the test job" - echo "running scripts in the test job"
``` ```
#### Limitations and known issues #### Limitations and known issues
......
...@@ -127,8 +127,8 @@ And the following environments are set in [`.gitlab-ci.yml`](../../../ci/yaml/RE ...@@ -127,8 +127,8 @@ And the following environments are set in [`.gitlab-ci.yml`](../../../ci/yaml/RE
```yaml ```yaml
stages: stages:
- test - test
- deploy - deploy
test: test:
stage: test stage: test
......
...@@ -227,9 +227,9 @@ To add a Kubernetes cluster to your project, group, or instance: ...@@ -227,9 +227,9 @@ To add a Kubernetes cluster to your project, group, or instance:
kind: ClusterRole kind: ClusterRole
name: cluster-admin name: cluster-admin
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: gitlab-admin name: gitlab-admin
namespace: kube-system namespace: kube-system
``` ```
1. Apply the service account and cluster role binding to your cluster: 1. Apply the service account and cluster role binding to your cluster:
......
...@@ -99,8 +99,8 @@ And the following environments are set in ...@@ -99,8 +99,8 @@ And the following environments are set in
```yaml ```yaml
stages: stages:
- test - test
- deploy - deploy
test: test:
stage: test stage: test
......
...@@ -392,29 +392,19 @@ want to store your package: ...@@ -392,29 +392,19 @@ want to store your package:
image: python:latest image: python:latest
stages: stages:
- deploy - deploy
production: production:
stage: deploy stage: deploy
before_script: before_script:
- pip3 install awscli --upgrade - pip3 install awscli --upgrade
- pip3 install aws-sam-cli --upgrade - pip3 install aws-sam-cli --upgrade
script: script:
- sam build - sam build
- sam package --output-template-file packaged.yaml --s3-bucket <S3_bucket_name> - sam package --output-template-file packaged.yaml --s3-bucket <S3_bucket_name>
- sam deploy --template-file packaged.yaml --stack-name gitlabpoc --s3-bucket <S3_bucket_name> --capabilities CAPABILITY_IAM --region us-east-1 - sam deploy --template-file packaged.yaml --stack-name gitlabpoc --s3-bucket <S3_bucket_name> --capabilities CAPABILITY_IAM --region us-east-1
environment: production environment: production
``` ```
Let’s examine the configuration file more closely: Let’s examine the configuration file more closely:
......
...@@ -143,24 +143,24 @@ You must do the following: ...@@ -143,24 +143,24 @@ You must do the following:
labels: labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true" rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules: rules:
- apiGroups: - apiGroups:
- serving.knative.dev - serving.knative.dev
resources: resources:
- configurations - configurations
- configurationgenerations - configurationgenerations
- routes - routes
- revisions - revisions
- revisionuids - revisionuids
- autoscalers - autoscalers
- services - services
verbs: verbs:
- get - get
- list - list
- create - create
- update - update
- delete - delete
- patch - patch
- watch - watch
``` ```
Then run the following command: Then run the following command:
......
...@@ -290,17 +290,17 @@ For example: ...@@ -290,17 +290,17 @@ For example:
panel_groups: panel_groups:
- group: 'Group Title' - group: 'Group Title'
panels: panels:
- type: area-chart - type: area-chart
title: "Chart Title" title: "Chart Title"
y_label: "Y-Axis" y_label: "Y-Axis"
y_axis: y_axis:
format: number format: number
precision: 0 precision: 0
metrics: metrics:
- id: my_metric_id - id: my_metric_id
query_range: 'http_requests_total' query_range: 'http_requests_total'
label: "Instance: {{instance}}, method: {{method}}" label: "Instance: {{instance}}, method: {{method}}"
unit: "count" unit: "count"
``` ```
The above sample dashboard would display a single area chart. Each file should The above sample dashboard would display a single area chart. Each file should
...@@ -641,25 +641,24 @@ To add a stacked column panel type to a dashboard, look at the following sample ...@@ -641,25 +641,24 @@ To add a stacked column panel type to a dashboard, look at the following sample
dashboard: 'Dashboard title' dashboard: 'Dashboard title'
priority: 1 priority: 1
panel_groups: panel_groups:
- group: 'Group Title' - group: 'Group Title'
priority: 5 priority: 5
panels: panels:
- type: 'stacked-column' - type: 'stacked-column'
title: "Stacked column" title: "Stacked column"
y_label: "y label" y_label: "y label"
x_label: 'x label' x_label: 'x label'
metrics: metrics:
- id: memory_1 - id: memory_1
query_range: 'memory_query' query_range: 'memory_query'
label: "memory query 1" label: "memory query 1"
unit: "count" unit: "count"
series_name: 'group 1' series_name: 'group 1'
- id: memory_2 - id: memory_2
query_range: 'memory_query_2' query_range: 'memory_query_2'
label: "memory query 2" label: "memory query 2"
unit: "count" unit: "count"
series_name: 'group 2' series_name: 'group 2'
``` ```
![stacked column panel type](img/prometheus_dashboard_stacked_column_panel_type_v12_8.png) ![stacked column panel type](img/prometheus_dashboard_stacked_column_panel_type_v12_8.png)
...@@ -681,10 +680,10 @@ panel_groups: ...@@ -681,10 +680,10 @@ panel_groups:
- title: "Single Stat" - title: "Single Stat"
type: "single-stat" type: "single-stat"
metrics: metrics:
- id: 10 - id: 10
query: 'max(go_memstats_alloc_bytes{job="prometheus"})' query: 'max(go_memstats_alloc_bytes{job="prometheus"})'
unit: MB unit: MB
label: "Total" label: "Total"
``` ```
Note the following properties: Note the following properties:
...@@ -711,10 +710,10 @@ panel_groups: ...@@ -711,10 +710,10 @@ panel_groups:
type: "single-stat" type: "single-stat"
max_value: 100 max_value: 100
metrics: metrics:
- id: 10 - id: 10
query: 'max(go_memstats_alloc_bytes{job="prometheus"})' query: 'max(go_memstats_alloc_bytes{job="prometheus"})'
unit: '%' unit: '%'
label: "Total" label: "Total"
``` ```
For example, if you have a query value of `53.6`, adding `%` as the unit results in a single stat value of `53.6%`, but if the maximum expected value of the query is `120`, the value would be `44.6%`. Adding the `max_value` causes the correct percentage value to display. For example, if you have a query value of `53.6`, adding `%` as the unit results in a single stat value of `53.6%`, but if the maximum expected value of the query is `120`, the value would be `44.6%`. Adding the `max_value` causes the correct percentage value to display.
...@@ -733,10 +732,10 @@ panel_groups: ...@@ -733,10 +732,10 @@ panel_groups:
- title: "Heatmap" - title: "Heatmap"
type: "heatmap" type: "heatmap"
metrics: metrics:
- id: 10 - id: 10
query: 'sum(rate(nginx_upstream_responses_total{upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[60m])) by (status_code)' query: 'sum(rate(nginx_upstream_responses_total{upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[60m])) by (status_code)'
unit: req/sec unit: req/sec
label: "Status code" label: "Status code"
``` ```
Note the following properties: Note the following properties:
...@@ -846,11 +845,11 @@ templating: ...@@ -846,11 +845,11 @@ templating:
type: custom type: custom
options: options:
values: values:
- value: 'value option 1' # The value that will replace the variable in queries. - value: 'value option 1' # The value that will replace the variable in queries.
text: 'Option 1' # (Optional) Text that will appear in the UI dropdown. text: 'Option 1' # (Optional) Text that will appear in the UI dropdown.
- value: 'value_option_2' - value: 'value_option_2'
text: 'Option 2' text: 'Option 2'
default: true # (Optional) This option should be the default value of this variable. default: true # (Optional) This option should be the default value of this variable.
``` ```
##### `metric_label_values` variable type ##### `metric_label_values` variable type
...@@ -1030,10 +1029,10 @@ To send GitLab alert notifications, copy the *URL* and *Authorization Key* into ...@@ -1030,10 +1029,10 @@ To send GitLab alert notifications, copy the *URL* and *Authorization Key* into
receivers: receivers:
name: gitlab name: gitlab
webhook_configs: webhook_configs:
- http_config: - http_config:
bearer_token: 9e1cbfcd546896a9ea8be557caf13a76 bearer_token: 9e1cbfcd546896a9ea8be557caf13a76
send_resolved: true send_resolved: true
url: http://192.168.178.31:3001/root/manual_prometheus/prometheus/alerts/notify.json url: http://192.168.178.31:3001/root/manual_prometheus/prometheus/alerts/notify.json
... ...
``` ```
......
...@@ -101,9 +101,9 @@ with GitLab Pages: ...@@ -101,9 +101,9 @@ with GitLab Pages:
```yaml ```yaml
pages: pages:
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build - bundle exec jekyll build
``` ```
## Specify the `public` directory for output ## Specify the `public` directory for output
...@@ -116,9 +116,9 @@ Jekyll uses destination (`-d`) to specify an output directory for the built webs ...@@ -116,9 +116,9 @@ Jekyll uses destination (`-d`) to specify an output directory for the built webs
```yaml ```yaml
pages: pages:
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
``` ```
## Specify the `public` directory for artifacts ## Specify the `public` directory for artifacts
...@@ -130,12 +130,12 @@ in the `public` directory: ...@@ -130,12 +130,12 @@ in the `public` directory:
```yaml ```yaml
pages: pages:
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
artifacts: artifacts:
paths: paths:
- public - public
``` ```
Paste this into `.gitlab-ci.yml` file, so it now looks like this: Paste this into `.gitlab-ci.yml` file, so it now looks like this:
...@@ -145,12 +145,12 @@ image: ruby:2.7 ...@@ -145,12 +145,12 @@ image: ruby:2.7
pages: pages:
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
artifacts: artifacts:
paths: paths:
- public - public
``` ```
Now save and commit the `.gitlab-ci.yml` file. You can watch the pipeline run Now save and commit the `.gitlab-ci.yml` file. You can watch the pipeline run
...@@ -181,12 +181,12 @@ workflow: ...@@ -181,12 +181,12 @@ workflow:
pages: pages:
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
artifacts: artifacts:
paths: paths:
- public - public
``` ```
Then configure the pipeline to run the job for the master branch only. Then configure the pipeline to run the job for the master branch only.
...@@ -200,12 +200,12 @@ workflow: ...@@ -200,12 +200,12 @@ workflow:
pages: pages:
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
artifacts: artifacts:
paths: paths:
- public - public
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_COMMIT_BRANCH == "master"'
``` ```
...@@ -232,12 +232,12 @@ workflow: ...@@ -232,12 +232,12 @@ workflow:
pages: pages:
stage: deploy stage: deploy
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
artifacts: artifacts:
paths: paths:
- public - public
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_COMMIT_BRANCH == "master"'
``` ```
...@@ -255,24 +255,24 @@ workflow: ...@@ -255,24 +255,24 @@ workflow:
pages: pages:
stage: deploy stage: deploy
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
artifacts: artifacts:
paths: paths:
- public - public
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_COMMIT_BRANCH == "master"'
test: test:
stage: test stage: test
script: script:
- gem install bundler - gem install bundler
- bundle install - bundle install
- bundle exec jekyll build -d test - bundle exec jekyll build -d test
artifacts: artifacts:
paths: paths:
- test - test
rules: rules:
- if: '$CI_COMMIT_BRANCH != "master"' - if: '$CI_COMMIT_BRANCH != "master"'
``` ```
...@@ -310,20 +310,20 @@ before_script: ...@@ -310,20 +310,20 @@ before_script:
pages: pages:
stage: deploy stage: deploy
script: script:
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
artifacts: artifacts:
paths: paths:
- public - public
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_COMMIT_BRANCH == "master"'
test: test:
stage: test stage: test
script: script:
- bundle exec jekyll build -d test - bundle exec jekyll build -d test
artifacts: artifacts:
paths: paths:
- test - test
rules: rules:
- if: '$CI_COMMIT_BRANCH != "master"' - if: '$CI_COMMIT_BRANCH != "master"'
``` ```
...@@ -345,7 +345,7 @@ workflow: ...@@ -345,7 +345,7 @@ workflow:
cache: cache:
paths: paths:
- vendor/ - vendor/
before_script: before_script:
- gem install bundler - gem install bundler
...@@ -354,20 +354,20 @@ before_script: ...@@ -354,20 +354,20 @@ before_script:
pages: pages:
stage: deploy stage: deploy
script: script:
- bundle exec jekyll build -d public - bundle exec jekyll build -d public
artifacts: artifacts:
paths: paths:
- public - public
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master"' - if: '$CI_COMMIT_BRANCH == "master"'
test: test:
stage: test stage: test
script: script:
- bundle exec jekyll build -d test - bundle exec jekyll build -d test
artifacts: artifacts:
paths: paths:
- test - test
rules: rules:
- if: '$CI_COMMIT_BRANCH != "master"' - if: '$CI_COMMIT_BRANCH != "master"'
``` ```
......
...@@ -118,14 +118,14 @@ is so `cp` doesn't also copy `public/` to itself in an infinite loop: ...@@ -118,14 +118,14 @@ is so `cp` doesn't also copy `public/` to itself in an infinite loop:
```yaml ```yaml
pages: pages:
script: script:
- mkdir .public - mkdir .public
- cp -r * .public - cp -r * .public
- mv .public public - mv .public public
artifacts: artifacts:
paths: paths:
- public - public
only: only:
- master - master
``` ```
### `.gitlab-ci.yml` for a static site generator ### `.gitlab-ci.yml` for a static site generator
...@@ -161,13 +161,13 @@ image: ruby:2.6 ...@@ -161,13 +161,13 @@ image: ruby:2.6
pages: pages:
script: script:
- gem install jekyll - gem install jekyll
- jekyll build -d public/ - jekyll build -d public/
artifacts: artifacts:
paths: paths:
- public - public
only: only:
- pages - pages
``` ```
See an example that has different files in the [`master` branch](https://gitlab.com/pages/jekyll-branched/tree/master) See an example that has different files in the [`master` branch](https://gitlab.com/pages/jekyll-branched/tree/master)
......
...@@ -162,9 +162,9 @@ requirements, add a rule which checks `CI_HAS_OPEN_REQUIREMENTS` CI variable. ...@@ -162,9 +162,9 @@ requirements, add a rule which checks `CI_HAS_OPEN_REQUIREMENTS` CI variable.
```yaml ```yaml
requirements_confirmation: requirements_confirmation:
rules: rules:
- if: "$CI_HAS_OPEN_REQUIREMENTS" == "true" - if: "$CI_HAS_OPEN_REQUIREMENTS" == "true"
when: manual when: manual
- when: never - when: never
allow_failure: false allow_failure: false
script: script:
- mkdir tmp - mkdir tmp
......
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