Sitespeed IO - Gitlab Integration
Issues with dynamic environments
-
we are not getting the results of the metrics for the pages analyzed in the “Browser performance test metrics” section of the merge requests in GitLab when If the environment concatenates the branch name to the URL and we use the variables CI_COMMIT_BRANCH or CI_COMMIT_REF_NAME to set that value. It only works if we hardcode the branch name in the URL.
-
Gitlab version:
- GitLab Enterprise Edition 16.6.0
-
.gitlab-ci.yml
content:
deploy-job:
stage: deploy-job
variables:
ENVIRONMENT_URL: https://example.com
script:
- export BRANCH_PATH=$(echo $CI_COMMIT_REF_NAME | tr '[:upper:]' '[:lower:]')
- echo "${CI_ENVIRONMENT_URL}/${BRANCH_PATH}/main-com" >> sitespeed.io-urls.txt
- echo "${CI_ENVIRONMENT_URL}/${BRANCH_PATH}/main-com/page-1/" >> sitespeed.io-urls.txt
- echo "${CI_ENVIRONMENT_URL}/${BRANCH_PATH}/main-com/page-2/" >> sitespeed.io-urls.txt
artifacts:
paths:
- sitespeed.io-urls.txt
browser_performance:
stage: performance
dependencies:
- deploy-job
variables:
DOCKER_HOST: tcp://localhost:port/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
URL: sitespeed.io-urls.txt
SITESPEED_OPTIONS: -n 3
DEGRADATION_THRESHOLD: 5
needs: ["deploy-job"]
- It only works if we harcoded the branch name to the URL this way:
deploy-job:
stage: deploy-job
variables:
ENVIRONMENT_URL: https://example.com
script:
- echo "${CI_ENVIRONMENT_URL}/branch-name/main-com" >> sitespeed.io-urls.txt
- echo "${CI_ENVIRONMENT_URL}/branch-name/main-com/page-1/" >> sitespeed.io-urls.txt
- echo "${CI_ENVIRONMENT_URL}/branch-name/main-com/page-2/" >> sitespeed.io-urls.txt
artifacts:
paths:
- sitespeed.io-urls.txt
- the result with the branch name hardcoded:
-
I’m following the sitespeed io guide: Browser Performance Testing | GitLab
-
In addition, I have tried different ways to handle the creation of URLs, shell scripts, python scripts, etc without success.
Thanks in advance for your help