Commit 8e321a22 authored by Philippe Lafoucrière's avatar Philippe Lafoucrière

Merge branch 'add_setup_cmd_section_to_lm' into 'master'

Explain how to use custom setup cmd

See merge request gitlab-org/gitlab-ee!7680
parents 3d1c2c26 8bf58d36
......@@ -7,8 +7,7 @@ is needed.
This example shows how to run the License Management tool on your
project's dependencies by using GitLab CI/CD.
First, you need GitLab Runner with [docker-in-docker executor](../docker/using_docker_build.md#use-docker-in-docker-executor).
You can then add a new job to `.gitlab-ci.yml`, called `license_management`:
You can add a new job to `.gitlab-ci.yml`, called `license_management`:
```yaml
license_management:
......@@ -23,10 +22,41 @@ license_management:
paths: [gl-license-management-report.json]
```
The above example will create a `license_management` job in the `test` stage and will create the required report artifact. Check the
[Auto-DevOps template](https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Auto-DevOps.gitlab-ci.yml)
The above example will create a `license_management` job in the `test` stage
and will create the required report artifact. Check the [Auto-DevOps
template](https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Auto-DevOps.gitlab-ci.yml)
for a full reference.
## Install custom project dependencies
The `license_management` image already embeds many auto-detection scripts, languages,
and packages. Nevertheless, it's almost impossible to cover all cases, for all projects.
That's why sometimes it's necessary to install extra packages, or to have extra steps
in the project automated setup, like the download and installation of a certificate.
For that, a `SETUP_CMD` environment variable can be passed to the container,
with the required commands to run before license detection.
If present, this variable will override the setup step necessary to install all the packages
of your application (ex: for a project with a `Gemfile`, the setup step will be `bundle install`).
Example:
```yaml
license_management:
image:
name: "registry.gitlab.com/gitlab-org/security-products/license-management:$CI_SERVER_VERSION_MAJOR-$CI_SERVER_VERSION_MINOR-stable"
entrypoint: [""]
stage: test
variables:
SETUP_CMD=./my-custom-install-script.sh
allow_failure: true
script:
- /run.sh analyze .
artifacts:
paths: [gl-license-management-report.json]
```
In this example, `my-custom-install-script.sh` is a shell script at the root of the project.
TIP: **Tip:**
Starting with [GitLab Ultimate][ee] 11.0, this information will
......
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