Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions events/code_coverage_events/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-

from taskcluster.helper import TaskclusterConfig

taskcluster_config = TaskclusterConfig("https://firefox-ci-tc.services.mozilla.com")

QUEUE_MONITORING = "monitoring"
QUEUE_PULSE = "pulse"
4 changes: 2 additions & 2 deletions events/code_coverage_events/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import os

import structlog
from libmozevent import taskcluster_config

from code_coverage_events import taskcluster_config
from code_coverage_events.workflow import Events
from code_coverage_tools.log import init_logger

Expand All @@ -31,7 +31,7 @@ def main():
taskcluster_config.auth(args.taskcluster_client_id, args.taskcluster_access_token)
taskcluster_config.load_secrets(
args.taskcluster_secret,
"events",
prefixes=["common", "events"],
required=("pulse_user", "pulse_password", "hook_id", "hook_group_id"),
existing=dict(admins=["babadie@mozilla.com", "mcastelluccio@mozilla.com"]),
)
Expand Down
17 changes: 11 additions & 6 deletions events/code_coverage_events/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import requests
import structlog
from libmozevent import taskcluster_config
from libmozevent.bus import MessageBus
from libmozevent.monitoring import Monitoring
from libmozevent.pulse import PulseListener
Expand All @@ -13,6 +12,7 @@

from code_coverage_events import QUEUE_MONITORING
from code_coverage_events import QUEUE_PULSE
from code_coverage_events import taskcluster_config

logger = structlog.get_logger(__name__)

Expand Down Expand Up @@ -41,7 +41,7 @@ async def run(self):
payload = await self.bus.receive(QUEUE_PULSE)

# Parse the payload to extract a new task's environment
envs = await self.parse(payload)
envs = await self.parse(payload["body"])
if envs is None:
continue

Expand Down Expand Up @@ -169,15 +169,20 @@ def __init__(self):

# Setup monitoring for newly created tasks
self.monitoring = Monitoring(
QUEUE_MONITORING, taskcluster_config.secrets["admins"], 7 * 3600
taskcluster_config,
QUEUE_MONITORING,
taskcluster_config.secrets["admins"],
7 * 3600,
)
self.monitoring.register(self.bus)

# Create pulse listener for code coverage
self.pulse = PulseListener(
QUEUE_PULSE,
"exchange/taskcluster-queue/v1/task-group-resolved",
"#",
{
QUEUE_PULSE: [
("exchange/taskcluster-queue/v1/task-group-resolved", ["#"])
]
},
taskcluster_config.secrets["pulse_user"],
taskcluster_config.secrets["pulse_password"],
)
Expand Down
2 changes: 1 addition & 1 deletion events/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ../tools #egg=code-coverage-tools
libmozevent==1.0.5
libmozevent==1.0.11
3 changes: 2 additions & 1 deletion events/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import pytest
import responses
from libmozevent import taskcluster_config

from code_coverage_events import taskcluster_config


@pytest.fixture
Expand Down