Skip to content

Commit

Permalink
Add support for devedition checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER committed Jan 9, 2018
1 parent 99e8d67 commit c577933
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 22 deletions.
2 changes: 1 addition & 1 deletion pollbot/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ parameters:
product:
name: "product"
in: "path"
description: "Mozila Product name (i.e firefox, thunderbird, fennec)"
description: "Mozila Product name (i.e firefox, devedition)"
required: true
type: "string"
version:
Expand Down
3 changes: 2 additions & 1 deletion pollbot/tasks/archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

async def get_locales(product, version):
channel = get_version_channel(version)
tag = "{}_{}_RELEASE".format(product.upper(), version.replace('.', '_'))
tag_product = 'FIREFOX'
tag = "{}_{}_RELEASE".format(tag_product, version.replace('.', '_'))
if channel is Channel.NIGHTLY:
url = "https://hg.mozilla.org/mozilla-central/raw-file/tip/browser/locales/all-locales"
elif channel is Channel.BETA:
Expand Down
2 changes: 2 additions & 0 deletions pollbot/tasks/balrog.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ async def balrog_rules(product, version):

elif channel is Channel.BETA:
url = 'https://aus-api.mozilla.org/api/v1/rules/firefox-beta'
if product == 'devedition':
url = 'https://aus-api.mozilla.org/api/v1/rules/devedition'
elif channel is Channel.ESR:
version = re.sub('esr$', '', version)
url = 'https://aus-api.mozilla.org/api/v1/rules/esr{}'.format(version.split('.')[0])
Expand Down
12 changes: 9 additions & 3 deletions pollbot/tasks/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ async def release_notes(product, full_version):
elif channel is Channel.ESR:
version = re.sub('esr$', '', full_version)

if product == 'devedition':
product = 'firefox'

url = 'https://www.mozilla.org/en-US/{}/{}/releasenotes/'.format(product, version)

with get_session() as session:
Expand Down Expand Up @@ -135,6 +138,8 @@ async def download_links(product, version):
url = 'https://www.mozilla.org/en-US/{}/all/'.format(product)
else:
url = 'https://www.mozilla.org/fr/{}/channel/desktop/'.format(product)
if product == 'devedition':
url = 'https://www.mozilla.org/en-US/firefox/developer/'

with get_session() as session:
async with session.get(url) as resp:
Expand All @@ -145,12 +150,13 @@ async def download_links(product, version):
d = pq(body)

if channel in (Channel.NIGHTLY, Channel.BETA):
if channel is Channel.NIGHTLY:
if product == 'devedition':
link_path = "#intro-download > .download-list > .os_linux64 > a"
elif channel is Channel.NIGHTLY:
link_path = "#desktop-nightly-download > .download-list > .os_linux64 > a"
url = d(link_path).attr('href')
else: # channel is Channel.BETA:
link_path = "#desktop-beta-download > .download-list > .os_linux64 > a"
url = d(link_path).attr('href')
url = d(link_path).attr('href')
async with session.get(url, allow_redirects=False) as resp:
url = resp.headers['Location']
filename = os.path.basename(url)
Expand Down
16 changes: 11 additions & 5 deletions pollbot/tasks/bouncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ async def bouncer(product, version):
"""Fetch bedrock download page to grab the bouncer download link and then make sure
it redirects to the expected version."""
channel = get_version_channel(version)
channel_value = channel.value

if channel is Channel.ESR:
bedrock_url = "https://www.mozilla.org/en-US/{}/organizations/all/".format(product)
elif channel is Channel.RELEASE:
bedrock_url = 'https://www.mozilla.org/en-US/{}/all/'.format(product)
else:
bedrock_url = 'https://www.mozilla.org/fr/{}/channel/desktop/'.format(product)
if product == 'devedition':
bedrock_url = 'https://www.mozilla.org/en-US/firefox/developer/'
channel_value = "DEVEDITION"

with get_session() as session:
async with session.get(bedrock_url) as resp:
Expand All @@ -27,15 +32,16 @@ async def bouncer(product, version):
body = await resp.text()
d = pq(body)

if channel is Channel.NIGHTLY:
if product == 'devedition':
link_path = "#intro-download > .download-list > .os_linux64 > a"
elif channel is Channel.NIGHTLY:
link_path = "#desktop-nightly-download > .download-list > .os_linux64 > a"
url = d(link_path).attr('href')
elif channel is Channel.BETA:
link_path = "#desktop-beta-download > .download-list > .os_linux64 > a"
url = d(link_path).attr('href')
else: # channel in (Channel.RELEASE, Channel.ESR):
link_path = "#fr > .linux64 > a"
url = d(link_path).attr('href')

url = d(link_path).attr('href')

if url is not None:
async with session.get(url, allow_redirects=False) as resp:
Expand All @@ -51,7 +57,7 @@ async def bouncer(product, version):
filename = os.path.basename(url)
last_release = get_version_from_filename(filename)
status = build_version_id(last_release) >= build_version_id(version)
message = "Bouncer for {} redirects to version {}".format(channel.value, last_release)
message = "Bouncer for {} redirects to version {}".format(channel_value, last_release)
return build_task_response(status, url, message)


Expand Down
24 changes: 17 additions & 7 deletions pollbot/tasks/buildhub.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import json

