I have gitlab variable stored in a file format
When I tried to access the file using my python code
like
variable Key : KEY_FILE value: 'hsdasds'
in my python code pack.py
with open($KEY_FILE) as f:
f.read()
I get File not found error but its showing the file path when I did
before_script -echo ' $KEY_FILE'
My query is how can I read the content(I will read it in docker container as my python code will run in a docker container) of the file define in variable ..
docker run --rm -u $(id -u):$(id -g) -v "$PWD":/mnt python 'executors/pack.py' "$KEY_FILE"
2
Answers
I have resolved it by below ways
First in gitlab-,ci.yml
2.in Dockerfile
Now in code
Try to firstly copy the file to your current working directory
And then run