Retry jobs in a pipeline API does not work for child pipelines
Summary
Retry jobs in a pipeline API returns a response that looks like it worked. However the downstream pipeline doesn't run.
Steps to reproduce
- Create a new project.
- Add a file
trigger.ymlwith content:
my-downstream-job:
stage: test
script:
- echo "Hello, world! I am from downstream pipeline"
- Add .gitlab-ci.yml with content:
stages:
- build
- test
build:
stage: build
script:
- echo "$CI_JOB_NAME" > job.txt
test:
stage: test
script:
- echo "$CI_JOB_NAME"
needs:
- build
trigger:
stage: test
trigger:
include:
- local: trigger.yml
- Let the pipeline run. It will run a child pipeline with 1 job (
my-downstream-job) - Get a list of pipeline trigger jobs via API. Note the id of the downstream pipeline. Alternatively you can find the downstream pipeline id on GitLab UI.
curl -s --header "PRIVATE-TOKEN: $GITLAB_PAT_API" "https://gitlab.com/api/v4/projects/$MY_RETRY_PROJECT_ID/pipelines/$PIPELINE_ID/bridges" | jq '.[].downstream_pipeline.id'
1255915646
emunn@elif-dev kubesos-15042024233845 % curl --request POST --header "PRIVATE-TOKEN: $GITLAB_PAT_API" "https://gitlab.com/api/v4/projects/$MY_RETRY_PROJECT_ID/pipelines/$DOWNSTREAM_PIPELINE_ID/retry"
- The response looks like successful; however
started_atandfinished_atare showing original timestamps and child pipeline doesn't re-run.
Example Project
https://gitlab.com/e_munn_ultimate_group/tests/ci-tests/retry
What is the current bug behavior?
Child pipeline doesn't run after executing the retry pipeline API call.
What is the expected correct behavior?
Child pipeline should start running.
Relevant logs and/or screenshots
emunn@elif-dev gitlab % curl --request POST --header "PRIVATE-TOKEN: $GITLAB_PAT_API" "https://gitlab.com/api/v4/projects/$MY_RETRY_PROJECT_ID/pipelines/$DOWNSTREAM_PIPELINE_ID/retry"
{"id":1255915646,"iid":5,"project_id":56309294,"sha":"c0b0c2630c57aa2c7f66bd686687161a77a0afda","ref":"main","status":"success","source":"parent_pipeline","created_at":"2024-04-16T22:24:15.068Z","updated_at":"2024-04-16T22:24:44.081Z","web_url":"https://gitlab.com/e_munn_ultimate_group/tests/ci-tests/retry/-/pipelines/1255915646","before_sha":"5b4c5c36771abba91607cfe3b15d3ea47b8afef5","tag":false,"yaml_errors":null,"user":{"id":8864904,"username":"e_munn","name":"Elif Munn","state":"active","locked":false,"avatar_url":"https://gitlab.com/uploads/-/system/user/avatar/8864904/avatar.png","web_url":"https://gitlab.com/e_munn"},"started_at":"2024-04-16T22:24:16.040Z","finished_at":"2024-04-16T22:24:44.074Z","committed_at":null,"duration":28,"queued_duration":null,"coverage":null,"detailed_status":{"icon":"status_success","text":"Passed","label":"passed","group":"success","tooltip":"passed","has_details":false,"details_path":"/e_munn_ultimate_group/tests/ci-tests/retry/-/pipelines/1255915646","illustration":null,"favicon":"/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png"}}%
Output of checks
This bug happens on GitLab.com
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)