-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
116 lines (109 loc) · 4.6 KB
/
.gitlab-ci.yml
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
stages:
- build
- test
- deploy
- install
# 1) Build every commit on every branch and add the COMMIT SHORT SHA as suffix
maven-build:
image: container-registry.dmx.systems/dmx-intern/docker-images/maven-npm-nodejs
stage: build
tags:
- docker
script:
- export MAVEN_OPTS='-Xmx128m'
- mvn clean install -DskipTests=true
artifacts:
paths:
- target
name: ${CI_PROJECT_NAME}-${CI_COMMIT_SHORT_SHA}
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_COMMIT_BRANCH == 'main'
- if: $CI_COMMIT_TAG != null
# 2) Run SonarQube Tests
sonarqube-check:
image: container-registry.dmx.systems/dmx-intern/docker-images/maven-npm-nodejs
stage: test
tags:
- docker
dependencies:
- maven-build
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- mvn -Pcoverage verify sonar:sonar -Dsonar.host.url=https://sonar.dmx.systems -Dsonar.projectKey=${CI_PROJECT_NAMESPACE}_${CI_PROJECT_NAME}_${SONAR_PROJECT_KEY}
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_COMMIT_BRANCH == 'main'
- if: $CI_COMMIT_TAG != null
# 3) Copies SNAPSHOT builds on 'main' and 'dm4' branch into download.dmx.systems/ci/ directory
publish-snapshot:
stage: deploy
tags:
- shell
script:
- ci-publish.sh snapshot
dependencies:
- maven-build
rules:
- if: $CI_COMMIT_BRANCH == 'master' && $CI_COMMIT_TAG == null && $CI_PIPELINE_SOURCE != 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'main' && $CI_COMMIT_TAG == null && $CI_PIPELINE_SOURCE != 'merge_request_event'
# 4) Copies tagged RELEASE builds into download.dmx.systems/plugins/ directory
publish-release:
stage: deploy
tags:
- shell
script:
- ci-publish.sh release
dependencies:
- maven-build
rules:
- if: $CI_COMMIT_BRANCH == 'master' && $CI_COMMIT_TAG != null && $CI_PIPELINE_SOURCE != 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'main' && $CI_COMMIT_TAG != null && $CI_PIPELINE_SOURCE != 'merge_request_event'
# 5) Deploy into gitlab maven repository
deploy-to-gitlab-maven:
image: container-registry.dmx.systems/dmx-intern/docker-images/maven-npm-nodejs
stage: deploy
tags:
- docker
script:
- 'mvn -Pgitlab-maven-deployment deploy -s /usr/local/lib/ci_settings.xml'
rules:
- if: $CI_PIPELINE_SOURCE != 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_COMMIT_BRANCH == 'main'
# 6) Install in docker-container
install-in-container:
stage: install
tags:
## requires shell-docker runner
- shell-docker
dependencies:
- maven-build
before_script:
- if [ ! -d ./deploy/dmx/dev-ci/import ]; then mkdir ./deploy/dmx/dev-ci/import; fi
- if [ ! -d ./deploy/dmx/dev-ci/run.d ]; then mkdir ./deploy/dmx/dev-ci/run.d; fi
- 'curl -sS -u "${OC_ACCESS_TOKEN}:${OC_ACCESS_PW}" -H "X-Requested-With: XMLHttpRequest" "https://files.dmx.systems/public.php/webdav/ldap-db.tar.gz" -o ./deploy/ldap/ldap-db.tar.gz'
- 'curl -sS -u "${OC_ACCESS_TOKEN}:${OC_ACCESS_PW}" -H "X-Requested-With: XMLHttpRequest" "https://files.dmx.systems/public.php/webdav/ldap-cfg.tar.gz" -o ./deploy/ldap/ldap-cfg.tar.gz'
- 'curl -sS -u "${OC_ACCESS_TOKEN}:${OC_ACCESS_PW}" -H "X-Requested-With: XMLHttpRequest" "https://files.dmx.systems/public.php/webdav/dmx-db.tar.gz" -o ./deploy/dmx/dev-ci/import/dmx-db.tar.gz'
- 'curl -sS -u "${OC_ACCESS_TOKEN}:${OC_ACCESS_PW}" -H "X-Requested-With: XMLHttpRequest" "https://files.dmx.systems/public.php/webdav/dmx-filedir.tar.gz" -o ./deploy/dmx/dev-ci/import/dmx-filedir.tar.gz'
- 'curl -sS -u "${OC_ACCESS_TOKEN}:${OC_ACCESS_PW}" -H "X-Requested-With: XMLHttpRequest" "https://files.dmx.systems/public.php/webdav/20-users.ldif" -o ./deploy/ldap/dev-ci/bootstrap/20-users.ldif'
script:
- deploy/ci-deploy-ldap-files.sh
- ls -la deploy/ldap/dev-ci/bootstrap/
- ci-deploy-docker-instances.sh
- ci-deploy-check-plugin-state.sh ./deploy/instance/dev-ci/logs/dmx0.log 180 || true
- docker exec dmx-zw-migrator-dev-ldap-container /bin/sh -c "slapadd -v -c -l /container/service/slapd/assets/config/bootstrap/ldif/custom/20-users.ldif"
- deploy/ci-login-testuser.sh
- ci-deploy-extra-plugins.sh dmx-linqa
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'main' && $CI_COMMIT_TAG == null