-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
77 lines (62 loc) · 2.4 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
include:
- project: 'internal/ci'
ref: main
file:
- '/environment/v1/variables.yml'
- '/test/v1/base.yml'
- '/security/v1/security.gitlab-ci.yml'
stages:
- test
- build
- security
variables:
PHP_IMAGE: registry.bookbooncloud.com/docker/php-base:8.1.8
.auto_devops: &auto_devops |
# Auto DevOps variables and functions
[[ "$TRACE" ]] && set -x
export CI_APPLICATION_REPOSITORY=$CI_REGISTRY_IMAGE
export CI_APPLICATION_TAG=${CI_COMMIT_TAG:-$CI_COMMIT_REF_SLUG}
COMPOSER=$(echo `which composer`)
function install_php_dependencies() {
echo -e "\033[0;32mDownloading composer...\033[0m\n"
mkdir -p $HOME/.composer
php -r "copy('https://getcomposer.org/composer.phar', 'composer');"
chmod +x composer
COMPOSER="$PWD/composer"
$COMPOSER --version
if [ -n "$COMPOSER_INSTALL_TOKEN" ]; then
echo "Using personal token"
$COMPOSER config gitlab-token.bookbooncloud.com $COMPOSER_INSTALL_TOKEN
else
echo "Using group token"
$COMPOSER config gitlab-token.bookbooncloud.com $DEPLOY_COMPOSER_INTERNAL_USER $DEPLOY_COMPOSER_INTERNAL_TOKEN
fi
echo -e "\033[0;32mComposer install...\033[0m\n"
$COMPOSER install --no-progress --optimize-autoloader
}
function dast() {
export CI_ENVIRONMENT_URL=$(cat environment_url.txt)
mkdir /zap/wrk/
/zap/zap-baseline.py -J gl-dast-report.json -t "$CI_ENVIRONMENT_URL" || true
cp /zap/wrk/gl-dast-report.json .
}
function performance() {
export CI_ENVIRONMENT_URL=$(cat environment_url.txt)
mkdir gitlab-exporter
wget -O gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/10-5/index.js
mkdir sitespeed-results
if [ -f .gitlab-urls.txt ]
then
sed -i -e 's@^@'"$CI_ENVIRONMENT_URL"'@' .gitlab-urls.txt
docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --plugins.add ./gitlab-exporter --outputFolder sitespeed-results .gitlab-urls.txt
else
docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --plugins.add ./gitlab-exporter --outputFolder sitespeed-results "$CI_ENVIRONMENT_URL"
fi
mv sitespeed-results/data/performance.json performance.json
}
function security_sensio() {
apk add --no-cache curl
curl -H "Accept: text/plain" https://security.symfony.com/check_lock -F [email protected]
}
before_script:
- *auto_devops