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

Explain how to use custom setup cmd

parent 3d1c2c26
...@@ -7,8 +7,7 @@ is needed. ...@@ -7,8 +7,7 @@ is needed.
This example shows how to run the License Management tool on your This example shows how to run the License Management tool on your
project's dependencies by using GitLab CI/CD. 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 add a new job to `.gitlab-ci.yml`, called `license_management`:
You can then add a new job to `.gitlab-ci.yml`, called `license_management`:
```yaml ```yaml
license_management: license_management:
...@@ -23,10 +22,41 @@ license_management: ...@@ -23,10 +22,41 @@ license_management:
paths: [gl-license-management-report.json] 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 The above example will create a `license_management` job in the `test` stage
[Auto-DevOps template](https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Auto-DevOps.gitlab-ci.yml) 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. 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:** TIP: **Tip:**
Starting with [GitLab Ultimate][ee] 11.0, this information will 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