• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla-releng / balrog / #5214

16 Feb 2026 01:14AM UTC coverage: 16.352% (-73.5%) from 89.9%
#5214

Pull #3672

circleci

renovate-bot
chore(deps): lock file maintenance (pep621)
Pull Request #3672: chore(deps): lock file maintenance (pep621)

267 of 2546 branches covered (10.49%)

Branch coverage included in aggregate %.

1169 of 6236 relevant lines covered (18.75%)

0.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.0
/src/auslib/dockerflow.py
1
from os import path
1✔
2

3
from flask import Response, jsonify
1✔
4

5
from auslib.global_state import dbo
1✔
6

7

8
def _heartbeat_database_fn(dbo):
1✔
9
    return dbo.dockerflow.incrementWatchdogValue(changed_by="dockerflow")
×
10

11

12
def heartbeat_response(heartbeat_database_fn):
1✔
13
    """Per the Dockerflow spec:
14
    Respond to /__heartbeat__ with a HTTP 200 or 5xx on error. This should
15
    depend on services like the database to also ensure they are healthy."""
16
    try:
×
17
        database_entry_value = heartbeat_database_fn(dbo)
×
18
        return Response(str(database_entry_value), headers={"Cache-Control": "public, max-age=60"})
×
19
    except Exception:
×
20
        return Response(status=502, response="Can't connect to the database.", headers={"Cache-Control": "public, max-age=60"})
×
21

22

23
def lbheartbeat_response():
1✔
24
    """Per the Dockerflow spec:
25
    Respond to /__lbheartbeat__ with an HTTP 200. This is for load balancer
26
    checks and should not check any dependent services."""
27
    return Response("OK!", headers={"Cache-Control": "no-cache"})
×
28

29

30
def get_version(version_file):
1✔
31
    if version_file and path.exists(version_file):
×
32
        with open(version_file) as f:
×
33
            version_json = f.read()
×
34
        return Response(version_json, mimetype="application/json", headers={"Cache-Control": "no-cache"})
×
35
    else:
36
        return jsonify({"source": "https://github.com/mozilla-releng/balrog", "version": "unknown", "commit": "unknown"})
×
37

38

39
# Keeping flask dockerflow endpoints here to maintain the admin api compatibility.
40
def create_dockerflow_endpoints(app, heartbeat_database_fn=_heartbeat_database_fn):
1✔
41
    """Wrapper that creates the endpoints required by CloudOps' Dockerflow spec:
42
    https://github.com/mozilla-services/Dockerflow. This gets used by both the admin and public apps.
43
    :param heartbeat_database_fn: Function that calls the database when reponding to /__heartbeat__.
44
    A database object is passed to this function.
45

46
    If heartbeat_database_fn is None, a default function is be set. The default function writes in a
47
    dummy table. Even though we respond to GET, we do insert/update something in the database. This
48
    allows us to see if the connection to the database exists, is active, and if the credentials given
49
    are the correct ones. For more context see bug 1289178.
50
    """
51

52
    @app.route("/__heartbeat__")
×
53
    def heartbeat():
×
54
        return heartbeat_response(heartbeat_database_fn)
×
55

56
    @app.route("/__lbheartbeat__")
×
57
    def lbheartbeat():
×
58
        return lbheartbeat_response()
×
59

60
    @app.route("/__version__")
×
61
    def version():
×
62
        version_file = app.config.get("VERSION_FILE")
×
63
        return get_version(version_file)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc