title: Dynamically setup gitlab-ci cache.key
body: <p>It there a way to set up cache: key: dynamically, like this:</p>
  <pre><code>cache:
      key: if $CI_PIPELINE_SOURCE -eq 'merge_request_event' { &quot;MR_$CI_MERGE_REQUEST_TRAGET_BRANCH_NAME_CACHE&quot; } else { &quot;PUSH_$CI_COMMIT_REF_NAME_CACHE&quot; }
  </code></pre>
  <p>Or maybe there is a way to define a pipile variable dynamically:</p>
  <pre><code>variables:
      CACHE_KEY: if $CI_PIPELINE_SOURCE -eq 'merge_request_event' { &quot;MR_$CI_MERGE_REQUEST_TRAGET_BRANCH_NAME_CACHE&quot; } else { &quot;PUSH_$CI_COMMIT_REF_NAME_CACHE&quot; }                            
  
  cache:
      key: $CACHE_KEY
  </code></pre>