curl --header "token=<TOKEN>" "<PROJECT_API_URL>/<REQUEST_SPECIFICS>"
Here, ‘TOKEN’ is an access token. For instance, you can create a personal token (see here)
within your user profile settings. When a job is started within the GitLab
, the variable ‘CI_JOB_TOKEN’ is available.
However, with this token you have limited privileges
(see this readme).
Therefore, you can create a project token
which you can then use in your
# information on recently run pipelines curl --header "token=<TOKEN>" "<PROJECT_API_URL>/pipelines" # information on a specific pipeline with the id 'ID' curl --header "token=<TOKEN>" "<PROJECT_API_URL>/pipelines/<ID>" # information on a particular commit with the SHA 'SHA' curl --header "token=<TOKEN>" "<PROJECT_API_URL>/repository/commits/<SHA>"
The information is returned in the form of json dictionaries with fields as ‘last_pipeline’ e.g. This way you can check if a pipeline has already started or succeeded for a specific commit.