from pollbot.exceptions import TaskError
from pollbot.utils import Channel, Status, get_version_channel, yesterday, strip_candidate_info
from pollbot.utils import (
Channel, Status, build_version_id, get_version_channel, yesterday, strip_candidate_info
)

from . import get_session, build_task_response, heartbeat_factory

Expand All @@ -20,9 +22,9 @@ async def get_releases(product):
"by_version": {
"terms": {
"field": "target.version",
"size": 100,
"size": 1000,
"order": {
"_term": "asc"
"_term": "desc"
}
}
}
Expand Down Expand Up @@ -54,8 +56,9 @@ async def get_releases(product):
raise TaskError(message, url=url)

data = await response.json()
versions = [r['key'] for r in data['aggregations']['by_version']['buckets']
if strip_candidate_info(r['key']) == r['key']]
versions = sorted([r['key'] for r in data['aggregations']['by_version']['buckets']
if strip_candidate_info(r['key']) == r['key']],
key=lambda version: build_version_id(version))

if not versions:
message = "Couldn't find any version matching."
Expand All @@ -66,13 +69,20 @@ async def get_releases(product):


def get_buildhub_url(product, version, channel):
channel_value = channel.value.lower()
if product == "devedition":
channel_value = "aurora"

url = ("https://mozilla-services.github.io/buildhub/"
"?versions[0]={}&products[0]={}&channel[0]={}")
return url.format(version, product, channel.value.lower())
return url.format(version, product, channel_value)


async def get_build_ids_for_version(product, version, *, size=10):
channel = get_version_channel(strip_candidate_info(version))
channel_value = channel.value.lower()
if product == "devedition":
channel_value = "aurora"

query = {
"aggs": {
Expand All @@ -91,7 +101,7 @@ async def get_build_ids_for_version(product, version, *, size=10):
"filter": [
{
"term": {
"target.channel": channel.value.lower()
"target.channel": channel_value
}
}, {
"term": {
Expand Down
8 changes: 4 additions & 4 deletions pollbot/tasks/product_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

async def ongoing_versions(product):
with get_session() as session:
url = 'https://product-details.mozilla.org/1.0/{}_versions.json'.format(product)
url = 'https://product-details.mozilla.org/1.0/firefox_versions.json'
async with session.get(url) as resp:
if resp.status != 200:
msg = 'Product Details info not available (HTTP {})'.format(resp.status)
Expand All @@ -29,13 +29,13 @@ async def product_details(product, version):
return build_task_response(status, url, message)

with get_session() as session:
url = 'https://product-details.mozilla.org/1.0/{}.json'.format(product)
url = 'https://product-details.mozilla.org/1.0/firefox.json'
async with session.get(url) as resp:
if resp.status != 200:
msg = 'Product Details info not available (HTTP {})'.format(resp.status)
raise TaskError(msg, url=url)
body = await resp.json()
status = '{}-{}'.format(product, version) in body['releases']
status = 'firefox-{}'.format(version) in body['releases']

exists_message = "We found product-details information about version {}"
missing_message = "We did not find product-details information about version {}"
Expand All @@ -46,7 +46,7 @@ async def product_details(product, version):

async def devedition_and_beta_in_sync(product, version):
channel = get_version_channel(version)
url = "https://product-details.mozilla.org/1.0/{}_versions.json".format(product)
url = "https://product-details.mozilla.org/1.0/firefox_versions.json"
if channel is Channel.BETA:
versions = await ongoing_versions(product)
beta = versions["beta"]
Expand Down
1 change: 1 addition & 0 deletions pollbot/tasks/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ async def get_query_info_from_title(session, query_title):
query_url = "{}/api/queries/search?{}".format(TELEMETRY_SERVER, query_params)
async with session.get(query_url) as resp:
body = await resp.json()

if body:
body = [query for query in body if not query['name'].startswith('Copy of')]
return body[0] if len(body) > 0 else None
Expand Down
10 changes: 9 additions & 1 deletion pollbot/views/decorators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from aiohttp import web

from pollbot import PRODUCTS
from ..utils import is_valid_version
from ..utils import is_valid_version, Channel, get_version_channel


def validate_product_version(func):
Expand All @@ -22,6 +22,14 @@ async def decorate(request):
}, status=404)

if version:
if product == "devedition":
channel = get_version_channel(version)
if channel is not Channel.BETA:
return web.json_response({
'status': 404,
'message': 'Invalid version number for devedition: {}'.format(version)
}, status=404)

return await func(request, product, version)

return await func(request, product)
Expand Down
5 changes: 5 additions & 0 deletions pollbot/views/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async def view_get_releases(request, product):
}.items(), key=lambda t: t[0]))

NOT_ACTIONABLE = ['-uptake']
IGNORES = {'devedition': ['crash-stats-uptake', 'partner-repacks']}


@validate_product_version
Expand All @@ -112,6 +113,10 @@ async def view_get_checks(request, product, version):
if build_version_id(version) >= build_version_id(min_version):
check_related_to_version = True

if product in IGNORES:
if check_name in IGNORES[product]:
check_related_to_version = False

if check_related_to_version:
prefix = "{}://{}".format(proto, host)
url = router[check_name].url_for(product=product, version=version)
Expand Down

0 comments on commit c577933

Please sign in to comment.