|
| 1 | +--- |
| 2 | +title: GitLab Connection |
| 3 | +sidebarTitle: GitLab |
| 4 | +icon: gitlab |
| 5 | +--- |
| 6 | + |
| 7 | +To search projects on GitLab, you'll create a GitLab Connection. Using this connection, you can: |
| 8 | +- Index individual GitLab projects |
| 9 | +- Index all of the projects in a GitLab group/sub-group |
| 10 | +- Index all of the projects from a GitLab user |
| 11 | + |
| 12 | +<Note>If you want to index a private project/group, make sure you provide an [access token](/docs/access-tokens/overview)</Note> |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +# Config Schema |
| 17 | + |
| 18 | +For a detailed description of the schema, check out the schema file (TODO: link) |
| 19 | + |
| 20 | +<Tabs> |
| 21 | + <Tab title="All Visible"> |
| 22 | + <Note>This flag only works if your GitLab instance url is set and not equal to https://gitlab.com. Make sure you provide a [secret](/docs/access-tokens/secrets) containing the necessary access token to fetch your projects.</Note> |
| 23 | + If you'd like to index all projects visible to your GitLab instance, you can use the `all` flag. |
| 24 | + ```json |
| 25 | + { |
| 26 | + "type": "gitlab", |
| 27 | + "all": "true", |
| 28 | + "url": "https://gitlab.aperaturelabs.com" // This is required, and cannot be https://gitlab.com |
| 29 | + "token": { |
| 30 | + "secret": "MY_SECRET_KEY_NAME" // the name of the secret you created in Sourcebot |
| 31 | + } |
| 32 | + } |
| 33 | + ``` |
| 34 | + </Tab> |
| 35 | + <Tab title="Groups"> |
| 36 | + You can provide a list of groups (and recursive sub-groups) to index. Sourcebot will fetch all of the visible projects in these groups. Subgroups can be specified by providing the path to the subgroup (e.g. `my-group/sub-group-a`) |
| 37 | + ```json |
| 38 | + { |
| 39 | + "type": "gitlab", |
| 40 | + "groups": [ |
| 41 | + "gitlab-org/api", |
| 42 | + "veloren" |
| 43 | + ] |
| 44 | + // .. additional configs .. |
| 45 | + } |
| 46 | + ``` |
| 47 | + </Tab> |
| 48 | + <Tab title="Users"> |
| 49 | + You can provide a list of users to index. Sourcebot will fetch all of the visible projects for these users. |
| 50 | + ```json |
| 51 | + { |
| 52 | + "type": "gitlab", |
| 53 | + "users": [ |
| 54 | + "gnachman" |
| 55 | + ] |
| 56 | + // .. additional configs .. |
| 57 | + } |
| 58 | + ``` |
| 59 | + </Tab> |
| 60 | + <Tab title="Projects"> |
| 61 | + You can provide a list of projects to index. These must be provided in the `<owner>/<project_name>` syntax. |
| 62 | + ```json |
| 63 | + { |
| 64 | + "type": "gitlab", |
| 65 | + "projects": [ |
| 66 | + "inkscape/inkscape", |
| 67 | + "wireshark/wireshark" |
| 68 | + ] |
| 69 | + // .. additional configs .. |
| 70 | + } |
| 71 | + ``` |
| 72 | + </Tab> |
| 73 | + <Tab title="Custom URL"> |
| 74 | + If you're self-hosting you're own GitLab instance, you can provide a link to it: |
| 75 | + ```json |
| 76 | + { |
| 77 | + "type": "gitlab", |
| 78 | + "url": { |
| 79 | + "https://gitlab.aperaturelabs.com" |
| 80 | + } |
| 81 | + // .. additional configs .. |
| 82 | + } |
| 83 | + ``` |
| 84 | + </Tab> |
| 85 | + <Tab title="Token"> |
| 86 | + If you'd like to index private projects, make sure you provide a token. You can do so by referencing the [secret](/docs/access-tokens/secrets) that contains your token. |
| 87 | + ```json |
| 88 | + { |
| 89 | + "type": "gitlab", |
| 90 | + "token": { |
| 91 | + "secret": "MY_SECRET_KEY_NAME" |
| 92 | + } |
| 93 | + // .. additional configs .. |
| 94 | + } |
| 95 | + ``` |
| 96 | + </Tab> |
| 97 | +</Tabs> |
| 98 | +
|
| 99 | +### Filter Options |
| 100 | +
|
| 101 | +This connection type supports additional options for filtering which projects are indexed. |
| 102 | +
|
| 103 | +<Tabs> |
| 104 | + <Tab title="Topics"> |
| 105 | + You can provide a list of repository topics to include while fetching the projects. Only projects that match at least one of these topics will be fetched. |
| 106 | + ```json |
| 107 | + { |
| 108 | + "type": "gitlab", |
| 109 | + "topics": [ |
| 110 | + "docs", |
| 111 | + "core" |
| 112 | + ] |
| 113 | + // .. additional configs .. |
| 114 | + } |
| 115 | + ``` |
| 116 | + </Tab> |
| 117 | + <Tab title="Exclude Forks"> |
| 118 | + If enabled, forked projects will be ignored. |
| 119 | + ```json |
| 120 | + { |
| 121 | + "type": "gitlab", |
| 122 | + "exclude": { |
| 123 | + "forks": true |
| 124 | + // .. additional excludes .. |
| 125 | + } |
| 126 | + // .. additional configs .. |
| 127 | + } |
| 128 | + ``` |
| 129 | + </Tab> |
| 130 | + <Tab title="Exclude Archived"> |
| 131 | + If enabled, archived projects will be ignored. |
| 132 | + ```json |
| 133 | + { |
| 134 | + "type": "gitlab", |
| 135 | + "exclude": { |
| 136 | + "archived": true |
| 137 | + // .. additional excludes .. |
| 138 | + } |
| 139 | + // .. additional configs .. |
| 140 | + } |
| 141 | + ``` |
| 142 | + </Tab> |
| 143 | + <Tab title="Exclude Projects"> |
| 144 | + You can provide a list of projects to exclude. These must be provided in the `<owner>/<repo_name>` syntax. |
| 145 | + ```json |
| 146 | + { |
| 147 | + "type": "gitlab", |
| 148 | + "exclude": { |
| 149 | + "projects": [ |
| 150 | + "sourcebot-dev/zoekt", |
| 151 | + "torvalds/linux" |
| 152 | + ] |
| 153 | + // .. additional excludes .. |
| 154 | + } |
| 155 | + // .. additional configs .. |
| 156 | + } |
| 157 | + ``` |
| 158 | + </Tab> |
| 159 | + <Tab title="Exclude Topics"> |
| 160 | + You can provide a list of topics to ignore. Projects that contain any of these topics will be ignored |
| 161 | + ```json |
| 162 | + { |
| 163 | + "type": "gitlab", |
| 164 | + "exclude": { |
| 165 | + "topics": [ |
| 166 | + "ci", |
| 167 | + "experimental" |
| 168 | + ] |
| 169 | + // .. additional excludes .. |
| 170 | + } |
| 171 | + // .. additional configs .. |
| 172 | + } |
| 173 | + ``` |
| 174 | + </Tab> |
| 175 | +</Tabs> |
0 commit comments