Skip to content

Commit

Permalink
Merge branch 'release/0.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins committed Dec 22, 2021
2 parents 2597d39 + b7c43da commit 58f4dd0
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
Export your favorite GitHub repositories to Prometheus

* Use it _as a service_: See https://gh.skuzzle.de for instructions
* Deploy it _on-premise_: `docker pull ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.5`
* Deploy it _on-premise_: `docker pull ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.6`

## On-Premise deployment with docker
This application can easily be run as a docker container in whatever environment you like:

```
docker run -p 8080:8080 \
-e WEB_ALLOWANONYMOUSSCRAPE=true \
ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.5
ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.6
```

With _anonymous scraping_ allowed, you can now easily view the scrape results directly in the browser by navigating to
Expand All @@ -37,7 +37,7 @@ scrape_configs:
In case you want to enforce authenticated scrapes only, use this configuration instead:
```
docker run -p 8080:8080 \
ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.5
ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.6
```

And
Expand Down
5 changes: 2 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

[![Coverage Status](https://coveralls.io/repos/github/skuzzle/gh-prom-exporter/badge.svg?branch=master)](https://coveralls.io/github/skuzzle/gh-prom-exporter?branch=master) [![Twitter Follow](https://img.shields.io/twitter/follow/skuzzleOSS.svg?style=social)](https://twitter.com/skuzzleOSS)

* Update to Spring-Boot 2.6.2
* [#1](https://github.com/skuzzle/gh-prom-exporter/issues/1) Allow to scrape multiple repository with single call
* Display application version

```
docker pull ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.5
docker pull ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.6
```
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>de.skuzzle.ghpromexporter</groupId>
<artifactId>gh-prom-exporter</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>

<name>gh-prom-exporter</name>
<description>Export GitHub repository metrics in prometheus format</description>
Expand All @@ -31,6 +31,8 @@

<github.name>gh-prom-exporter</github.name>

<docker.publish.usr>CHANGE_ME</docker.publish.usr>
<docker.publish.psw>CHANGE_ME</docker.publish.psw>
<docker.registry.name>ghcr.io</docker.registry.name>
<docker.image.name>${docker.registry.name}/${github.user}/${github.name}/${project.artifactId}</docker.image.name>

Expand Down
3 changes: 1 addition & 2 deletions readme/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

[![Coverage Status](https://coveralls.io/repos/github/${github.user}/${github.name}/badge.svg?branch=${github.main-branch})](https://coveralls.io/github/${github.user}/${github.name}?branch=${github.main-branch}) [![Twitter Follow](https://img.shields.io/twitter/follow/skuzzleOSS.svg?style=social)](https://twitter.com/skuzzleOSS)

* Update to Spring-Boot 2.6.2
* [#1](https://github.com/skuzzle/gh-prom-exporter/issues/1) Allow to scrape multiple repository with single call
* Display application version

```
docker pull ${docker.image.name}:${project.version}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package de.skuzzle.ghpromexporter.version;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringBootVersion;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import de.skuzzle.ghpromexporter.GhPromExporterApplication;

@Configuration(proxyBeanMethods = false)
class VersionConfiguration {

private static final Logger log = LoggerFactory.getLogger(VersionConfiguration.class);

@Bean
Versions versions() {
record VersionsImpl(String springBoot, String application) implements Versions {}

final String application = getApplicationVersion(GhPromExporterApplication.class);
final String springBoot = SpringBootVersion.getVersion();

final Versions versions = new VersionsImpl(format(springBoot), format(application));
log.info("Determined application version: {}", versions);
return versions;
}

private String format(String version) {
return version == null
? "<unknown>"
: "v" + version;
}

private String getApplicationVersion(Class<?> sourceClass) {
final Package sourcePackage = (sourceClass != null) ? sourceClass.getPackage() : null;
return (sourcePackage != null) ? sourcePackage.getImplementationVersion() : null;
}
}
8 changes: 8 additions & 0 deletions src/main/java/de/skuzzle/ghpromexporter/version/Versions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package de.skuzzle.ghpromexporter.version;

public interface Versions {

String application();

String springBoot();
}
13 changes: 11 additions & 2 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ <h2>How to</h2>
static_configs:
- targets: ['gh.skuzzle.de']</pre>
</code>
<mark>Note:</mark> You probably don't want to put your token in plain text into the config. Prometheus also allows to read it from a mounted secret file.
<p>
<mark>Note:</mark> You probably don't want to put your token in plain text into the config.
Prometheus also allows to read it from a mounted secret file.
</p>
<p>
<mark>Note:</mark> You can scrape multiple repositories of the same owner with a single job.
Just list the repository names separated with a comma like this:
<code>metrics_path: /YOUR-GITHUB-USERNAME/YOUR-REPOSITORY1,REPOSITORY2</code>
</p>
</li>
</ol>

<h2>FAQ</h2>
Expand Down Expand Up @@ -171,7 +180,7 @@ <h2>FAQ</h2>

<footer>
<p>by <a href="https://simon.taddiken.online">Simon Taddiken</a></p>
<p>Application: <em th:text="${@environment.getProperty('application.formatted-version')}"></em></p>
<p><a th:href="'https://github.com/skuzzle/gh-prom-exporter/releases/tag/' + ${@versions.application}"><em th:text="${@versions.application}"></em></a></p>
</footer>
</body>
</html>

0 comments on commit 58f4dd0

Please sign in to comment.