def test_generate_deb_from_directory(): tempdir = tempfile.gettempdir() checkout_dir = os.path.join(tempdir, 'vdist') git_p = subprocess.Popen( ['git', 'clone', 'https://github.com/objectified/vdist', checkout_dir]) git_p.communicate() builder = Builder() builder.add_build( app='vdist-test-generate-deb-from-dir', version='1.0', source=directory( path=checkout_dir, ), profile='ubuntu-trusty' ) builder.build() homedir = os.path.expanduser('~') target_file = os.path.join( homedir, '.vdist', 'dist', 'vdist-test-generate-deb-from-dir-1.0-ubuntu-trusty', 'vdist-test-generate-deb-from-dir_1.0_amd64.deb' ) assert os.path.isfile(target_file) assert os.path.getsize(target_file) > 0
def test_generate_deb_from_git(): builder = Builder() builder.add_build( app='vdist-test-generate-deb-from-git', version='1.0', source=git( uri='https://github.com/objectified/vdist', branch='master' ), profile='ubuntu-trusty' ) builder.build() homedir = os.path.expanduser('~') target_file = os.path.join( homedir, '.vdist', 'dist', 'vdist-test-generate-deb-from-git-1.0-ubuntu-trusty', 'vdist-test-generate-deb-from-git_1.0_amd64.deb' ) assert os.path.isfile(target_file) assert os.path.getsize(target_file) > 0
from vdist.builder import Builder from vdist.source import directory, git_directory builder = Builder() # build from a local directory builder.add_build(name='my directory based build', app='myproject', version='1.0', source=directory(path='/home/user/dev/yourproject'), profile='centos6') # or, build from a git repo *inside* a local directory builder.add_build(name='my directory based build', app='myproject', version='1.0', source=git_directory(path='/home/user/dev/anotherproject', branch='your-release-branch'), profile='centos6') # .. and build them in parallel builder.build()
def _call_builder(builder_parameters): builder = Builder() builder.add_build(**builder_parameters) builder.build()
# add CentOS6 build builder.add_build( name="myproject centos6 build", app="myproject", version="1.0", source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"), profile="centos6", ) # add CentOS7 build builder.add_build( name="myproject centos7 build", app="myproject", version="1.0", source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"), profile="centos7", ) # add Ubuntu Trusty build builder.add_build( name="myproject ubuntu build", app="myproject", version="1.0", source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"), profile="ubuntu-trusty", ) # vdist will now build them all in parallel # on separate docker containers builder.build()
def test_builder_nobuilds(): b = Builder() with pytest.raises(NoBuildsFoundException): b.build()