Pipeline / Job variables of type "File" don't preserve line breaks
Summary
When starting pipelines or jobs manually, we can provide variables. We can choose between the
two types Variable and File. Just like in the Project > Settings > CI/CD > Variables.
But unlike there, line breaks in variables of the type File are not preserved.
https://gitlab.com/trallnag/showcase-bug-variable-file-linebreaks
Steps to reproduce
-
Create a .gitlab-ci.yml with the following content. Commit and push. You can ignore / cancle the pipeline that gets triggered now automaticaly.
stages: - main main: stage: main script: - cat $var_file_type_from_project - cat $var_file_type_from_pipeline -
Go to "CICD > Pipelines > Run Pipeline" and set a variable of the type
Filewith the namevar_file_type_from_pipeline. Paste into the value field the following multiline string. You will see that the line breaks are removed.line1 line2 -
Run the pipeline and check the logs. The line breaks are removed.
-
Now we compare this to variables of the type
Fileset in the project settings. -
Run the pipeline and check the logs. The line breaks are preserved. This is the expected behavior.
Example Project
https://gitlab.com/trallnag/showcase-bug-variable-file-linebreaks
What is the current bug behavior?
Line breaks are removed.
What is the expected correct behavior?
Line breaks should be preserved just like with File variables set in the project settings.
Results of GitLab environment info
gitlab.com


