Skip to content

Commit

Permalink
Merge pull request #72 from MozillaSecurity/drop-old-tc
Browse files Browse the repository at this point in the history
Remove support for legacy taskcluster instance
  • Loading branch information
pyoor authored Jul 29, 2020
2 parents 5b9497b + 9cf80b3 commit 4acc2bf
Show file tree
Hide file tree
Showing 1,081 changed files with 30,955 additions and 48,863 deletions.
42 changes: 15 additions & 27 deletions src/fuzzfetch/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ def auto_name_prefix(self):

class BuildTask(object):
"""Class for storing TaskCluster build information"""
TASKCLUSTER_APIS = ('https://firefox-ci-tc.services.mozilla.com/api/%s/v1',
'https://%s.taskcluster.net/v1',)
TASKCLUSTER_API = 'https://firefox-ci-tc.services.mozilla.com/api/%s/v1'
RE_DATE = re.compile(r'^\d{4}-\d{2}-\d{2}$')
RE_REV = re.compile(r'^([0-9A-F]{12}|[0-9A-F]{40})$', re.IGNORECASE)

Expand Down Expand Up @@ -250,7 +249,7 @@ def iterall(cls, build, branch, flags, platform=None):
build = HgRevision(build, branch).hash
flag_str = flags.build_string()
task_paths = tuple(path + flag_str for path in cls._revision_paths(build.lower(), branch, target_platform))
task_template_paths = itertools.product(cls.TASKCLUSTER_APIS, task_paths)
task_template_paths = itertools.product((cls.TASKCLUSTER_API,), task_paths)

elif build == 'latest':
if branch in {'autoland', 'try'}:
Expand All @@ -259,16 +258,13 @@ def iterall(cls, build, branch, flags, platform=None):
namespace = 'gecko.v2.mozilla-' + branch + '.latest'
product = 'mobile' if 'android' in target_platform else 'firefox'
task_path = '/task/%s.%s.%s%s' % (namespace, product, target_platform, flags.build_string())
task_template_paths = ((cls.TASKCLUSTER_APIS[0], task_path),)
task_template_paths = ((cls.TASKCLUSTER_API, task_path),)

else:
# try to use build argument directly as a namespace
task_path = '/task/' + build
is_namespace = True
if '.latest' in build:
task_template_paths = ((cls.TASKCLUSTER_APIS[0], task_path),)
else:
task_template_paths = itertools.product(cls.TASKCLUSTER_APIS, (task_path,))
task_template_paths = ((cls.TASKCLUSTER_API, task_path),)

for (template_path, try_wo_opt) in itertools.product(task_template_paths, (False, True)):

Expand Down Expand Up @@ -305,27 +301,19 @@ def _pushdate_template_paths(cls, pushdate, branch, target_platform):
if branch not in {'autoland', 'try'}:
branch = 'mozilla-' + branch
path = '/namespaces/gecko.v2.' + branch + '.pushdate.' + pushdate
date_found = False
last_exc = None

for template in cls.TASKCLUSTER_APIS:
index_base = template % ('index',)
url = index_base + path
try:
base = HTTP_SESSION.post(url, json={})
base.raise_for_status()
except requests.exceptions.RequestException as exc:
last_exc = exc
continue

date_found = True
product = 'mobile' if 'android' in target_platform else 'firefox'
json = base.json()
for namespace in sorted(json['namespaces'], key=lambda x: x['name']):
yield (template, '/task/' + namespace['namespace'] + '.' + product + '.' + target_platform)
index_base = cls.TASKCLUSTER_API % ('index',)
url = index_base + path
try:
base = HTTP_SESSION.post(url, json={})
base.raise_for_status()
except requests.exceptions.RequestException as exc:
raise FetcherException(exc)

if not date_found:
raise FetcherException(last_exc)
product = 'mobile' if 'android' in target_platform else 'firefox'
json = base.json()
for namespace in sorted(json['namespaces'], key=lambda x: x['name']):
yield cls.TASKCLUSTER_API, '/task/' + namespace['namespace'] + '.' + product + '.' + target_platform

@classmethod
def _revision_paths(cls, rev, branch, target_platform):
Expand Down
5 changes: 2 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
MOCK_HOSTS = {
"firefoxci": 'https://firefox-ci-tc.services.mozilla.com',
"hg": 'https://hg.mozilla.org',
"index": 'https://index.taskcluster.net',
"product-details": 'https://product-details.mozilla.org',
"queue": 'https://queue.taskcluster.net',
}
Expand Down Expand Up @@ -70,9 +69,9 @@ def _cache_requests(request, context):
while folder.resolve() != CACHE_PATH:
if folder.is_file():
# need to rename
tmp_folder = folder.parent / folder.name + '.tmp'
tmp_folder = folder.parent / (folder.name + '.tmp')
folder.rename(tmp_folder)
folder.mkdir(parents=True)
path.parent.mkdir(parents=True)
tmp_folder.rename(folder / '.get')
break
folder = folder.parent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"namespaces": [
{
"namespace": "gecko.v2.mozilla-central.pushdate.2019.11.07.20191107015224",
"name": "20191107015224",
"expires": "2020-11-08T00:00:00.000Z"
},
{
"namespace": "gecko.v2.mozilla-central.pushdate.2019.11.07.20191107230801",
"name": "20191107230801",
"expires": "2020-11-09T00:00:00.000Z"
},
{
"namespace": "gecko.v2.mozilla-central.pushdate.2019.11.07.latest",
"name": "latest",
"expires": "2020-11-08T00:00:00.000Z"
}
]
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"namespaces": [
{
"namespace": "gecko.v2.mozilla-central.pushdate.2020.07.27.20200727033000",
"name": "20200727033000",
"expires": "2021-07-30T00:00:00.000Z"
},
{
"namespace": "gecko.v2.mozilla-central.pushdate.2020.07.27.20200727095125",
"name": "20200727095125",
"expires": "2021-07-30T00:00:00.000Z"
},
{
"namespace": "gecko.v2.mozilla-central.pushdate.2020.07.27.latest",
"name": "latest",
"expires": "2021-07-29T00:00:00.000Z"
}
]
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4acc2bf

Please sign in to comment.