Ejemplo n.º 1
0
    def generate_phases(self, partner_urls=None, github_token=None):
        blob = []
        phases = []
        previous_graph_ids = [self.decision_task_id]
        next_version = bump_version(self.version.replace('esr', ''))
        input_common = {
            'build_number': self.build_number,
            'next_version': next_version,
            # specify version rather than relying on in-tree version,
            # so if a version bump happens between the build and an action task
            # revision, we still use the correct version.
            'version': self.version,
            'release_eta': self.release_eta
        }
        if not is_partner_enabled(self.product, self.version):
            input_common['release_enable_partners'] = False
        if not is_eme_free_enabled(self.product, self.version):
            input_common['release_enable_emefree'] = False

        if self.partial_updates:
            input_common['partial_updates'] = {}
            for partial_version, info in self.partial_updates.items():
                input_common['partial_updates'][partial_version] = {
                    'buildNumber': info['buildNumber'],
                    'locales': info['locales']
                }
        for phase in self.release_promotion_flavors():
            action_task_input = copy.deepcopy(input_common)
            action_task_input['previous_graph_ids'] = list(previous_graph_ids)
            action_task_input['release_promotion_flavor'] = phase['name']
            action_task_id, action_task, context = generate_action_task(
                decision_task_id=self.decision_task_id,
                action_name='release-promotion',
                action_task_input=action_task_input,
                actions=self.actions,
            )
            blob.append({
                'task_id': action_task_id,
                'task': action_task,
                'status': 'pending'
            })
            if phase['in_previous_graph_ids']:
                previous_graph_ids.append(action_task_id)
            phase_obj = Phase(phase['name'], action_task_id,
                              json.dumps(action_task), json.dumps(context))
            phase_obj.signoffs = self.phase_signoffs(self.branch, self.product,
                                                     phase['name'])
            phases.append(phase_obj)
        self.phases = phases
    def generate_phases(self, partner_urls=None, github_token=None):
        phases = []
        previous_graph_ids = [self.decision_task_id]
        next_version = bump_version(self.version.replace('esr', ''))
        input_common = {
            'build_number': self.build_number,
            'next_version': next_version,
            # specify version rather than relying on in-tree version,
            # so if a version bump happens between the build and an action task
            # revision, we still use the correct version.
            'version': self.version,
            'release_eta': self.release_eta
        }
        if not is_partner_enabled(self.product, self.version):
            input_common['release_enable_partners'] = False
        if not is_eme_free_enabled(self.product, self.version):
            input_common['release_enable_emefree'] = False

        if self.partial_updates:
            input_common['partial_updates'] = {}
            for partial_version, info in self.partial_updates.items():
                input_common['partial_updates'][partial_version] = {
                    'buildNumber': info['buildNumber'],
                    'locales': info['locales']
                }
        target_action = find_action('release-promotion', self.actions)
        kind = target_action['kind']
        for phase in self.release_promotion_flavors():
            input_ = copy.deepcopy(input_common)
            input_['release_promotion_flavor'] = phase['name']
            input_['previous_graph_ids'] = list(previous_graph_ids)
            if kind == 'task':
                action_task_id, action_task, context = generate_action_task(
                    decision_task_id=self.decision_task_id,
                    action_name='release-promotion',
                    input_=input_,
                    actions=self.actions,
                )
                if phase['in_previous_graph_ids']:
                    previous_graph_ids.append(action_task_id)
                phase_obj = Phase(phase['name'], action_task_id,
                                  json.dumps(action_task), json.dumps(context))
            elif kind == 'hook':
                hook = generate_action_hook(
                    task_group_id=self.decision_task_id,
                    action_name='release-promotion',
                    actions=self.actions,
                    input_=input_,
                )
                hook_no_context = {
                    k: v
                    for k, v in hook.items() if k != 'context'
                }
                phase_obj = Phase(
                    name=phase['name'],
                    task_id='',
                    task=json.dumps(hook_no_context),
                    context=json.dumps(hook['context']),
                )
                # we need to update input_['previous_graph_ids'] later, because
                # the task IDs cannot be set for hooks in advance
                if phase['in_previous_graph_ids']:
                    previous_graph_ids.append(phase['name'])
            else:
                raise ValueError(f'Unsupported kind: {kind}')

            phase_obj.signoffs = self.phase_signoffs(self.branch, self.product,
                                                     phase['name'])
            phases.append(phase_obj)
        self.phases = phases
Ejemplo n.º 3
0
    def generate_phases(self, partner_urls=None, github_token=None):
        phases = []
        previous_graph_ids = [self.decision_task_id]
        next_version = bump_version(self.version.replace('esr', ''))
        input_common = {
            'build_number': self.build_number,
            'next_version': next_version,
            # specify version rather than relying on in-tree version,
            # so if a version bump happens between the build and an action task
            # revision, we still use the correct version.
            'version': self.version,
            'release_eta': self.release_eta
        }
        if not is_partner_enabled(self.product, self.version):
            input_common['release_enable_partners'] = False
        if not is_eme_free_enabled(self.product, self.version):
            input_common['release_enable_emefree'] = False

        if self.partial_updates:
            input_common['partial_updates'] = {}
            for partial_version, info in self.partial_updates.items():
                input_common['partial_updates'][partial_version] = {
                    'buildNumber': info['buildNumber'],
                    'locales': info['locales']
                }
        target_action = find_action('release-promotion', self.actions)
        kind = target_action['kind']
        for phase in self.release_promotion_flavors():
            input_ = copy.deepcopy(input_common)
            input_['release_promotion_flavor'] = phase['name']
            input_['previous_graph_ids'] = list(previous_graph_ids)
            if kind == 'task':
                action_task_id, action_task, context = generate_action_task(
                    decision_task_id=self.decision_task_id,
                    action_name='release-promotion',
                    input_=input_,
                    actions=self.actions,
                )
                if phase['in_previous_graph_ids']:
                    previous_graph_ids.append(action_task_id)
                phase_obj = Phase(
                    phase['name'], action_task_id, json.dumps(action_task), json.dumps(context))
            elif kind == 'hook':
                hook = generate_action_hook(
                    task_group_id=self.decision_task_id,
                    action_name='release-promotion',
                    actions=self.actions,
                    input_=input_,
                )
                hook_no_context = {k: v for k, v in hook.items() if k != 'context'}
                phase_obj = Phase(
                    name=phase['name'],
                    task_id='',
                    task=json.dumps(hook_no_context),
                    context=json.dumps(hook['context']),
                )
                # we need to update input_['previous_graph_ids'] later, because
                # the task IDs cannot be set for hooks in advance
                if phase['in_previous_graph_ids']:
                    previous_graph_ids.append(phase['name'])
            else:
                raise ValueError(f'Unsupported kind: {kind}')

            phase_obj.signoffs = self.phase_signoffs(self.branch, self.product, phase['name'])
            phases.append(phase_obj)
        self.phases = phases