Skip to content

Expose short token in REST and GraphQL

  • Please check this box if this contribution uses AI-generated content as outlined in the GitLab DCO & CLA

What does this MR do and why?

This MR adds the trigger_short_token field to the REST and GraphQL APIs as requested in #384360. This is needed to be able to check if a pipeline was triggered via a trigger token and to check which trigger token was used.

This MR also addds the field to the docs.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a trigger token by navigating to Settings -> CI/CD -> Pipeline trigger tokens
  2. Create a pipeline by sending a POST request to https://<instance url>/api/v4/projects/<project_id>/ref/<ref_name>/trigger/pipeline?token=<token>
  3. Verify the job was created and the short token is visible in the job details
  4. Send a GET request to /api/v4/projects/:id/jobs
  5. Send the following GraphQL query:
query showShortToken {
  project(fullPath: "<project path>") {
    jobs {
      nodes {
        triggerShortToken
      }
    }
  }
}
  1. Verify that trigger_short_token has a value
Edited by 🤖 GitLab Bot 🤖

Merge request reports