I am using python Project on gitlab. we configured Gitlab-CI for the project . We have settings.ini file which contains paswords and usernames so we dont commit that file to Repo. How can I pass the settings.ini file to gitlab runner to run unit test. when it’s a file loaded with configparser.
I would create a „template „ settings.ini in the project and just replace username and password with e.g. sed by variables you set in the project in a before_script step.
See https://docs.gitlab.com/ce/ci/variables/README.html#protected-variables
Can I be provided with any Example project I can Refer to
Hello siva,
- add a file
settings.ini.template
like:
[default]
username=@@USERNAME@@
password=@@PASSWORD@@
- Add this to the repository.
- Add variables
THE_USERNAME
andTHE_PASSWORD
in your project.
Now in before_script
do:
sed -e 's/@@USERNAME@@/'$THE_USERNAME'/' -e 's/@@PASSWORD@@/'$THE_PASSWORD'/' settings.ini.template > settings.ini
.
2 Likes
Thank you . I really appreciate your help
1 Like
You are welcome. If this works for you, I think you may add that the issue is “resolved”.
2 Likes