Skip to content
Snippets Groups Projects

Fix CI rules-if comparison with Regexp variables

Merged Furkan Ayhan requested to merge 35438-ci-variable-comparison-with-regexp into master

What does this MR do and why?

When the right side of a =~ or !~ comparison is a regexp variable, we consider this as a string. However, we need to try converting it to a regexp if possible.

In this MR, we start to try to consider the right side of an expression as a regexp.

Related to #35438 (closed)

This fix is behind a feature flag ci_fix_rules_if_comparison_with_regexp_variable (#359740 (closed)).

Screenshots or screen recordings

  1. Example CI pipeline config:
variables:
  teststring: 'abcde'
  pattern: '/^ab.*/'

test1:
  script: exit 0
  rules:
    - if: '$teststring =~ $pattern'

test2:
  script: exit 0
  rules:
    - if: '$teststring =~ /^ab.*/'
  1. Run a pipeline;

test1 is not included in the pipeline.

Screen_Shot_2022-04-18_at_13.08.31

  1. Enable ci_fix_rules_if_comparison_with_regexp_variable and run a pipeline;
Feature.enable(:ci_fix_rules_if_comparison_with_regexp_variable)

test1 is included in the pipeline.

Screen_Shot_2022-04-18_at_13.10.10

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Furkan Ayhan

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Furkan Ayhan
  • Allure report

    allure-report-publisher generated test report!

    package-and-qa-ff-enabled: :pencil: test report
    package-and-qa-ff-disabled: :pencil: test report

    package-and-qa-ff-disabled: :exclamation: test report for e9b42a6e

    expand test summary
    +-------------------------------------------------------------------+
    |                          suites summary                           |
    +----------------------+--------+--------+---------+-------+--------+
    |                      | passed | failed | skipped | flaky | result |
    +----------------------+--------+--------+---------+-------+--------+
    | Manage               | 91     | 0      | 6       | 0     | ✅     |
    | Create               | 148    | 0      | 7       | 11    | ❗     |
    | Verify               | 33     | 0      | 8       | 5     | ❗     |
    | Plan                 | 53     | 0      | 0       | 2     | ❗     |
    | Secure               | 15     | 0      | 6       | 7     | ❗     |
    | Package              | 0      | 0      | 3       | 0     | ➖     |
    | Version sanity check | 0      | 0      | 1       | 0     | ➖     |
    | Release              | 6      | 0      | 0       | 2     | ❗     |
    | Fulfillment          | 2      | 0      | 10      | 0     | ✅     |
    | Configure            | 0      | 0      | 3       | 0     | ➖     |
    | Protect              | 2      | 0      | 0       | 0     | ✅     |
    | Non-devops           | 2      | 0      | 0       | 0     | ✅     |
    +----------------------+--------+--------+---------+-------+--------+
    | Total                | 352    | 0      | 44      | 27    | ❗     |
    +----------------------+--------+--------+---------+-------+--------+
    **package-and-qa-ff-enabled**: :exclamation: test report for e9b42a6e
    expand test summary
    +-------------------------------------------------------------------+
    |                          suites summary                           |
    +----------------------+--------+--------+---------+-------+--------+
    |                      | passed | failed | skipped | flaky | result |
    +----------------------+--------+--------+---------+-------+--------+
    | Create               | 148    | 0      | 7       | 11    | ❗     |
    | Release              | 6      | 0      | 0       | 2     | ❗     |
    | Configure            | 0      | 0      | 3       | 0     | ➖     |
    | Non-devops           | 2      | 0      | 0       | 0     | ✅     |
    | Verify               | 33     | 0      | 8       | 5     | ❗     |
    | Plan                 | 53     | 0      | 0       | 2     | ❗     |
    | Package              | 0      | 0      | 3       | 0     | ➖     |
    | Manage               | 91     | 0      | 6       | 0     | ✅     |
    | Fulfillment          | 2      | 0      | 10      | 0     | ✅     |
    | Secure               | 15     | 0      | 6       | 7     | ❗     |
    | Version sanity check | 0      | 0      | 1       | 0     | ➖     |
    | Protect              | 2      | 0      | 0       | 0     | ✅     |
    +----------------------+--------+--------+---------+-------+--------+
    | Total                | 352    | 0      | 44      | 27    | ❗     |
    +----------------------+--------+--------+---------+-------+--------+
    **review-qa-blocking**: :exclamation: test report for e9b42a6e
    expand test summary
    +-------------------------------------------------------------------+
    |                          suites summary                           |
    +----------------------+--------+--------+---------+-------+--------+
    |                      | passed | failed | skipped | flaky | result |
    +----------------------+--------+--------+---------+-------+--------+
    | Manage               | 31     | 0      | 2       | 29    | ❗     |
    | Create               | 24     | 0      | 2       | 22    | ❗     |
    | Protect              | 2      | 0      | 0       | 2     | ❗     |
    | Plan                 | 41     | 0      | 1       | 41    | ❗     |
    | Package              | 0      | 0      | 1       | 0     | ➖     |
    | Verify               | 12     | 0      | 1       | 12    | ❗     |
    | Configure            | 0      | 0      | 1       | 0     | ➖     |
    | Version sanity check | 0      | 0      | 1       | 0     | ➖     |
    +----------------------+--------+--------+---------+-------+--------+
    | Total                | 110    | 0      | 9       | 106   | ❗     |
    +----------------------+--------+--------+---------+-------+--------+
    Edited by Ghost User
  • Marcel Amirault removed review request for @marcel.amirault

    removed review request for @marcel.amirault

  • Furkan Ayhan added 505 commits

    added 505 commits

    Compare with previous version

  • requested review from @marcel.amirault

  • Furkan Ayhan requested review from @matteeyah

    requested review from @matteeyah

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading