Backend: Retry job API fails with 404 for bridge jobs
Summary
Retry a job API call returns 404
response for bridge jobs.
Steps to reproduce
- Create a new project.
- Add a file
trigger.yml
with 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 trigger job. Alternatively you can find the trigger job id on GitLab UI.
- Retry the trigger job via API. It gives back 404 status back:
emunn@elif-dev gitlab % curl --request POST --header "PRIVATE-TOKEN: $GITLAB_PAT_API" "https://gitlab.com/api/v4/projects/$MY_RETRY_PROJECT_ID/jobs/$BRIDGE_JOB_ID/retry"
{"message":"404 Not found"}%
Example Project
https://gitlab.com/e_munn_ultimate_group/tests/ci-tests/retry
What is the current bug behavior?
A bridge job cannot be retried via REST API.
What is the expected correct behavior?
We should be able to re-run the bridge job via API.
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/jobs/$BRIDGE_JOB_ID/retry"
{"message":"404 Not found"}%
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)