Revert "add git hash"

This reverts commit ca5ff418f9.
master
Dirk Heilig 2024-08-21 11:02:09 +02:00
parent ca5ff418f9
commit dc9365eba4
2 changed files with 3 additions and 15 deletions

View File

@ -1,4 +1,4 @@
FROM debian:12 as prepare
FROM debian:12
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y php-dev php-cli php-pear php-mbstring php-curl git build-essential libmosquitto-dev libmosquitto-dev php-sqlite3
WORKDIR /tmp
@ -11,12 +11,4 @@ RUN make install
RUN echo "extension=mosquitto.so" > /etc/php/8.2/cli/php.ini
ADD run /usr/local/bin/entrypoint
RUN chmod +x /usr/local/bin/entrypoint
FROM prepare as make_git_id
WORKDIR /tmp/repo
ADD .git /tmp/repo/.git
RUN git rev-parse HEAD > /tmp/git_id
FROM prepare as runner
ENV GIT_ID=unknown
COPY --from=make_git_id /tmp/git_id /var/lib/git_id
CMD ["/usr/local/bin/entrypoint"]

View File

@ -14,16 +14,13 @@ pcntl_signal(SIGTERM, "endit");
pcntl_signal(SIGHUP, "endit");
$mqttPort = getEnvWithDefaultInt("MQTT_PORT", 1883);
$mqttUser = getEnvWithDefaultStr("MQTT_USER", "");
$mqttPass = getEnvWithDefaultStr("MQTT_PASS", "");
$mqttClientId = getEnvWithDefaultStr("MQTT_CLIENT_ID", "mqtt2prometheus");
$mqttTopic = getEnvWithDefaultStr("MQTT_TOPIC", "prometheus");
$qos = getEnvWithDefaultInt("MQTT_QOS", 2);
$ignoreRetained = getEnvWithDefaultInt("IGNORE_RETAINED", 1) ? 1 : 0;
$gitId="Unknown";
if (is_file("/var/lib/git_id")) {
$gitId = trim(file_get_contents("/var/lib/git_id"));
}
$mqtt = new Mosquitto\Client($mqttClientId);
@ -188,11 +185,10 @@ function precheck(Message $message): bool
function output(): void
{
filter();
global $data, $stats, $globalCounter,$gitId;
global $data, $stats, $globalCounter;
$t = time();
$prom = "";
$prom .= "# from git-id : $gitId\n";
$prom .=
"# service started at : " .
STARTED .