Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to create a pipeline and have defined some variable in my gitlab job which will be used by python script to populate results.

Is there any way I can call/define those variable in my python script.

Is there any way I can call/define those variable in my python script.

For example:

```
.test-report:
extends: .test_report_setup
tags: *def_runners_tags
variables:
value-path: ${CI_PROJECT_DIR}/value
```
Now in my python script I want to call the variable 'value-path' to fetch or read files located in that directory.

```
file_path = '<value-path>' <---- To get the gitlab job variable here

file_in = open(file_path + "id.txt")
```

Please help me how I can get it in my python script as I am a bit stuck on it.

What I have tried:

I have tried to import the variable as os.env but that didn't worked.
Posted
Updated 7-Apr-21 1:35am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900