Пример #1
0
def build(name,
          debs_path=None,
          path_to_missile=None,
          app_version=None,
          env_version=None,
          service_version=None,
          webcallback=None):
    """
    Build the package for the working copy remotely via trebuchet.
    <name> of the working copy folder.
    <debs_path> path to where the DEB package should be created into.
    <path_to_missile> relative path to the missile file for trebuchet
    <app_version> version specific for the application package built.
    <env_version> version specific for the lib/environment package built.
    <service_version> version specific for the services packages built.
    <webcallback> web URI to send Trebuchet callbacks to.
    """
    # Get value from .gachetterc
    debs_path = debs_path if 'debs_path' not in env else env.debs_path
    if debs_path is None:
        abort("""
            Either specify the debs_path in your call or add it to the .gachetterc file.""")

    wc = WorkingCopy(name)
    wc.set_version(app=app_version, env=env_version, service=service_version)
    wc.build(debs_path, path_to_missile, webcallback, trebuchet_bin=trebuchet_bin)
Пример #2
0
def prepare(name, url=None, ref='origin/master'):
    """
    Prepare the working copy remotely for the project.
    <name> of the working copy folder.
    <url> is the url of the repo in github.
    <ref> is the branch/tag/rev that will be actually check out
    """
    wc = WorkingCopy(name)
    wc.prepare_environment()
    return wc.checkout_working_copy(url, ref)
Пример #3
0
def prepare(name, url=None, ref='origin/master'):
    """
    Prepare the working copy remotely for the project.
    <name> of the working copy folder.
    <url> is the url of the repo in github.
    <ref> is the branch/tag/rev that will be actually check out
    """
    wc = WorkingCopy(name)
    wc.prepare_environment()
    return wc.checkout_working_copy(url, ref)
Пример #4
0
def prepare(name, url=None, branch='master'):
    """
    Prepare the working copy remotely for the project.
    <name> of the working copy folder.
    <url> is the url of the repo in github.
    <branch> is the branch to actually checkout.
    """
    wc = WorkingCopy(name)
    wc.prepare_environment()
    return wc.checkout_working_copy(url, branch)
Пример #5
0
def quick(domain, stack_version, project_name, ref="origin/master", url=None, path_to_missile=None, debs_path=None, meta_path=None):
    """
    One-command to build and add to stack a specific branch.
    Depends heavily on pre-configuration via config file.
    Package version are set from Git commit.

    <domain> domain where the stack will be registered to (some kind of type for stack).
    <stack_version> version of the stack to attach the package to.
    <project_name> name of the project.
    <branch> is the branch to actually checkout.
    <url> is the url of the repo in github.
    <path_to_missile> is the path to the missile file in the project that will be used by trebuchet to build packages.
    <debs_path> path to where the DEB package should be created into.
    <meta_path> path to the stacks and other meta information related to package
    """
    # Get value for the project, complain otherwise
    meta_path = meta_path if 'meta_path' not in env else env.meta_path
    debs_path = debs_path if 'debs_path' not in env else env.debs_path
    url = url if "projects" not in env or project_name not in env.projects or 'url' not in env.projects[project_name] else env.projects[project_name]['url']
    path_to_missile = path_to_missile if "projects" not in env or project_name not in env.projects or 'path_to_missile' not in env.projects[project_name] else env.projects[project_name]['path_to_missile']
    
    if not meta_path or not debs_path:
        abort("Please specify a meta_path/debs_path or add it approprietly in a config file")

    if not url:
        abort("Please specify a url or add it approprietly in a config file: projects.%s.url" % project_name)

    name = project_name if ref is None else project_name+"_"+ref.replace("/", "-")

    # use existing stack only (create one manually)
    new_stack = Stack(domain, stack_version, meta_path=meta_path)
    if not new_stack.is_persisted():
        abort("""Please create a new stack first, using: `gachette stack_create`""")

    # Checkout specific branch and build
    wc = WorkingCopy(name)
    wc.prepare_environment()
    wc.checkout_working_copy(url, ref)

    # set version based on the git commit
    suffix = "" if ref is None else ref.replace("/", "-")
    version = wc.get_version_from_git(suffix=suffix)
    wc.set_version(app=version, env=version, service=version)

    results = wc.build(debs_path, path_to_missile, trebuchet_bin=trebuchet_bin)
    print "results: ", results
    # TODO extract package build results properly
    for item in results:
        new_stack.add_package(item['name'], item['version'], item['file_name'])
