BigW Consortium Gitlab

projects.md 3.18 KB
Newer Older
1 2 3
# Projects API

This API is intended to aid in the setup and configuration of
Robert Schilling committed
4
projects on GitLab CI.
5 6 7 8 9 10 11 12 13 14

__Authentication is done by GitLab user token & GitLab url__

## Projects

### List Authorized Projects

Lists all projects that the authenticated user has access to.

```
15
GET /ci/projects
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
```

Returns:

```json
    [
  {
    "id" : 271,
    "name" : "gitlabhq",
    "timeout" : 1800,
    "token" : "iPWx6WM4lhHNedGfBpPJNP",
    "default_ref" : "master",
    "gitlab_url" : "http://demo.gitlabhq.com/gitlab/gitlab-shell",
    "path" : "gitlab/gitlab-shell",
    "always_build" : false,
    "polling_interval" : null,
    "public" : false,
    "ssh_url_to_repo" : "git@demo.gitlab.com:gitlab/gitlab-shell.git",
    "gitlab_id" : 3
  },
  {
    "id" : 272,
    "name" : "gitlab-ci",
    "timeout" : 1800,
    "token" : "iPWx6WM4lhHNedGfBpPJNP",
    "default_ref" : "master",
    "gitlab_url" : "http://demo.gitlabhq.com/gitlab/gitlab-shell",
    "path" : "gitlab/gitlab-shell",
    "always_build" : false,
    "polling_interval" : null,
    "public" : false,
    "ssh_url_to_repo" : "git@demo.gitlab.com:gitlab/gitlab-shell.git",
    "gitlab_id" : 4
  }
]
```

### List Owned Projects

Lists all projects that the authenticated user owns.

```
58
GET /ci/projects/owned
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
```

Returns:

```json
[
  {
    "id" : 272,
    "name" : "gitlab-ci",
    "timeout" : 1800,
    "token" : "iPWx6WM4lhHNedGfBpPJNP",
    "default_ref" : "master",
    "gitlab_url" : "http://demo.gitlabhq.com/gitlab/gitlab-shell",
    "path" : "gitlab/gitlab-shell",
    "always_build" : false,
    "polling_interval" : null,
    "public" : false,
    "ssh_url_to_repo" : "git@demo.gitlab.com:gitlab/gitlab-shell.git",
    "gitlab_id" : 4
  }
]
```

### Single Project

Returns information about a single project for which the user is
authorized.

87
    GET /ci/projects/:id
88 89 90

Parameters:

Robert Schilling committed
91
  * `id` (required) - The ID of the GitLab CI project
92 93 94

### Create Project

Robert Schilling committed
95
Creates a GitLab CI project using GitLab project details.
96

97
    POST /ci/projects
98 99 100 101

Parameters:

  * `name` (required) - The name of the project
Robert Schilling committed
102
  * `gitlab_id` (required) - The ID of the project on the GitLab instance
103 104 105 106
  * `default_ref` (optional) - The branch to run on (default to `master`)

### Update Project

Robert Schilling committed
107
Updates a GitLab CI project using GitLab project details that the
108 109
authenticated user has access to.

110
    PUT /ci/projects/:id
111 112 113 114 115 116 117 118

Parameters:

  * `name` - The name of the project
  * `default_ref` - The branch to run on (default to `master`)

### Remove Project

Robert Schilling committed
119
Removes a GitLab CI project that the authenticated user has access to.
120

121
    DELETE /ci/projects/:id
122 123 124

Parameters:

Robert Schilling committed
125
  * `id` (required) - The ID of the GitLab CI project
126 127 128 129 130 131

### Link Project to Runner

Links a runner to a project so that it can make builds (only via
authorized user).

132
    POST /ci/projects/:id/runners/:runner_id
133 134 135

Parameters:

Robert Schilling committed
136 137
  * `id` (required) - The ID of the GitLab CI project
  * `runner_id` (required) - The ID of the GitLab CI runner
138 139 140 141 142 143

### Remove Project from Runner

Removes a runner from a project so that it can not make builds (only
via authorized user).

144
    DELETE /ci/projects/:id/runners/:runner_id
145 146 147

Parameters:

Robert Schilling committed
148 149
  * `id` (required) - The ID of the GitLab CI project
  * `runner_id` (required) - The ID of the GitLab CI runner