When using inputs only the first variable ($[[ inputs.varname ]]) is replaced on each line, generating wrong gitlab-ci files
### Summary When processing inputs on `gitlab-ci` only the first input variable found is replaced, leaving the rest untouched (i.e. if a line contains `$[[ inputs.v1 ]] $[[ inputs.v2 ]] $[[ inputs.v1 ]]` the value after the expansion is `value_of_v1 $[[ inputs.v2 ]] value_of_v1`) ### Steps to reproduce Create an input file that uses more than one input variable on a rule and see that only the first value is expanded. ### Example Project https://gitlab.com/stalensoliag/wrong-inputs-processing-poc ### What is the current *bug* behavior? The expanded pipeline has syntax errors because the variables are not expanded ### What is the expected *correct* behavior? All the input variables are replaced by ther values. ### Relevant logs and/or screenshots #### Code on the previous project `.gitlab-ci.yml`: ``` include: - local: '/gitlab-ci-dumb-job.yml' inputs: main_branch: master ``` `gitlab-ci-dumb-job.yml`: ``` spec: inputs: dev_branch: default: 'develop' main_branch: default: 'main' rel_branch: default: 'release' --- dumb_job: rules: - if: $CI_COMMIT_BRANCH == "$[[ inputs.dev_branch ]]" || $CI_COMMIT_BRANCH == "$[[ inputs.main_branch ]]" || $CI_COMMIT_BRANCH == "$[[ inputs.rel_branch ]]" - when: never script: - echo "Dumb job for '$[[ inputs.dev_branch ]]', '$[[ inputs.main_branch ]]' or '$[[ inputs.rel_branch ]]'" - echo "Testing if we put the same input two times '$[[ inputs.dev_branch ]]' & '$[[ inputs.dev_branch ]]'" stage: test ``` #### Message from the pipeline ```Unable to create pipeline jobs:dumb_job:rules:rule if invalid expression syntax``` #### Full configuration from the pipeline editor ``` --- dumb_job: rules: - if: $CI_COMMIT_BRANCH == "develop" || $CI_COMMIT_BRANCH == "$[[ inputs.main_branch ]]" || $CI_COMMIT_BRANCH == "$[[ inputs.rel_branch ]]" - when: never script: - echo "Dumb job for 'develop', '$[[ inputs.main_branch ]]' or '$[[ inputs.rel_branch ]]'" - echo "Testing if we put the same input two times 'develop' & 'develop'" stage: test ``` As you can see neither `main_branch` nor `rel_branch` inputs have been expanded. ### Output of checks This bug happens on GitLab.com
issue