How to read variable set as File type in gitlab-ci.yml ?

  • If you have created variables in gitlab CI/CD setting, here is how you can access it in your gitlab-ci pipeline.
  • In the above example, the variable has following settings
    • Type: File
    • Key: DB_ACCESS_URL
    • Value: jdbc:oracle:thin:@myoracle.db.server:1521:my_sid
  • To access this in your pipeline , gitlab provides 2 ways
    • echo $Key will give the file path
    • cat $Key will give the contents of the file path
  • Output in the pipeline

Leave a Reply