summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 96f075db50639be0ed26cecbce80075bc4550db8 (plain)
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
variables:
  MAVEN_CLI_OPTS: --batch-mode --errors --show-version
  SONAR_HOST_URL: http://192.168.40.153:9900
  SONAR_PROJECT_KEY: saved-query-scheduler
  SONAR_LOGIN_TOKEN: 921363353ba26a612fc4ec77679647780f9a46e7

stages:
  - build
  - clean
  - deploy

build:
  stage: build
  script:
    - echo 'exec mvn clean package'
    - echo 'tag:' $CI_COMMIT_TAG
    - mvn clean package -Dmaven.test.skip=true
  only:
    - tags
  tags:
    - galaxy

clean:
  stage: clean
  script:
    - echo 'build job fail, exec mvn clean'
    - echo  'tag:' $CI_COMMIT_TAG
    - mvn clean
  when: on_failure
  only:
    - tags
  tags:
    - galaxy
deploy:
  stage: deploy
  script:
    - echo 'exec mvn package & docker build'
    - echo  'tag:' $CI_COMMIT_TAG
    - |- 
      mvn $MAVEN_CLI_OPTS clean verify sonar:sonar -Dsonar.projectKey=$SONAR_PROJECT_KEY \
      -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN_TOKEN \
      -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=300
    - mvn clean package -Dmaven.test.skip=true docker:build -DdockerImageTags=$CI_COMMIT_TAG
  when: on_success
  only:
    - tags
  tags:
    - galaxy