The practice of using badges for projects in OEX for a more convenient description of them
Tags: docker, tutorial, github, programming
Published: 2022-06-27 22:28:58

It is becoming more and more common to see beautiful badges in the README.MD file with useful information about the current project in the repositories of GitHub, GitLab and others.
For instance:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1w5zrfqyvnefldncbyh4.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xb5j07nhnkkcrxkxvu09.png)

The project is being developed [The quality of the code](https://community.objectscriptquality.com/about), which also provides its own badge, which immediately shows the status of code validation of the project. If you insert a line into the `README.MD` file
```
 [![Quality Gate Status](https://community.objectscriptquality.com/api/project_badges/measure?project=intersystems_iris_community%2Fappmsw-zpm-shields&metric=alert_status)](https://community.objectscriptquality.com/dashboard?id=intersystems_iris_community%2Fappmsw-zpm-shields)
```
And in the `/.github/workflows/` directory github project the file [objectscript-quality.yml](https://github.com/SergeyMi37/isc-apptools-lockdown/blob/master/.github/workflows/objectscript-quality.yml), you can see this badge:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q68mkl0drn7kluyp2uat.png)

There are different services that grant these nameplates.
For example -  [Shield.io](https://shields.io/)
It even executes screen forms, which simplify the creation of links, including for markup written in Markdown

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pk808c6gntblvnsws32x.png)

I have been using a lot of different beautiful and useful nameplates in [my projects](https://github.com/SergeyMi37/apptools-admin) for a long time.

As the project of the package manager [ZPM](https://github.com/intersystems-community/zpm) matures, the requirements for the storage resources for package modules increase too.

It happens more and more often now that I need to know more detailed information, preferably observable at first glance at the first page, without opening the project files. Such data includes:
- what version of the project is stored in the repository. I need to see that without checking the module.xml file.
- how that version relates to the one in the public repository. Is it the right time already to update the release or not?...
- what ports are forwarded out in the settings of the docker file called dockerfile?

All of that is well performed by the `shields.io` service.
### Show the version of the zpm project taken from the file module.xml

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xftzgdhvklqbsuzw53gu.png)
```
![Repo-GitHub](https://img.shields.io/badge/dynamic/xml?color=gold&label=GitHub%20module.xml&prefix=ver.&query=%2F%2FVersion&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsergeymi37%2Fzapm%2Fmaster%2Fmodule.xml)
```
You can complicate the link by adding the ability to click to open the corresponding file `module.xml`:
```
[![Repo-GitHub](https://img.shields.io/badge/dynamic/xml?color=gold&label=GitHub%20module.xml&prefix=ver.&query=%2F%2FVersion&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsergeymi37%2Fzapm%2Fmaster%2Fmodule.xml)](https://raw.githubusercontent.com/sergeymi37/zapm/master/module.xml)
```

### Show the version of the zpm project taken from the [service](https://pm.community.intersystems.com/)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l42iuqqkpcvd687x110p.png)
```
![OEX-zapm](https://img.shields.io/badge/dynamic/json?url=https:%2F%2Fpm.community.intersystems.com%2Fpackages%2Fzapm%2F&label=ZPM-pm.community.intersystems.com&query=$.version&color=green&prefix=zapm)
```
Example of a link with a request for a service:
```
[![OEX-zapm](https://img.shields.io/badge/dynamic/json?url=https:%2F%2Fpm.community.intersystems.com%2Fpackages%2Fzapm%2F&label=ZPM-pm.community.intersystems.com&query=$.version&color=green&prefix=zapm)](https://pm.community.intersystems.com/packages/zapm)
```

### Show which ports are forwarded in the settings of the docker file called dockerfile

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sa5yy7zhtij78qr5clyc.png)
```
 ![Docker-ports](https://img.shields.io/badge/dynamic/yaml?color=blue&label=docker-compose&prefix=ports%20-%20&query=%24.services.iris.ports&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsergeymi37%2Fzapm%2Fmaster%2Fdocker-compose.yml)
```
For instance of a link with opening a file `docker-compose.yml`:
```
[![Docker-ports](https://img.shields.io/badge/dynamic/yaml?color=blue&label=docker-compose&prefix=ports%20-%20&query=%24.services.iris.ports&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsergeymi37%2Fzapm%2Fmaster%2Fdocker-compose.yml)](https://raw.githubusercontent.com/sergeymi37/zapm/master/docker-compose.yml)
```

However, when it comes to more complex metrics, their combinations, or projects inside a private local network, for those purposes I have decided [to bring about my REST service](https://github.com/SergeyMi37/appmsw-zpm-shields), which shows the version of the ZPM module from the repository file and from the service `https://pm.community.intersystems.com/`

After installation, you will have a service `zpm-shields` to which you need to provide access without authentication.
### Using these links you can get a svg file that can be inserted into README.MD for instance:
![](https://raw.githubusercontent.com/SergeyMi37/appmsw-zpm-shields/master/doc/Screenshot_1.png)
```
![Repo](http://localhost:52773/zpm-shields/repo/mode?module=https:%2F%2Fgithub.com%2FSergeyMi37%2Fzapm&color=blue)
```
where the parameter values are:
`zpm-shields/repo` - extaction from the file module.xml version
`module` - link to the repository
`color` -  for example #00987

![](https://raw.githubusercontent.com/SergeyMi37/appmsw-zpm-shields/master/doc/Screenshot_2.png)
```
![Registry](http://localhost:52773/zpm-shields/registry/mode?project=appmsw-dbdeploy&color=gold)
```
where the parameter values are:
`zpm-shields/registry` - getting the version by request from the service
`project` - project name

![](https://raw.githubusercontent.com/SergeyMi37/appmsw-zpm-shields/master/doc/Screenshot_3.png)
```
![Repo+Registry](http://localhost:52773/zpm-shields/both/mode?module=sergeymi37%2Fappmsw-dbdeploy&project=appmsw-dbdeploy&color=FFA07A)
```
where the parameter values are:
`zpm-shields/both` - extaction from the file module.xml version and getting the version by request from the service
`project` - project name
`module` - link to the repository

My service can also be used for local ZPM resources. To do that you need to utilise the full path of the local repository and private register.

I really like these badges. I think they might come in handy for you too.