canceling or deleting pipeline from within pipeline
Problem to solve
I would like to cancel or delete a pipeline from within a test in the pipeline.
I try
curl --request "DELETE" --header "PRIVATE-TOKEN:CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/MYPROJECTID/pipelines/CI_PIPELINE_ID"
it responds with no output and an exit code of 0. It does not delete the pipeline
If I run directly from my shell but use my gitlab private token instead of $CI_JOB_TOKEN" the pipeline is deleted.
The same thing is true if I try to cancel a pipeline.
Obviously I cannot include my gitlab private token in the .gitlab-ci.yml file so how can I manage this?
And if the cancel or delete does not succeed shouldn't the curl return an error message? Silent ignore is not friendly.
Thanks
Edited by 🤖 GitLab Bot 🤖