Update Continuous Integration and Delivery authored by Jens Henrik Goebbert's avatar Jens Henrik Goebbert
......@@ -200,15 +200,7 @@ If one clicks on one of the CI Jobs on the CI/CD->Pipeline tab, one can see the
In the same view, which shows the console output one can also download/browse files created by a CI Job, if available.
![GitLab-Pipeline__Feedback3](/uploads/ab5ca9b69d8430b4b683cad88a646113/GitLab-Pipeline__Feedback3.png)
#### Badges
On the projects front-page badges show the status and more of the most important CI Jobs of the laste pipeline run on branch master.
![GitLab-Pipeline__Feedback4](/uploads/3f681c5f7e0603c35fa2d657f2f7cdb0/GitLab-Pipeline__Feedback4.png)
A good support for automatic generaded badges came out to be more complicated than expected (you can read about the reasons in detail [HERE](https://gitlab.com/gitlab-org/gitlab-ce/issues/50603)), but the final solution seems to be nice and good working.
Badges are generated with [anybadge](https://pypi.org/project/anybadge/) by the [THIS bash function](https://gitlab.version.fz-juelich.de/vis/jusense-cicd/blob/master/ci/ci_funcs.sh#L3). The generated badges of all CI Jobs are copied by the last CI Job "pages" to the artifact "pages".
The drawback of this approach is, that one a single Artifacts section is allowed in .gitlab-ce.yml. And this needs to be 'pages' in this case. All CI Jobs must share the same Artifacts. And one should better know the exact behaviour of Artifacts in GitLab:
If you use Artifacts you should better know the exact behaviour of Artifacts in GitLab:
Artifacts are ...
* ... a list of files and directories
......@@ -222,9 +214,27 @@ Artifacts are ...
* ... saved on the GitLab server as a zip file.
* ... attached to a job after it completes
#### Badges
On the projects front-page badges show the status and more of the most important CI Jobs of the laste pipeline run on branch master.
![GitLab-Pipeline__Feedback4](/uploads/3f681c5f7e0603c35fa2d657f2f7cdb0/GitLab-Pipeline__Feedback4.png)
A good support for automatic generaded badges came out to be more complicated than expected (you can read about the reasons in detail [HERE](https://gitlab.com/gitlab-org/gitlab-ce/issues/50603)), but the final solution seems to be nice and good working.
Badges are generated with [anybadge](https://pypi.org/project/anybadge/) by the [THIS bash function](https://gitlab.version.fz-juelich.de/vis/jusense-cicd/blob/master/ci/ci_funcs.sh#L3). The generated badges of all CI Jobs are copied by the last CI Job "pages" to the artifact "pages".
The drawback of this approach is, that one a single Artifacts section is allowed in .gitlab-ce.yml. And this needs to be 'pages' in this case. All CI Jobs must share the same Artifacts.
The artifact "pages" is published online by [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/). Therefore, for all CI Jobs a fixed URL is available to the latest generated badge.
An example URL is: http://vis.pages.jsc.fz-juelich.de/jusense-cicd/badges/badge_build-openmpi_%{default_branch}.svg
##### Badges based on data from GitLab-API
Certain informations on your project are available through the [GitLab-API](https://docs.gitlab.com/ee/api/README.html). With 'curl' one can ask GitLab for information and it will pass a JSON file. You can get the number of forks for example with
```
FORKS_COUNT = $(curl -s 'https://gitlab.version.fz-juelich.de/api/v4/projects/vis%2Fjusense-cicd/' | python3 -c "import sys, json; print(json.load(sys.stdin)['forks_count'])")
```
In this project we use the ability to add a badge showing the number of forks and open issues.
They are generated beside other badges in [ci/badge-static.sh](https://gitlab.version.fz-juelich.de/vis/jusense-cicd/blob/master/ci/badges-static.sh#20).
To include the badges to your project front-page, they can be set in Project->Settings->Badges like this:
![GitLab-Pipeline__SetBadges](/uploads/630320add68c17e5c1c3a2335af1e8af/GitLab-Pipeline__SetBadges.png)
......
......