.gitlab-ci.yml 1.38 KB
Newer Older
1
stages:
2
  - sonar-analysis
3
4
  - build

5
variables:
6
  SONAR_URL: https://sonarqube.forge.grandlyon.com
7
8
9
  POSTGRES_EXPOSED_PORT: 5432
  POSTGRES_PORT: 5432
  ORGANIZATIONS_API_BIND_PORT: 3000
10
11
12

sonarqube:
  stage: sonar-analysis
13
14
  tags:
    - build
15
  only:
16
    - master
17
18
19
20
21
22
23
24
25
26
27
28
29
  before_script:
    - export PATH=$PATH:/usr/local/bin/sonar-scanner-3.2.0.1227-linux/bin/
    - export NODE_PATH=$NODE_PATH:`npm root -g`
  script:
    - >
      sonar-scanner
      -Dsonar.projectName=${SONAR_PROJECT_KEY}
      -Dsonar.projectVersion=1.0
      -Dsonar.sourceEncoding=UTF-8
      -Dsonar.projectBaseDir=.
      -Dsonar.host.url=${SONAR_URL}
      -Dsonar.projectKey=${SONAR_PROJECT_KEY}
      -Dsonar.login=${SONAR_TOKEN}
30

31
32
build_development:
  stage: build
33
34
  tags:
    - build
35
  only:
36
37
    - development
  script:
38
39
    - export TAG=$CI_COMMIT_SHORT_SHA
    - echo ${TAG}
40
    - docker-compose build
41
42
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker-compose push
43
    - 'curl -X POST -F token=$CI_JOB_TOKEN -F ref=master -F variables[TAG]=${TAG} https://forge.grandlyon.com/api/v4/projects/330/trigger/pipeline'
44
45
46

build_release:
  stage: build
47
48
  tags:
    - build
49
50
  only:
    - tags
51
  script:
52
    - export TAG=$(echo $CI_COMMIT_TAG | sed 's/v//g')
53
    - echo ${TAG}
54
55
56
    - docker-compose build
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker-compose push