Пример #6
0
def build(name,
          debs_path=None,
          path_to_missile=None,
          app_version=None,
          env_version=None,
          service_version=None,
          webcallback=None):
    """
    Build the package for the working copy remotely via trebuchet.
    <name> of the working copy folder.
    <debs_path> path to where the DEB package should be created into.
    <path_to_missile> relative path to the missile file for trebuchet
    <app_version> version specific for the application package built.
    <env_version> version specific for the lib/environment package built.
    <service_version> version specific for the services packages built.
    <webcallback> web URI to send Trebuchet callbacks to.
    """
    # Get value from .gachetterc
    debs_path = debs_path if 'debs_path' not in env else env.debs_path
    if debs_path is None:
        abort("""
            Either specify the debs_path in your call or add it to the .gachetterc file."""
              )

    wc = WorkingCopy(name)
    wc.set_version(app=app_version, env=env_version, service=service_version)
    wc.build(debs_path,
             path_to_missile,
             webcallback,
             trebuchet_bin=trebuchet_bin)
Пример #7
0
def quick(domain,
          stack_version,
          project_name,
          ref="origin/master",
          url=None,
          path_to_missile=None,
          debs_path=None,
          meta_path=None):
    """
    One-command to build and add to stack a specific branch.
    Depends heavily on pre-configuration via config file.
    Package version are set from Git commit.

    <domain> domain where the stack will be registered to (some kind of type for stack).
    <stack_version> version of the stack to attach the package to.
    <project_name> name of the project.
    <branch> is the branch to actually checkout.
    <url> is the url of the repo in github.
    <path_to_missile> is the path to the missile file in the project that will be used by trebuchet to build packages.
    <debs_path> path to where the DEB package should be created into.
    <meta_path> path to the stacks and other meta information related to package
    """
    # Get value for the project, complain otherwise
    meta_path = meta_path if 'meta_path' not in env else env.meta_path
    debs_path = debs_path if 'debs_path' not in env else env.debs_path
    url = url if "projects" not in env or project_name not in env.projects or 'url' not in env.projects[
        project_name] else env.projects[project_name]['url']
    path_to_missile = path_to_missile if "projects" not in env or project_name not in env.projects or 'path_to_missile' not in env.projects[
        project_name] else env.projects[project_name]['path_to_missile']

    if not meta_path or not debs_path:
        abort(
            "Please specify a meta_path/debs_path or add it approprietly in a config file"
        )

    if not url:
        abort(
            "Please specify a url or add it approprietly in a config file: projects.%s.url"
            % project_name)

    name = project_name if ref is None else project_name + "_" + ref.replace(
        "/", "-")

    # use existing stack only (create one manually)
    new_stack = Stack(domain, stack_version, meta_path=meta_path)
    if not new_stack.is_persisted():
        abort(
            """Please create a new stack first, using: `gachette stack_create`"""
        )

    # Checkout specific branch and build
    wc = WorkingCopy(name)
    wc.prepare_environment()
    wc.checkout_working_copy(url, ref)

    # set version based on the git commit
    suffix = "" if ref is None else ref.replace("/", "-")
    version = wc.get_version_from_git(suffix=suffix)
    wc.set_version(app=version, env=version, service=version)

    results = wc.build(debs_path, path_to_missile, trebuchet_bin=trebuchet_bin)
    print "results: ", results
    # TODO extract package build results properly
    for item in results:
        new_stack.add_package(item['name'], item['version'], item['file_name'])