Requeue job on system failure

Hi,

I have a strange licence requirement for a compiler which I can check by running a command line process.

.gitlab-ci.yml

myJob:
    stage: build
    tags:
        - myTag   
    before_script:
    - checkLicence.exe
    script:
    - run.exe

If checkLicence.exe fails, I want to disable the runner (this works).

I then want to re-queue the job so that it can be picked up by a different runner with a valid licence.

Instead of the job being automatically re-queued, I get build failure: ERROR: Job failed (system failure): aborted:

If this can’t be done, is there another way for the runner to reject the job after performing an initial check?

Cheers,

Tom

Hej,

you can create a second stage which triggers the pipeline again via the REST API.

trigger:
  stage: trigger
  before_script:
    - "apt update"
    - "apt -y install curl"
  script:
    - curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.com/api/v4/projects/<project id>/trigger/pipeline
  when: always

To give it some time before the next trigger you can add another stage between with a delayed job.
You don’t need to schedule the pipeline instead trigger it once and it will trigger itself continuously.
Keep in mind that if the trigger fails the whole pipeline can stop so I recommend to at a mechanism to notify you about this.