Can't delete package with CI_JOB_TOKEN

I’m running job that should delete package via api as a project maintainer user, but gets {“message”:“401 Unauthorized”} .

  • What are you seeing, and how does that differ from what you expect to see?
    Package is deleted

  • Consider including screenshots, error messages, and/or other helpful visuals

  • What version are you on? Are you using self-managed or

    • GitLab (Hint: /help): 13.7.1
    • Runner (Hint: /admin/runners): 13.4.1
  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)

    - .default
    - .default-cache
  stage: Publish Compiled Project
  #  refs:
  #    - master
    - Compile
    - 'curl --request DELETE --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://<instance_url>/api/v4/projects/605/packages/1"'
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
    I have already tried to delete this package using access token issued from the same user that ran the job

Thanks for taking the time to be thorough in your request, it really helps! :blush: