GitLab plugin
For more information about what this plugin does and the data streams it retrieves, see:
Monitor the CI/CD metrics from your GitLab environment.
To add a data source click on the + next to Data Sources on the left-hand menu in SquaredUp. Search for the data source and click on it to open the Configure data source page.
Before you start
Create a GitLab API Token
- Access a GitLab account with access to the target projects.
- Navigate to https://gitlab.com/-/profile/personal_access_tokens.
- Ensure the access is at least
read_api
andread_repository
. Please note,read_user
andread_registry
are optional. - Click the Create personal access token button.
- Copy the provided API token.
Configuring the data source
Display Name:
Enter a name for your data source. This helps you to identify this data source in the list of your data sources.- Instance URL:
Enter a URL if you wish to use your own instance of GitLab.If you leave this section blank, https://gitlab.com will be used by default.
- API Token:
Paste the API token in here. Restrict access to this data source:
You can enable this option if you only want certain users or groups to have access to the data source, or the permission to link it to new workspaces. See data source access control for more information.The term data source here really means data source instance. For example, a user may configure two instances of the AWS data source, one for their development environment and one for production. In that case, each data source instance has its own access control settings.
By default, Restrict access to this data source is set to off. The data source can be viewed, edited and administered by anyone. If you would like to control who has access to this data source, switch Restrict access to this data source to on.
Use the Restrict access to this data source dropdown to control who has access to the workspace:
- By default, the user setting the permissions for the data source will be given Full Control and the Everyone group will be given Link to workspace permissions.
- Tailor access to the data source, as required, by selecting individual users or user groups from the dropdown and giving them Link to workspace or Full Control permissions.
- If the user is not available from the dropdown, you are able to invite them to the data source by typing in their email address and then clicking Add. The new user will then receive an email inviting them to create an account on SquaredUp. Once the account has been created, they will gain access to the organization.
- At least one user or group must be given Full Control.
- Admin users can edit the configuration, modify the Access Control List (ACL) and delete the data source, regardless of the ACL chosen.
See Access control for more information.
Click Test and add to validate the data source configuration. SquaredUp will now attempt to connect to SquaredUp using the provided authentication method. If this process fails, see Testing and troubleshooting for assistance with the corresponding errors.
Next steps
Data streams
The following data streams are installed with this plugin.
Data streams standardize data from all the different shapes and formats your tools use into a straightforward tabular format.
While creating a tile you can tweak data streams by grouping or aggregating specific columns.
Depending on the kind of data, SquaredUp will automatically suggest how to visualize the result, for example as a table or line graph.
Data streams can be either global or scoped:
- Global data streams are unscoped and return information of a general nature (e.g. "Get the current number of unused hosts").
- A scoped data stream gets information relevant to the specific set objects supplied in the tile scope (e.g. "Get the current session count for these hosts").
See Data Streams for more information.
The GitLab data source allows you to set up configurable data streams for any kind of GQL query. If you need help using GQL, please refer to: GraphQL
- Scope to an object that supports a GQL query.
- Select + GQL Query from the data stream list.
- Display Name:
Enter a name for the new data stream. - Query:
Enter a GQL query. - RowPath:
Optional, focus on results within the GQL query. Target on the array of data that you want to display. For example:projects.nodes
.
This example query shows you how to get the details about the current user, the groups it has access to and the project IDs in those groups.You’ll need to inform the cloud platform where the rows start. It must be a value returned as an array, such asquery{ currentUser{ groups{ nodes { projects { edges { node { id name } } } fullName id } } name id } }
edges
(in the above example) ornodes
.
You can use mustache to alter the query with values from the scope.A mustache parameter is a dynamic value, the actual value will be inserted to replace the field in curly braces. For example,
{{timeframe.start}}
will insert the start time based on the timeframe configured within the tile, or{{name}}
will insert the name of the object(s) in scope.This data stream supplies scoped objects individually for mustache parameters. When there are multiple objects in scope this data source will send the query multiple times, once for each object. The results are then displayed together, for example in a single table.
You can use properties of objects and write them in between curly braces e.g
{{name}}
to use them as mustache parameters. Whenever you use mustache parameters, you need to use a scope of objects that contain the property you're referencing.For example, if objects of type "host" have a property called
name
, you can use{{name}}
. This will resolve{{name}}
to the value of the name property of the different "host" objects used in the scope.