.gitlab-ci.yml 1.33 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
22
23
24
    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
        policy: push
    only:
        refs:
25
26
27
28
29
30
31
32
33
34
            - sonar

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
    only:
        refs:
            - sonar
François Agneray's avatar
François Agneray committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

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:
50
            - sonar
François Agneray's avatar
François Agneray committed
51
52
53
54
55
56
57
58
59

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