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

mozilla / mozregression / 14035822349

24 Mar 2025 12:55PM CUT coverage: 89.377%. First build
14035822349

Pull #1916

github

web-flow
Merge 65dd7f6aa into 807564865
Pull Request #1916: build(deps): bump iniconfig from 2.0.0 to 2.1.0

2524 of 2824 relevant lines covered (89.38%)

13.53 hits per line

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

23.81
/mozregression/tc_authenticate.py
1
from __future__ import absolute_import
14✔
2

3
import json
14✔
4

5
from taskcluster import utils as tc_utils
14✔
6

7
from mozregression.config import DEFAULT_CONF_FNAME, TC_CREDENTIALS_FNAME, get_config
14✔
8

9

10
def tc_authenticate(logger):
14✔
11
    """
12
    Returns valid credentials for use with Taskcluster private builds.
13
    """
14
    # first, try to load credentials from mozregression config file
15
    defaults = get_config(DEFAULT_CONF_FNAME)
×
16
    client_id = defaults.get("taskcluster-clientid")
×
17
    access_token = defaults.get("taskcluster-accesstoken")
×
18
    if client_id and access_token:
×
19
        return dict(clientId=client_id, accessToken=access_token)
×
20

21
    try:
×
22
        # else, try to load a valid certificate locally
23
        with open(TC_CREDENTIALS_FNAME) as f:
×
24
            creds = json.load(f)
×
25
        if not tc_utils.isExpired(creds["certificate"]):
×
26
            return creds
×
27
    except Exception:
×
28
        pass
29

30
    # here we need to ask for a certificate, this require web browser
31
    # authentication
32
    logger.info(
×
33
        "Authentication required from taskcluster. We are going to ask for a"
34
        " certificate.\nNote that if you have long term access you can instead"
35
        " set your taskcluster-clientid and taskcluster-accesstoken in the"
36
        " configuration file (%s)." % DEFAULT_CONF_FNAME
37
    )
38
    creds = tc_utils.authenticate("mozregression private build access")
×
39

40
    # save the credentials and the certificate for later use
41
    with open(TC_CREDENTIALS_FNAME, "w") as f:
×
42
        json.dump(creds, f)
×
43
    return creds
×
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

© 2025 Coveralls, Inc