title: Gitlab CI conditional statement does not work as expected: Both AND and OR conditions
body: <p>I would like to have the following condition for a job in Gitlab CI (Gitlab cloud).</p>
  
  <ul>
  <li>The destination branch should be either <code>master</code> or <code>production</code></li>
  <li>The commit should have a tag associated with it with the pattern of <code>vx.x.x</code> or <code>vx.x</code></li>
  </ul>
  
  <p>First, I thought the following statement should work:</p>
  
  <pre><code>only:
        - master
        - production
  only:
        - tags
  only:
        - /^v[0-9](?:\.[0-9]){2,3}/
  </code></pre>
  
  <p>But it turns out no matter how you arrange <code>only</code> it always considers the different statements as <code>OR</code>. So I came with the following statement to see if I can address it properly:</p>
  
  <pre><code>only:
        - tags
        - /^v[0-9](?:\.[0-9]){2,3}/
  except:
        - /^(?!master)/
        - /^(?!production)/
  </code></pre>
  
  <p>That didn't work either. Then I thought I should be able to use <code>rules</code> which is very recently added to Gitlab CI:</p>
  
  <pre><code>rules:  
        - if: '($CI_MERGE_REQUEST_TARGET_BRANCH == "master" || $CI_MERGE_REQUEST_TARGET_BRANCH == "production") &amp;&amp; $CI_COMMIT_TAG =~ /^v[0-9](?:\.[0-9]){2,3}/'
          when: always
  </code></pre>
  
  <p>However, turns out the syntax is incorrect and using parentheses is not allowed. Then I came to the following statement:</p>
  
  <pre><code>rules: 
        - if: '$CI_MERGE_REQUEST_TARGET_BRANCH == "master" &amp;&amp; $CI_COMMIT_TAG =~ /^v[0-9](?:\.[0-9]){2,3}/'
          when: always
        - if: '$CI_MERGE_REQUEST_TARGET_BRANCH == "production" &amp;&amp; $CI_COMMIT_TAG =~ /^v[0-9](?:\.[0-9]){2,3}/'
          when: always
  </code></pre>
  
  <p>But the above statement did not work either. I would appreciate if someone can help me to understand how the requested conditions can be met in Gitlab CI.</p>