Skip to content

Parent resource is not locked with parent job retry

I have parent-child structure in my pipeline where I set a resource_group in the parent to lock that resource during each child job execution (and in the child jobs I use an other resource_group to lock an additional resoure). This scenario works if the pipeline is automatically triggered, but does not work if there is a failure in a downstream job and I retry the parent job. In this case only the child job’s resource is locked the parent job’s does not

Used GitLab Community Edition 15.8.1

trigger-ci.yml

parent-job:
  trigger:
    include: child-ci.yml
    strategy: depend
  resource_group: RESOURCE1

child-ci.yml

child-job:
  resource_group: RESOURCE2

Technical proposal

We are not locking the resources after a retry...

I suspect this code block;

      event :enqueue do
        transition [:created, :skipped, :manual, :scheduled] => :waiting_for_resource, if: :with_resource_group?
      end

We are changing the status of a build to waiting_for_resource only when the previous status is one of :created, :skipped, :manual, :scheduled.

This is just a first assumption, we may investigate further and find a solution.

Edited by Furkan Ayhan