.gitlab-ci.yml 1.44 KB
Newer Older
François Agneray's avatar
François Agneray committed
1
2
stages:
    - install
3
    - sonar
François Agneray's avatar
François Agneray committed
4
5
6
7
    - build
    - deploy

variables:
8
9
    VERSION: "3.0"
    SONARQUBE_URL: https://sonarqube.lam.fr
François Agneray's avatar
François Agneray committed
10
11
12
13
14
15
16
17
18
19
20
21
    CONTAINER_IMAGE: portus.lam.fr/anis/anis-client

install:
    image: node:11
    stage: install
    script:
        - yarn global add @angular/cli
        - yarn install
        - ng build --prod
    cache:
        paths:
            - dist
22
            - node_modules
François Agneray's avatar
François Agneray committed
23
24
25
        policy: push
    only:
        refs:
26
            - develop
27
28
29
30
31
32

sonar_scanner:
    image: portus.lam.fr/ci-tools/sonar-scanner:latest
    stage: sonar
    script:
        - sonar-scanner -Dsonar.projectKey=anis-client -Dsonar.sources=src -Dsonar.projectVersion=$VERSION -Dsonar.host.url=$SONARQUBE_URL -Dsonar.login=$SONAR_TOKEN
33
34
35
36
    cache:
        paths:
            - node_modules
        policy: pull
37
38
    only:
        refs:
39
            - develop
François Agneray's avatar
François Agneray committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

build:
    image: docker:stable
    stage: build
    script:
        - docker login -u fagneray -p $PORTUS_TOKEN portus.lam.fr
        - docker pull $CONTAINER_IMAGE:latest-dev || true
        - docker build --cache-from $CONTAINER_IMAGE:latest-dev -t $CONTAINER_IMAGE:latest-dev .
        - docker push $CONTAINER_IMAGE:latest-dev
    cache:
        paths:
            - dist
        policy: pull
    only:
        refs:
55
            - develop
François Agneray's avatar
François Agneray committed
56
57
58
59
60
61
62
63
64

deploy:
    image: alpine
    stage: deploy
    script:
        - apk add --update curl
        - curl -XPOST $DEV_WEBHOOK
    only:
        refs:
65
            - develop