Example #1
0
 def test_valid(self, fetch_allthethings_data):
     """Test if the function finds the right downstream jobs."""
     fetch_allthethings_data.return_value = ALLTHETHINGS
     build = 'OS X 10.7 try build'
     obtained = sorted(get_downstream_jobs(build))
     expected = sorted(GRAPH_RESULT['opt']['macosx64'][build])
     assert obtained == expected
 def test_valid(self, fetch_allthethings_data):
     """Test if the function finds the right downstream jobs."""
     fetch_allthethings_data.return_value = ALLTHETHINGS
     build = 'OS X 10.7 try build'
     obtained = sorted(get_downstream_jobs(build))
     expected = sorted(GRAPH_RESULT['opt']['macosx64'][build])
     assert obtained == expected
Example #3
0
 def test_valid(self, fetch_allthethings_data):
     """Test if the function finds the right downstream jobs."""
     fetch_allthethings_data.return_value = ALLTHETHINGS
     build = 'Android armv7 API 15+ try build'
     obtained = sorted(get_downstream_jobs(build))
     expected = sorted(GRAPH_RESULT['opt']['android-api-15'][build])
     assert obtained == expected
Example #4
0
 def test_valid(self, fetch_allthethings_data):
     """Test if the function finds the right downstream jobs."""
     fetch_allthethings_data.return_value = MOCK_ALLTHETHINGS
     self.assertEquals(sorted(get_downstream_jobs('Platform1 repo build')),
                       [
                           'Platform1 repo opt test mochitest-1',
                           'Platform1 repo talos tp5o'
                       ])
 def test_valid(self, fetch_allthethings_data):
     """Test if the function finds the right downstream jobs."""
     fetch_allthethings_data.return_value = MOCK_ALLTHETHINGS
     self.assertEquals(
         sorted(get_downstream_jobs('Platform1 repo build')),
         [
             'Platform1 repo opt test mochitest-1',
             'Platform1 repo talos tp5o'
         ])
def main():
    parser = ArgumentParser()
    parser.add_argument("--debug",
                        action="store_true",
                        dest="debug",
                        help="set debug for logging.")

    parser.add_argument("--dry-run",
                        action="store_true",
                        dest="dry_run",
                        help="Dry run. No real actions are taken.")

    parser.add_argument("--repo-name",
                        action="store",
                        dest="repo_name",
                        type=str,
                        help="Repository name, e.g. mozilla-inbound.")

    parser.add_argument("--revision",
                        action="store",
                        dest="revision",
                        type=str,
                        help="12-char representing a push.")

    parser.add_argument("--trigger-from-task-id",
                        action="store",
                        dest="trigger_from_task_id",
                        type=str,
                        help="Trigger builders based on build task (use with "
                        "--builders).")

    parser.add_argument("--builders",
                        action="store",
                        dest="builders",
                        type=str,
                        help="Use this if you want to pass a list of builders "
                        "(e.g. \"['builder 1']\".")

    parser.add_argument("--children-of",
                        action="store",
                        dest="children_of",
                        type=str,
                        help="This allows you to request a list of all the associated "
                        "test jobs to a build job.")

    parser.add_argument("-g", "--graph",
                        action="store",
                        dest="builders_graph",
                        help='Graph of builders in the form of: '
                             'dict(builder: [dep_builders].')

    options = parser.parse_args()

    if options.debug:
        setup_logging(logging.DEBUG)
    else:
        setup_logging()

    assert options.repo_name and options.revision, \
        "Make sure you specify --repo-name and --revision"

    if not options.dry_run and not credentials_available():
        sys.exit(1)
    repo_url = query_repo_url(options.repo_name)
    revision = query_push_by_revision(repo_url=repo_url,
                                      revision=options.revision,
                                      return_revision_list=True)
    builders = None
    if options.builders:
        builders = ast.literal_eval(options.builders)
    else:
        builders = get_downstream_jobs(options.children_of)

    if options.trigger_from_task_id and builders:
        trigger_builders_based_on_task_id(
            repo_name=options.repo_name,
            revision=revision,
            task_id=options.trigger_from_task_id,
            builders=builders,
            dry_run=options.dry_run
        )
    elif builders:
        tc_graph = generate_tc_graph_from_builders(
            builders=builders,
            repo_name=options.repo_name,
            revision=revision
        )
        mgr = TaskClusterManager()
        mgr.schedule_graph(
            task_graph=tc_graph,
            dry_run=options.dry_run
        )
    elif options.builders_graph:
        mgr = TaskClusterBuildbotManager()
        mgr.schedule_graph(
            repo_name=options.repo_name,
            revision=revision,
            builders_graph=ast.literal_eval(options.builders_graph),
            dry_run=options.dry_run
        )
    else:
        print "Please read the help menu to know what options are available to you."
def main():
    parser = ArgumentParser()
    parser.add_argument("--debug",
                        action="store_true",
                        dest="debug",
                        help="set debug for logging.")

    parser.add_argument("--dry-run",
                        action="store_true",
                        dest="dry_run",
                        help="Dry run. No real actions are taken.")

    parser.add_argument("--repo-name",
                        action="store",
                        dest="repo_name",
                        type=str,
                        help="Repository name, e.g. mozilla-inbound.")

    parser.add_argument("--revision",
                        action="store",
                        dest="revision",
                        type=str,
                        help="12-char representing a push.")

    parser.add_argument("--trigger-from-task-id",
                        action="store",
                        dest="trigger_from_task_id",
                        type=str,
                        help="Trigger builders based on build task (use with "
                        "--builders).")

    parser.add_argument("--builders",
                        action="store",
                        dest="builders",
                        type=str,
                        help="Use this if you want to pass a list of builders "
                        "(e.g. \"['builder 1']\".")

    parser.add_argument(
        "--children-of",
        action="store",
        dest="children_of",
        type=str,
        help="This allows you to request a list of all the associated "
        "test jobs to a build job.")

    parser.add_argument("-g",
                        "--graph",
                        action="store",
                        dest="builders_graph",
                        help='Graph of builders in the form of: '
                        'dict(builder: [dep_builders].')

    options = parser.parse_args()

    if options.debug:
        setup_logging(logging.DEBUG)
    else:
        setup_logging()

    assert options.repo_name and options.revision, \
        "Make sure you specify --repo-name and --revion"

    if not options.dry_run and not credentials_available():
        sys.exit(1)

    mgr = TaskClusterBuildbotManager()
    builders = None
    if options.builders:
        builders = ast.literal_eval(options.builders)
    else:
        builders = get_downstream_jobs(options.children_of)

    if options.trigger_from_task_id and builders:
        trigger_builders_based_on_task_id(repo_name=options.repo_name,
                                          revision=options.revision,
                                          task_id=options.trigger_from_task_id,
                                          builders=builders,
                                          dry_run=options.dry_run)
    elif builders and len(builders) == 1:
        mgr.schedule_arbitrary_job(repo_name=options.repo_name,
                                   revision=options.revision,
                                   uuid=builders[0],
                                   dry_run=options.dry_run)
    elif options.builders_graph:
        mgr.schedule_graph(repo_name=options.repo_name,
                           revision=options.revision,
                           builders_graph=ast.literal_eval(
                               options.builders_graph),
                           dry_run=options.dry_run)
    else:
        print "Please read the help menu to know what options are available to you."