-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
76 lines (71 loc) · 2.63 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
variables:
COMMON_BIND_HOST: "0.0.0.0"
DEPLOY_DOCKER_HELM: "true"
DEPLOY_TIMESTAMP: "$DEPLOY_TIMESTAMP"
DOCKER_DRIVER: "$DIND_DRIVER"
DOCKER_HOST: "$DIND_HOST"
DOCKER_TLS_CERTDIR: "$DIND_TLS_CERTDIR"
MAVEN_HOME: "/builds/$CI_PROJECT_PATH/mnt/.m2"
MAVEN_CLI: "-Ddocker.registry=$DOCKER_REGISTRY -Dhelm.deploy.url=$HELM_REGISTRY -Dhelm.deploy.type=$HELM_TYPE -Dmaven.deploy.releases=$MAVEN_DEPLOY_RELEASES -Dmaven.deploy.snapshots=$MAVEN_DEPLOY_SNAPSHOTS --batch-mode --errors --fail-fast --show-version"
MAVEN_OPTS: "-Dmaven.repo.local=/builds/$CI_PROJECT_PATH/mnt/.m2/repository"
stages:
- test
- deploy
php security audit errors:
image:
name: tophfr/phpcs-security-audit
entrypoint: [""]
stage: test
script:
- cd service/src/main/php
- /usr/local/bin/phpcs --standard=/usr/local/lib/composer/vendor/pheromone/phpcs-security-audit/example_base_ruleset.xml -n .
php security audit warnings:
image:
name: tophfr/phpcs-security-audit
entrypoint: [""]
stage: test
script:
- cd service/src/main/php
- /usr/local/bin/phpcs --standard=/usr/local/lib/composer/vendor/pheromone/phpcs-security-audit/example_base_ruleset.xml .
allow_failure: true
deploy_release:
image: php:latest
stage: deploy
artifacts:
name: "educonnector_release-$CI_PIPELINE_CREATED_AT-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
paths:
- ./service/src/main/php
before_script:
- apt-get update -yqq
- apt-get install -yqq git
# Install and run Composer
- cd service/src/main/php
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
- date=$(date --iso-8601=seconds)
- sed -i "s|#BUILD_DATE|$date|g" install/version_info.php
- sed -i "s|#BUILD_COMMIT|$CI_COMMIT_SHORT_SHA|g" install/version_info.php
- sed -i "s|#BUILD_BRANCH|$CI_COMMIT_REF_NAME|g" install/version_info.php
script:
- rm -rf .git/
- rm -rf vendor/composer/installed.json
- rm -rf .gitlab-ci.yml
- find ./vendor/ -name ".git" -exec rm -rf {} \; || true
- ls ./
deploy:
image: maven:3.8.4-jdk-8
services:
- name: "$DIND_IMAGE"
alias: docker
entrypoint: [ "env", "-u", "DOCKER_HOST" ]
command: [ "dockerd-entrypoint.sh" ]
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH =~ /^maven\/release\/.*/ && $CI_PIPELINE_SOURCE == "pipeline"
- if: $CI_COMMIT_TAG && $CI_PIPELINE_SOURCE == "pipeline"
- if: $CI_COMMIT_BRANCH !~ /^maven\/release\/.*/ && $CI_COMMIT_TAG == null
before_script:
- apt-get update -y
- apt-get install -y php php-curl php-dom php-gd php-mbstring php-xml php-zip
script:
- mvn $MAVEN_CLI -s .mvn/settings.xml deploy