debian-mirror-gitlab/lib/gitlab/ci/templates/Jobs/Browser-Performance-Testing.gitlab-ci.yml

78 lines
2.6 KiB
YAML
Raw Normal View History

2020-07-28 23:09:34 +05:30
# Read more about the feature here: https://docs.gitlab.com/ee/user/project/merge_requests/browser_performance_testing.html
2021-09-04 01:27:46 +05:30
browser_performance:
2019-07-07 11:18:12 +05:30
stage: performance
2020-07-28 23:09:34 +05:30
image: docker:19.03.12
2019-07-07 11:18:12 +05:30
allow_failure: true
2019-09-30 21:07:59 +05:30
variables:
DOCKER_TLS_CERTDIR: ""
2020-07-28 23:09:34 +05:30
SITESPEED_IMAGE: sitespeedio/sitespeed.io
2020-11-24 15:15:51 +05:30
SITESPEED_VERSION: 14.1.0
2020-07-28 23:09:34 +05:30
SITESPEED_OPTIONS: ''
2019-07-07 11:18:12 +05:30
services:
2020-07-28 23:09:34 +05:30
- docker:19.03.12-dind
2019-07-07 11:18:12 +05:30
script:
- |
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
- export CI_ENVIRONMENT_URL=$(cat environment_url.txt)
- mkdir gitlab-exporter
2021-04-29 21:17:54 +05:30
# Busybox wget does not support proxied HTTPS, get the real thing.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/287611.
- (env | grep -i _proxy= 2>&1 >/dev/null) && apk --no-cache add wget
2020-11-24 15:15:51 +05:30
- wget -O gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/1.1.0/index.js
2019-07-07 11:18:12 +05:30
- mkdir sitespeed-results
2021-04-29 21:17:54 +05:30
- |
function propagate_env_vars() {
CURRENT_ENV=$(printenv)
for VAR_NAME; do
echo $CURRENT_ENV | grep "${VAR_NAME}=" > /dev/null && echo "--env $VAR_NAME "
done
}
2019-07-07 11:18:12 +05:30
- |
if [ -f .gitlab-urls.txt ]
then
sed -i -e 's@^@'"$CI_ENVIRONMENT_URL"'@' .gitlab-urls.txt
2021-04-29 21:17:54 +05:30
docker run \
$(propagate_env_vars \
auto_proxy \
https_proxy \
http_proxy \
no_proxy \
AUTO_PROXY \
HTTPS_PROXY \
HTTP_PROXY \
NO_PROXY \
) \
--shm-size=1g --rm -v "$(pwd)":/sitespeed.io $SITESPEED_IMAGE:$SITESPEED_VERSION --plugins.add ./gitlab-exporter --cpu --outputFolder sitespeed-results .gitlab-urls.txt $SITESPEED_OPTIONS
2019-07-07 11:18:12 +05:30
else
2021-04-29 21:17:54 +05:30
docker run \
$(propagate_env_vars \
auto_proxy \
https_proxy \
http_proxy \
no_proxy \
AUTO_PROXY \
HTTPS_PROXY \
HTTP_PROXY \
NO_PROXY \
) \
--shm-size=1g --rm -v "$(pwd)":/sitespeed.io $SITESPEED_IMAGE:$SITESPEED_VERSION --plugins.add ./gitlab-exporter --cpu --outputFolder sitespeed-results "$CI_ENVIRONMENT_URL" $SITESPEED_OPTIONS
2019-07-07 11:18:12 +05:30
fi
2020-07-28 23:09:34 +05:30
- mv sitespeed-results/data/performance.json browser-performance.json
2019-07-07 11:18:12 +05:30
artifacts:
paths:
2019-09-04 21:01:54 +05:30
- sitespeed-results/
2020-07-28 23:09:34 +05:30
reports:
browser_performance: browser-performance.json
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
2021-09-04 01:27:46 +05:30
- if: '$BROWSER_PERFORMANCE_DISABLED'
2020-05-24 23:13:21 +05:30
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'