replace periods with underscores in version info w/ burnettk

This commit is contained in:
jasquat 2023-04-07 16:09:30 -04:00
parent 48ef9caeeb
commit f14a8d17f8
2 changed files with 8 additions and 10 deletions

View File

@ -64,11 +64,9 @@ jobs:
type=ref,event=branch,suffix=-latest
type=ref,event=branch,suffix=-${{ steps.date.outputs.date }}
- name: Write app verison info
- name: Write app version info
working-directory: spiffworkflow-frontend
run: |
touch app_version.json
echo '${{ steps.meta.outputs.labels }}' > app_version.json
run: echo $DOCKER_METADATA_OUTPUT_JSON | jq '.labels' > app_version.json
- name: Build and push Frontend Docker image
uses: docker/build-push-action@v4.0.0
with:
@ -110,11 +108,9 @@ jobs:
type=ref,event=branch,suffix=-latest
type=ref,event=branch,suffix=-${{ steps.date.outputs.date }}
- name: Write app verison info
- name: Write app version info
working-directory: spiffworkflow-backend
run: |
touch app_version.json
echo $DOCKER_METADATA_OUTPUT_JSON | jq '.labels' > app_version.json
run: echo $DOCKER_METADATA_OUTPUT_JSON | jq '.labels' > app_version.json
- name: Build and push Backend Docker image
uses: docker/build-push-action@v4.0.0
with:

View File

@ -188,11 +188,13 @@ def create_app() -> flask.app.Flask:
def _setup_prometheus_metrics(app: flask.app.Flask, connexion_app: connexion.apps.flask_app.FlaskApp) -> None:
metrics = ConnexionPrometheusMetrics(connexion_app)
app.config["PROMETHEUS_METRICS"] = metrics
app_version_data = {}
if os.path.isfile("app_version.json"):
app_version_data = {}
with open("app_version.json", 'r') as f:
app_version_data = json.load(f)
metrics.info('app_version_info', 'Application Version Info', **app_version_data)
# prometheus does not allow periods in key names
app_version_data_normalized = {k.replace('.', '_') : v for k, v in app_version_data.items()}
metrics.info('app_version_info', 'Application Version Info', **app_version_data_normalized)
def get_hacked_up_app_for_script() -> flask.app.Flask: