GitLab
GitLab resources allow you to link GitLab projects to a Coscine project and add your own metadata to them. This enables you to manage all your data in one place
Properties of a GitLab resource
- Storage space: As GitLab resources do not store any data in Coscine but merely link to it, this resource does not require any storage space.
- Use cases: GitLab projects
- Access methods: User interface, API
- Metadata: When creating a GitLab resource, a metadata profile is selected. This can be populated in Coscine for every file in the GitLab project.
- Other special features: The security and accessibility of the data depend on the linked GitLab provider. Coscine accepts no responsibility for this data. A GitLab resource can be set to read-only mode. This makes all metadata entered in Coscine for the files read-only. This does not result in any changes to your GitLab project.
Creating and using a GitLab resource
- When creating a resource, select
GitLabin step 1. This will open the page for setting up a GitLab resource (see Figure 1). - Enter the full domain of the GitLab instance you are using (e.g.
https://gitlab.git.nrw). - Enter the access token for the GitLab project or GitLab group that you wish to link to Coscine.
- Verify the GitLab connection by clicking the blue button labelled
Verify GitLab connection. - Select the GitLab project and GitLab branch from the drop-down lists.
- Accept your GitLab provider’s Terms of Service and Privacy Policy. As the provider of the GitLab instance varies (institutions can each set up and manage their own GitLab instance), you must be aware of and comply with the terms and conditions applicable to you as set out by your provider.
Once the GitLab resource has been created, it will display all the files contained within the GitLab project. Depending on the permissions of the GitLab access token being used, various actions can be performed on the files via Coscine. In addition, as with other Coscine resources, metadata for individual files can be entered within a GitLab resource.
Warning: The permissions associated with the GitLab access token and Coscine roles are independent of one another
The defined roles and scopes of the access token determine the extent to which Coscine can access files (e.g. read or write permissions). The Coscine roles determine which members of the Coscine project are granted file access. This distinction is particularly important if the users in the linked GitLab project do not correspond to the members of the Coscine project.
GitLab access token in Coscine
To integrate GitLab projects as resources, Coscine uses GitLab access tokens. Users can create these tokens in GitLab under Settings > Access Tokens to grant permissions at group and project level (see Figure 2). This option is only visible to users with owner permissions in GitLab. GitLab access tokens can be created individually at group and project level.
Depending on the permissions granted to Coscine by the GitLab access token, the following actions are possible:
- Viewing GitLab files in Coscine
- Uploading files to GitLab via Coscine
- Overwriting files in GitLab via Coscine
- Deleting files in GitLab via Coscine
Regardless of the permissions associated with the GitLab access token, different access rights can also be assigned in Coscine Roles.
Required permissions for the GitLab access token
Seamless communication between Coscine and GitLab requires specific permissions for the GitLab access token, known as scopes.
The api scope is mandatory to ensure that the GitLab access token is authorised to use the GitLab API’s functionality (see Figure 3). Coscine is therefore able to perform all actions, such as reading and writing files.
With regard to roles, it is recommended that you assign the GitLab access token the role Maintainer or, at the very least, the role Developer (see Figure 4). As a rule of thumb, you should choose the role for the GitLab access token as if Coscine were a regular user in your GitLab group or project.