Exemplo n.º 1
0
def handle_build(commit_hash, image_name):
    """
    ensure the api represents that the image was built from the commit

    The iteration gets it's build name updated and releases are created
    for the branch's automatic pipelines. The branch's automatic pipelines
    are run.

    """

    print("handling build ({}, {})".format(commit_hash, image_name,))
    iteration = get_iteration(commit_hash=commit_hash)
    set_iteration(iteration['iteration_id'], {'image_name': image_name})
    releases = idem_release_in_automatic_pipelines(iteration['iteration_id'])
    print("running releases {}".format(releases))
    run(releases)
    return {'iteration_id': iteration['iteration_id']}
Exemplo n.º 2
0
    def test_set_iteration(self):
        """ should set properties on iterations """
        # run SUT
        result = set_iteration("mock-iteration-id", {"commit_hash": "new-commit-hash", "a": "b"})

        # confirm reasonable sql was executed
        self.mock_get_cur.return_value.execute.assert_called_once_with(
            "UPDATE iteration " + "SET a=%s,commit_hash=%s " + "WHERE iteration_id=%s",
            ("b", "new-commit-hash", "mock-iteration-id"),
        )