Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
5d17a75e7e | |||
1db7232951 | |||
6a14f2cec8 | |||
085fa252f3 | |||
aa23e07221 | |||
263395c04c | |||
7b6023c869 | |||
|
9379e72199 | ||
67ed612dc9 | |||
3e727f0348 | |||
dd658be7ef | |||
0322030e57 | |||
16d7f4b52f | |||
12ed365dff | |||
1b9c4ac14b |
@ -3,12 +3,12 @@ name: ci
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'main'
|
- "*"
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- "*"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- 'main'
|
- "main"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@ -18,6 +18,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@ -29,17 +30,19 @@ jobs:
|
|||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
- name: Login to DockerHub
|
|
||||||
if: github.event_name != 'pull_request'
|
- name: Login to registry
|
||||||
|
if: github.ref_type == 'tag'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: git.sebclem.fr
|
registry: git.sebclem.fr
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.ref_type == 'tag' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
@ -1,4 +1,4 @@
|
|||||||
FROM python:3
|
FROM python:3.12.5
|
||||||
|
|
||||||
WORKDIR /usr/src/huwawei_lte_exporter
|
WORKDIR /usr/src/huwawei_lte_exporter
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ def prom_exporter():
|
|||||||
response.append('#HELP '+attribute+' '+info['help'])
|
response.append('#HELP '+attribute+' '+info['help'])
|
||||||
response.append('#TYPE '+attribute+' '+info['type'])
|
response.append('#TYPE '+attribute+' '+info['type'])
|
||||||
response.append(attribute+'{'+info['device']+'} '+info['value'])
|
response.append(attribute+'{'+info['device']+'} '+info['value'])
|
||||||
|
client.user.logout()
|
||||||
return '\n'.join(response)
|
return '\n'.join(response)
|
||||||
|
|
||||||
|
|
||||||
@ -76,8 +76,6 @@ config = configparser.ConfigParser()
|
|||||||
config.read('huwawei_lte_exporter.ini')
|
config.read('huwawei_lte_exporter.ini')
|
||||||
MANDATORY_ENV_VARS = ["ROUTER_ADDRESS", "ROUTER_USER", "ROUTER_PASS", "PROM_PORT"]
|
MANDATORY_ENV_VARS = ["ROUTER_ADDRESS", "ROUTER_USER", "ROUTER_PASS", "PROM_PORT"]
|
||||||
for var in MANDATORY_ENV_VARS:
|
for var in MANDATORY_ENV_VARS:
|
||||||
if not config.has_option('DEFAULT', var):
|
|
||||||
raise EnvironmentError("Failed because {} is not set.".format(var))
|
|
||||||
if var in os.environ:
|
if var in os.environ:
|
||||||
config['DEFAULT'][var] = os.environ[var]
|
config['DEFAULT'][var] = os.environ[var]
|
||||||
|
|
||||||
|
5
huwawei_lte_exporter.ini
Normal file
5
huwawei_lte_exporter.ini
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
ROUTER_ADDRESS=192.168.1.1
|
||||||
|
ROUTER_USER=admin
|
||||||
|
ROUTER_PASS=admin
|
||||||
|
PROM_PORT=8080
|
7
renovate.json
Normal file
7
renovate.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:base"
|
||||||
|
],
|
||||||
|
"commitMessagePrefix": ":arrow_up:"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user