Last active
April 30, 2018 07:44
-
-
Save YordanGeorgiev/85fb6c1e5d0078b7acc30419d6b57623 to your computer and use it in GitHub Desktop.
[gitlab api via curl] how-to use gitlab api via curl #curl #gitlab #api #gitlab-api #private-token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s -X GET \ | |
--header "Private-Token: $gitlab_private_token" \ | |
"$gitlab_url""$gitlab_proj_id" | jq . | |
echo get the pipelines | |
curl -s -X GET --header "Private-Token: $gitlab_private_token" \ | |
"$gitlab_url""$gitlab_proj_id"/pipelines | jq . | |
echo get a job by id | |
job_id=1157220 | |
curl -s -X GET --header "Private-Token: $gitlab_private_token" \ | |
"$gitlab_url""$gitlab_proj_id"/jobs/$job_id | jq . | |
echo erase a job by id | |
job_id=1159386 | |
curl -s -X POST --header "Private-Token: $gitlab_private_token" \ | |
"$gitlab_url""$gitlab_proj_id"/jobs/$job_id/erase | jq . | |
echo retry a job by id | |
job_id=1159386 | |
curl -s -X POST --header "Private-Token: $gitlab_private_token" \ | |
"$gitlab_url""$gitlab_proj_id"/jobs/$job_id/retry | jq . | |
echo get a single pipeline id | |
export pipeline_id=472981 | |
curl -s -X GET --header "Private-Token: $gitlab_private_token" \ | |
"$gitlab_url""$gitlab_proj_id"/pipelines/$pipeline_id | jq . | |
echo how-to cancel all the jobs of a pipeline by pipeline id | |
export pipeline_id=472981 | |
curl -s -X POST --header "Private-Token: $gitlab_private_token" \ | |
"$gitlab_url""$gitlab_proj_id"/pipelines/$pipeline_id/cancel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment