After using rules, when the first task in the stage fails, the following tasks are not ignored.

Summary

After using rules, When the build task in the stages fails, test task should be ignored.

  rules:
    - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "qa"'
      when: always

gitlab-ci.yml

stages:
  - build
  - test
build:
  stage: build
  tags:
    - golang-build
  script:
    - echo1 'build'
  rules:
    - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "qa"'
      when: always

test: 
  stage: test
  tags:
    - golang-build
  script:
   - echo 'test'
  rules:
    - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "qa"'
      when: always

Steps to reproduce

wrong effect: https://gitlab.p2shop.cn:8443/devops-test/test-pipeline-one/merge_requests/1/pipelines

After replacing the rules with only, I got the desired effect.

expect effect: https://gitlab.p2shop.cn:8443/devops-test/test-pipeline-one/merge_requests/2/pipelines

What is the current bug behavior?

When the build task in the stages fails, test task continues to execute. 12

What is the expected correct behavior?

When the build task in the stages fails, test task is ignore. 14

Edited Oct 10, 2019 by xiaoxinmiao
Assignee Loading
Time tracking Loading