main
1services:
2 - docker:dind
3
4include:
5 template: License-Management.gitlab-ci.yml
6
7stages:
8 - build
9 - test
10
11variables:
12 DOCKER_IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
13
14build:
15 image: docker:stable
16 stage: build
17 script:
18 - docker info
19 - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
20 - docker build -t $DOCKER_IMAGE .
21 - docker push $DOCKER_IMAGE
22
23rspec:
24 image:
25 name: $DOCKER_IMAGE
26 entrypoint: [""]
27 variables:
28 GIT_STRATEGY: none
29 stage: test
30 script:
31 - cd /examine/ && ./bin/test
32
33lint:
34 image:
35 name: $DOCKER_IMAGE
36 entrypoint: [""]
37 variables:
38 GIT_STRATEGY: none
39 stage: test
40 script:
41 - cd /examine/ && ./bin/lint
42
43container_scanning:
44 image:
45 name: docker:stable
46 allow_failure: true
47 variables:
48 CLAIR_URL: http://docker:6060
49 DOCKER_DRIVER: overlay2
50 DOCKER_HOST: tcp://docker:2375
51 GIT_STRATEGY: none
52 NO_PROXY: docker,localhost
53 TARGET_IMAGE: $DOCKER_IMAGE
54 stage: test
55 script:
56 - apk add ruby curl
57 - gem install examine --no-document
58 - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
59 - examine clair scan $DOCKER_IMAGE --clair_url $CLAIR_URL --ip $(hostname -i) --report gl-container-scanning-report.json
60 artifacts:
61 reports:
62 container_scanning: gl-container-scanning-report.json
63 paths: [gl-container-scanning-report.json]