I am new to use the drone secrets, need help in below. I have defined few secrets in the drone.io secrets settings. And now I want to access them in my test file.
Now in my repo there is a file called production.yml file in which I have defined the secrets values like below.
- name: build
shm_size: 4096000000
image: cypress/included:10.11.0
environment:
CYPRESS_CLIENT_KEY_PROD:
from_secret: CYPRESS_SECRET_KEY_PROD
CYPRESS_CLIENT_KEY_STAG:
from_secret: CYPRESS_SECRET_KEY_STAG
commands:
- echo $CYPRESS_CLIENT_KEY_PROD
- echo $CYPRESS_CLIENT_KEY_STAG
When I run the build I can see the echo prints with ****. Now I want these values to use in my test to authenticate a user. My question is what is the syntax to use these variables in my code? I tried multiple ways but nothing is working.
export function xClientKey() {
process.env.CYPRESS_CLIENT_KEY_PROD
};
I have created a function like above to access the secrets. But the syntax process.env.CYPRESS_CLIENT_KEY_PROD
is not working here. I also tried Cypress.env.CYPRESS_CLIENT_KEY_PROD
and this is also not working. It I am unable to access the secrets values. Can anyone let me know the correct syntax to access the secrets. Thanks