Пример #1
0
def test_check_dockerfile_present(monkeypatch, path_exists, caplog):
    monkeypatch.setattr(os.path, "exists", lambda x: path_exists)

    job_dir = "my/job/dir"

    if not path_exists:
        with pytest.raises(SystemExit):
            docker_utils.check_dockerfile_present(job_dir)
        assert 2 == len(caplog.records)
    else:
        docker_utils.check_dockerfile_present(job_dir)
Пример #2
0
def build(job_dir, conf, config_file, image_tag):
    image_name = conf.pipeline_options.worker_harness_container_image
    client = docker.from_env()

    if config_file:
        basename = os.path.basename(config_file)
        image_tag = "{}-{}".format(image_tag, basename)

    docker_utils.check_docker_connection(client)
    docker_utils.check_dockerfile_present(job_dir)
    docker_utils.build_docker_image(job_dir, image_name, image_tag,
                                    config_file)
Пример #3
0
 def _check_docker_setup(self):
     self._docker_client = docker.from_env()
     docker_utils.check_docker_connection(self._docker_client)
     docker_utils.check_dockerfile_present(self.job_dir)