How to pass .ini secure details to gitlab runner to run test

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.


Can I be provided with any Example project I can Refer to

Hello siva,

  • add a file settings.ini.template like:
  • Add this to the repository.
  • Add variables THE_USERNAME and THE_PASSWORDin your project.

Now in before_script do:
sed -e 's/@@USERNAME@@/'$THE_USERNAME'/' -e 's/@@PASSWORD@@/'$THE_PASSWORD'/' settings.ini.template > settings.ini.


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”.