Skip to content

Trigger API doesn't allow building a specific SHA1 reference, only a branch (e.g. master)

Summary

The trigger API documented in https://docs.gitlab.com/ce/ci/triggers/README.html state that specific commits can be build with the API, however I fail to trigger a build for anything except a branch.

Steps to reproduce

Local Gitlab CE 8.11.5 installation with the following .gitlab-ci.yml on the master branch:

build:
  stage: build
  script:
      - make -C t

Adding a trigger token and then running the following command as given on the trigger page:

curl -X POST \
     -F token=TOKEN \
     -F ref=REF_NAME \
     https://gitlab.example.org/api/v3/projects/42/trigger/builds

With REF_NAME given as master everything works and the build is triggered. However when I specify a commit via its SHA1, I only get the following output and no build is triggered:

{"message":"No builds created"}