-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
90 lines (84 loc) · 3.34 KB
/
.gitlab-ci.yml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
variables:
IMAGE: "$CI_REGISTRY_IMAGE"
COMMIT_TAG: "$CI_COMMIT_REF_NAME"
COMPOSE_FILE_TESTS: docker-compose-tests.yml
# gitlab 4501
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
stages:
- build1
- build2
# - optimization
# - test
- pre-deploy
- deploy
- post-deploy
build-base:
stage: build1
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $DOCKER_ENV_CI_REGISTRY
- docker pull $IMAGE/postgresql:11 || true
- docker build --cache-from $IMAGE/postgresql:11 -t $IMAGE/postgresql:11 postgresql
- docker push $IMAGE/postgresql:11
build-oca:
stage: build2
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $DOCKER_ENV_CI_REGISTRY
- docker pull $IMAGE/postgresql:11
- docker pull $IMAGE/ocb:$COMMIT_TAG || true
- docker pull $IMAGE/ocb-oca:$COMMIT_TAG || true
- docker build --build-arg GHUSER=OCA --build-arg GHREPO=OCB --cache-from $IMAGE/ocb:$COMMIT_TAG -t $IMAGE/ocb:$COMMIT_TAG base
- docker build --cache-from $IMAGE/ocb-oca:$COMMIT_TAG -t $IMAGE/ocb-oca:$COMMIT_TAG ocb-oca
- docker push $IMAGE/ocb:$COMMIT_TAG
- docker push $IMAGE/ocb-oca:$COMMIT_TAG
build-ee:
stage: build2
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $DOCKER_ENV_CI_REGISTRY
- docker pull $IMAGE/postgresql:11
- docker pull $IMAGE/odoo:$COMMIT_TAG || true
- docker pull $IMAGE/odoo-ee:$COMMIT_TAG || true
- docker build --build-arg GHUSER=odoo --build-arg GHREPO=odoo --cache-from $IMAGE/odoo:$COMMIT_TAG -t $IMAGE/odoo:$COMMIT_TAG base
- docker build --cache-from $IMAGE/odoo-ee:$COMMIT_TAG -t $IMAGE/odoo-ee:$COMMIT_TAG --build-arg GITHUB_TOKEN=$GITHUB_TOKEN odoo-ee
- docker push $IMAGE/odoo:$COMMIT_TAG
- docker push $IMAGE/odoo-ee:$COMMIT_TAG
#test:
# stage: test
# image: registry.anybox.cloud/infra/infra-cli:dev
# script:
# - export DOCKER_HOST=tcp://docker:2375/
# - make test
# - toolbox_cli analyse-odoo-tests test.log
# artifacts:
# when: always
# paths:
# - test.log
# expire_in: 1 day
#
#
# container_scanning:
# stage: optimization
# variables:
# DOCKER_DRIVER: overlay2
# services:
# - docker:stable-dind
# script:
# - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $DOCKER_ENV_CI_REGISTRY
# - docker run -d --name db arminc/clair-db:latest
# - docker run -p 6060:6060 --link db:postgres -d --name clair --restart on-failure arminc/clair-local-scan:v2.0.1
# - apk add -U wget ca-certificates
# - docker pull $CI_REGISTRY_IMAGE:$COMMIT_TAG
# - wget https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64
# - mv clair-scanner_linux_amd64 clair-scanner
# - chmod +x clair-scanner
# - touch clair-whitelist.yml
# - while( ! wget -q -O /dev/null http://docker:6060/v1/namespaces ) ; do sleep 1 ; done
# - retries=0
# - echo "Waiting for clair daemon to start"
# - while( ! wget -T 10 -q -O /dev/null http://docker:6060/v1/namespaces ) ; do sleep 1 ; echo -n "." ; if [ $retries -eq 10 ] ; then echo " Timeout, aborting." ; exit 1 ; fi ; retries=$(($retries+1)) ; done
# - ./clair-scanner -c http://docker:6060 --ip $(hostname -i) -r gl-container-scanning-report.json -l clair.log -w clair-whitelist.yml $CI_REGISTRY_IMAGE:$COMMIT_TAG || true
# allow_failure: true
# artifacts:
# paths:
# - gl-container-scanning-report.json