Ferronier-gitlab¶
A Ferronier plugin to build a user or group page showcasing its projets, with every single piece of data being fetched using the GitLab API, which means repositories can be simply cloned to create such a showcase. See examples for an user and a group.
Walkthrough¶
1. Fork an existing repository¶
Fork one of the example repositories.
This plugins works the same way on groups and users, so you can fork any repository. Here are a some examples, on several GitLab instances:
Those repository are given as convenient examples where you can just click on the “fork” button, but you can copy their content to any GitLab instance.
Make sure to choose the right project name.
For instance, if you want to build this showcase as the main page of the group
foobaronhttps://framagit.org, your project name must befoobar.frama.io(frama.iobeing the domain name associated with GitLab pages on https://framagit.org).See the official documentation for more information.
2. Create a GitLab token, and add it to your pipeline variables¶
Every single piece of information displayed by this plugin is public, and fetched using the Gitlab API, but this API sometimes requires a token to be used.
Create an access token:
For a group [2]:
Go to the profile page of your group.
Select
Settings>Access tokens.Select
Add new token.Choose a
Token nameand a, optionally, aToken description.Select an expiration date (as far as possible if you do not want to change it often).
Select
Maintaineras role, and checkread_api.Select
Create group access token, and copy the resulting token, for the next step.
For an user [1]:
Go to your profile page (in the upper-right corner, select your avatar).
Select
Edit profile.Select
Access>Personal access tokens.From the
Generate tokendropdown list, selectLegacy token.Choose a
Token nameand a, optionally, aToken description.Select an expiration date (as far as possible if you do not want to change it often).
Check
read_apias the only scope.Select
Create token, and copy the resulting token, for the next step.
Add this token as a variable in your pipelines [3]:
Go to the project you created on the previous step.
Select
Settings>CI/CD.Expand
Variables.Select
Add variableand fill as details:Key:GITLAB_API_KEYValue: the token you copied in the previous step.Type: keep the defaultvariable.other values: as you wish.
Submit this form, and go to the next step.
3. Run your first pipeline¶
To build your website for the first time, you have to run a pipeline.
Go to the repository of your project.
Select (in the left column)
Build>Pipelines.Click on the
New pipelinebutton.Leave everything as-is, and validate with the
New pipelinebutton (again).
Wait for the pipeline to end, and you can navigate to your website with the Gitlab pages button on your project page. The page might be emptier than you expect. If so, setting project, and group or user metadata, might fix it. It will be discussed in a later section.
4. Configure your pipeline to re-run every week or month¶
The generated website is static: it shows a snapshot of your projects at the time the pipeline ran, and is not automatically updated. To do so, you can configure your repository to rerun the pipeline every week or month.
Go to the repository of your project.
On the left menu, select
Build>Pipeline schedules.Click on the
New schedulebutton (top right).Choose a relevant description, your timezone, select an interval pattern (monthly (maybe weekly?) seems right: do you really need a shorter interval?), leave everything else as-is, and submit with the
Create pipeline schedulebutton.
5. (Optional) Read and change some options¶
The ferronier.toml file at the root of the repository (example) have options that are self described, that you can use to fine-tune the output of the website (for instance, you can change the language (if translations in your language are missing, see below), exclude projects, hide topics…).
6. Set your profile, group and project metadata correctly, so that they appear in your showcase¶
As said (several times!) earlier, every single piece of data displayed in this showcase it fetched using the GitLab API, from your profile, group or project metadata. Let’s discuss them.
User profile¶
User name:
Edit profile>Main settings>Full nameAvatar:
Edit profile>Public avatar. If not set, the first letter of the user name will be used instead.About you:
Edit profile>Main settings>Pronouns,Pronunciation,Location, etc. If some fields are missing (not rendered in the output page), please submit an issue.Bio (short description):
Edit profile>Main settings>BioLinks:
Edit profile>Main settings>Social accounts(note: some accounts are not displayed because of the GitLab API).Long description: Content of the README file of a project named after your username (important!) (official documentation ).
Group¶
Group name:
Settings>General>Group name.Avatar:
Settings>General>Avatar. If not set, the first letter of the group name will be used instead.Number of projects and subgroups: automatic.
Short description:
Settings>General>Description.Badges:
Settings>Badges.Long description: Content of the README file of a project named
gitlab-profile(important!) (official documentation ).
Project¶
Avatar:
Settings>General>Project avatar. If not set, the first letter of the project name will be used instead.Project name:
Settings>General>Project name.Path: automatic, cannot be changed.
Description:
Settings>General>Project description.Topics:
Settings>General>Project topics.Badges:
Settings>General>Badges.Public page: The URL of the GitLab page (if created) is used.
Links: automatic.
Note that although the project README does not appear in the page, it is used when using the search bar.
Subgroup¶
Avatar:
Settings>General>Avatar. If not set, the first letter of the group name will be used instead.Group name:
Settings>General>Group name.Path: automatic, cannot be changed.
Short description:
Settings>General>Description.Badges:
Settings>Badges.Links: automatic.
Note that although the group README (the README of a project named gitlab-profile (official documentation)) does not appear in the page, it is used when using the search bar.
Other software forges?¶
I (almost) don’t use other forges. However, if you were to write a similar plugin for Forgejo, Github, or any other software forge, I would be happy to reference your project here.
Translations¶
The template producing the showcase, as well as this documentation, are translated (in French, at the time I am writing this documentation).
Choosing a different language¶
Change the locale = "en_US" line in the ferrionier.toml file to select another language.
Add a new translation¶
Pull requests are welcome to translate ferronier-gitlab or its documentation to a new language! Follow this documentation to do so.
About¶
Code and documentation by Louis Paternault.
Code licensed under the GNU GPL 3 license (or any later version); documentation licensed under the Creative Commons by 4.0 and the GNU FDL license 1.3 (or any later version).
Footnotes