summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml
blob: 7f9a7df2f31ee66197a542a1fbd5d1e23fa8d1cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/container_scanning/

container_scanning:
  stage: test
  image:
    name: registry.gitlab.com/gitlab-org/security-products/analyzers/klar:$CI_SERVER_VERSION_MAJOR-$CI_SERVER_VERSION_MINOR-stable
    entrypoint: []
  variables:
    # By default, use the latest clair vulnerabilities database, however, allow it to be overridden here
    # with a specific version to provide consistency for integration testing purposes
    CLAIR_DB_IMAGE_TAG: latest
    # Override this variable in your `.gitlab-ci.yml` file and set it to `fetch` if you want to provide a `clair-whitelist.yaml` file.
    # See https://docs.gitlab.com/ee/user/application_security/container_scanning/index.html#overriding-the-container-scanning-template
    # for details
    GIT_STRATEGY: none
  allow_failure: true
  services:
    - name: arminc/clair-db:$CLAIR_DB_IMAGE_TAG
      alias: clair-vulnerabilities-db
  script:
    # the kubernetes executor currently ignores the Docker image entrypoint value, so the start.sh script must
    # be explicitly executed here in order for this to work with both the kubernetes and docker executors
    # see this issue for more details https://gitlab.com/gitlab-org/gitlab-runner/issues/4125
    - /container-scanner/start.sh
  artifacts:
    reports:
      container_scanning: gl-container-scanning-report.json
  dependencies: []
  only:
    refs:
      - branches
    variables:
      - $GITLAB_FEATURES =~ /\bcontainer_scanning\b/
  except:
    variables:
      - $CONTAINER_SCANNING_DISABLED