.gitlab-ci.yml 3.76 KB
Newer Older
zikas96's avatar
zikas96 committed
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
variables:
  GIT_STRATEGY: clone
  GIT_SSL_NO_VERIFY: "true"
  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: ""
  MAVEN_OPTS: "-Dmaven.repo.local=$HOME/.m2/repository"

stages:
  - build_vitamui
  - scan_quality_code
  - generate_certs_keystores
  - deploy_services_vitamui
  - artefact_pastis
  - deploy_mongo
  - merge_test
  - merge_to_master

.machine: &runner-shell-vitamui
  tags:
    - vitamui, sh

build_project_vitamui_standalone:dev:
  stage: build_vitamui
  when: manual
  only:
    - deploy/develop
  <<: *runner-shell-vitamui
  script:
    - docker build --cache-from none -f Dockerfile .
  dependencies: []

scan_code:dev:
  stage: scan_quality_code
  when: manual
  only:
    - deploy/develop
  <<: *runner-shell-vitamui
  script:
    - mvn clean verify -Psonar -DskipTests -Dsonar.projectKey=cines-vitamui -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$TOKEN_SONAR
  dependencies: []

generates_certificates:dev:
  stage: generate_certs_keystores
  when: manual
  only:
    - deploy/develop
  <<: *runner-shell-vitamui
  script:
    - ./deployment/pki/scripts/generate_ca_dev.sh
    - ./deployment/pki/scripts/generate_certs_dev.sh $PWD/deployment/environments/hosts.local
    - rm -rf dev-deployment/environments/certs/server/hosts/localhost/
    - mv dev-deployment/environments/certs/server/hosts/sandbox23-adm.cines.fr/ dev-deployment/environments/certs/server/hosts/localhost
    - rm -rf dev-deployment/environments/keystores/server/localhost/
    - ./deployment/generate_stores_dev.sh $PWD/deployment/environments/hosts.local
  artifacts:
    paths:
      - dev-deployment/
  dependencies: []

deploy_services_vitamui:dev:
  stage: deploy_services_vitamui
  when: manual
  only:
    - deploy/develop
  <<: *runner-shell-vitamui
  script:
    - sh tools/docker/cines/stop-container.sh
    - sh tools/docker/cines/tag-images.sh $PREFIX_IMAGE
    - sh tools/docker/cines/push-images.sh $PREFIX_IMAGE
    #- docker system prune --all
    - mv tools/docker/cines/start-container.yml .
    - docker-compose -f start-container.yml --env-file tools/docker/cines/.env up  -d

artefact_deploy_pastis_standalone:dev:
  stage: artefact_pastis
  when: manual
  only:
    - deploy/develop
  <<: *runner-shell-vitamui
  script:
    - mv tools/docker/cines/start-pastis-standalone.yml .
    - docker-compose -f start-pastis-standalone.yml --env-file tools/docker/cines/.env up  -d
    - docker cp pastis-standalone:/app/api/api-pastis/pastis-standalone/target/ .
    - mv target/*.zip . && rm -rf target/** && rm jdk11.zip
    - mv *.zip pastis-package.zip
  artifacts:
    paths:
      - pastis-package.zip
  dependencies: []

deploy_database:dev:
  stage: deploy_mongo
  when: manual
  only:
    - deploy/develop
  <<: *runner-shell-vitamui
  script:
    - who
    - cd tools/docker/mongo
    - ./restart_dev.sh

deploy_test:dev:
  stage: merge_test
  when: manual
  only:
    - deploy/develop
  <<: *runner-shell-vitamui
  script:
    - git clone https://oauth2:$TOKEN_GITLAB@$LIEN_CINES_VITAMUI
    - cd cines-vitamui
    - git fetch
    - git checkout feat/test && git log
    - git checkout deploy/develop && git log
    - git checkout -b feat/merge-test
    - export commit=$(git log --grep Dockerization --pretty=format:"%h")
    - git checkout deploy/develop
    - git reset --hard HEAD~1
    - git merge feat/test
    - git cherry-pick $commit
    - git push --force

merge_master:dev:
  stage: merge_to_master
  when: manual
  only:
    - deploy/develop
  <<: *runner-shell-vitamui
  script:
    - git clone https://oauth2:$TOKEN_GITLAB@$LIEN_CINES_VITAMUI
    - cd cines-vitamui
    - git fetch
    - git checkout deploy/develop && git checkout master
    - git checkout -b merge-master
    - git merge deploy/develop
    - git log
    - git reset --hard HEAD~1
    - git checkout master
    - git merge merge-master
    - git push