diff --git a/.github/workflows/docker_image_for_main_builds.yml b/.github/workflows/docker_image_for_main_builds.yml index 943407cca..0b3964c41 100644 --- a/.github/workflows/docker_image_for_main_builds.yml +++ b/.github/workflows/docker_image_for_main_builds.yml @@ -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: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py index 99226ad2c..2da5adaa1 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py @@ -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: