I'm having issues using pipeline variables i setup on aws codebuild with cypress. Basically I don't know how to call them from my Cypress code.
Example of my buildspec.yml
version: 0.2
env:
variables:
BASE_URL : "CYPRESS_BASE_URL"
STAGING_USER : "CYPRESS_STAGING_USER"
STAGING_PASSWORD : "CYPRESS_STAGING_PASSWORD"
phases:
install:
runtime-versions:
nodejs: latest
commands:
- sudo apt update
- sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- cd tests
- rm /codebuild/global.json -f
- npm ci
build:
commands:
- ls -a
- npx cypress run --config-file staging.config.ts
Using the example above CYPRESS_BASE_URL is the name of the pipeline env variable I setup like this
Now how do I use the variables in my Cypress code, usually I'll use this from cypress.env.json
but I don't use this file on the repo so I can't do that. I need to use variables set on the pipeline or in parameter store. For example in my cypress config I'm confused on how to set the baseUrl from the pipeline variable?