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: 📝 test report
    package-and-qa-ff-disabled: 📝 test report

    package-and-qa-ff-disabled: 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**: 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**: 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   | ❗     |
    +----------------------+--------+--------+---------+-------+--------+
  • 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

  • Marcel Amirault removed review request for @marcel.amirault

    removed review request for @marcel.amirault

  • Furkan Ayhan added 1 commit

    added 1 commit

    • 77b98134 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Marcel Amirault approved this merge request

    approved this merge request

  • 👋 @marcel.amirault, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.

    For more info, please refer to the following links:

  • Matija Čupić approved this merge request

    approved this merge request

  • Matija Čupić requested review from @grzesiek

    requested review from @grzesiek

  • Matija Čupić removed review request for @grzesiek and @matteeyah

    removed review request for @grzesiek and @matteeyah

  • Grzegorz Bizon requested review from @grzesiek

    requested review from @grzesiek

  • Grzegorz Bizon
  • Grzegorz Bizon
  • Grzegorz Bizon removed review request for @grzesiek

    removed review request for @grzesiek

  • Furkan Ayhan requested review from @grzesiek

    requested review from @grzesiek

  • Grzegorz Bizon removed review request for @grzesiek

    removed review request for @grzesiek

  • Furkan Ayhan added 422 commits

    added 422 commits

    Compare with previous version

  • Furkan Ayhan requested review from @grzesiek

    requested review from @grzesiek

  • Furkan Ayhan added 2041 commits

    added 2041 commits

    Compare with previous version

  • mentioned in issue #35438 (closed)

  • Grzegorz Bizon removed review request for @grzesiek

    removed review request for @grzesiek

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