Policy Job ignores needs order when dependent from parallel matrix
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Steps to reproduce
- In a Top-Level group, create a Pipeline Execution Policy and
includea policy project, like the following:
pipeline_execution_policy:
- name: test_policy_v1
description: ''
enabled: true
policy_scope:
projects:
excluding: []
pipeline_config_strategy: inject_policy
content:
include:
- project: asalii_ultimate_group/policy_v1
ref: main
file: policy_v1.yml
suffix: never
variables_override:
allowed: false
exceptions: []
- In
policy_v1.yml, create a job withneedsdependency:
policy_job:
script: echo "policy_job runs"
needs:
- job: "dependency-job"
artifacts: true
optional: true
- Under the group, create a project with
.gitlab-ci.ymlwith aparallel:matrixjob:
dependency-job:
stage: build
script:
- echo "this is my test job"
- sleep 120
parallel:
matrix:
- PROVIDER: aws
- PROVIDER: gcc
- Start a pipeline
What is the current bug behavior?
The pipeline UI shows job relations via needs , but the dependent job starts earlier
What is the expected correct behavior?
The dependent via needs job should wait for jobs in needs dependency to finish and generate artifacts.
Two conditions are important:
-
needsrelation should be added by a Policy job - The job in
needsshould haveparallel:matrix
When the dependency job is not a parallel:matrix, the jobs order works as intended.
If the needs relation is set in the project's job and not set by a Policy job, the relation works as intended.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: \\\`sudo gitlab-rake gitlab:env:info\\\`) (For installations from source run and paste the output of: \\\`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\\\`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:check SANITIZE=true\`) (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true\`) (we will only investigate if the tests are passing)
Possible fixes
Patch release information for backports
If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.
Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.
High-severity bug remediation
To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.
