Add version and compare links to the api changelog generator
What does this MR do and why?
Extend the Gitlab::Changelog::Release
that now also adds two link:
-
Check files
: Link to the tree site of theto
position of the release -
Compare commits
: Link to the compare site betweenfrom
andto
of the releasefrom
andto
will be provided byRepositories::ChangelogService
when calling the api.
This allows a fast way to review the changed code from release that is mentioned in the changelog. The manually opening of the compare site and search for the tags can be skipped.
Since relative refs like Branches and HEAD
are allowed for from
and to
parameter we will internally substitute them to the commit id.
TODO: Preserve Git Tags when used.
Notes
- I currently could not find a way to use GitLab-specific references for this kind of wanted links. Instead there will be added absolute links for this.
- Markdown compare only works with commit ids but the compare itself also works with tags.
- There is also currently no multi language support for the links labels. See !72007 (comment 801320946)
Screenshots
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
- Apply Changes form the MR to your GitLab Instance
- Restart GitLab Instance
gitlab-ctl restart
- Create a API Key (eg. Project Access Token) with api write access to your gitlab project. Needed to trigger the changelog creation later.
- Inside your Project navigate to
Setting => Gerneral
to find your needed Project ID - Follow Workflow inside our existing Git Project from the patched GitLab Instance to create the Changelog via the API:
- Note: You need to replace
<project id>
and<token>
with your settings from the last steps.
git tag v1.0.0 touch test.md git add test.md git commit -m "test change This is just a test Change Changelog: other" git push --tags origin master curl --header "PRIVATE-TOKEN: <token>" --data "version=1.0.1" "https://gitlab.com/api/v4/projects/<project id>/repository/changelog" git pull git tag v1.0.1 git push --tags origin master
- Note: You need to replace
Related issues
Closes #348221
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by cruelsmith