Example #1
0
def do_deploy_read_new_recipe(args):
    # 2. The full recipe is cloned into .jsc/new-recipe/src if the path is a git repo.
    # The .git folder should not be included.
    path = args["path"]
    path_parts = path.split(":")
    if path_parts[0] == "github":
        # github repo id format.
        repo_url = "git://github/" + path_parts[0:].join(":") + ".git"
    else:
        repo_url = path
    if giturlparse.validate(repo_url):
        success, msg = git_clone(repo_url, "src", 1, None, None)
        if not success:
            return None, {"code": DO_DEPLOY_NO_NEWRECIPE, "message": "There is no recipe script to execute"}
        rmtree(os.path.join(NEW_RECIPE_SRC, ".git"))
        # 3. A disk sync is performed on /app/code.
        sync_dir("/")
    # 4. Syncing the jumpstart repo so it"s up to date.
    # Not needed, jumpstart -Sy is a better solution
    # 5. The recipe (.jsc/new-recipe/src/Jumpstart-Recipe) is executed by
    #    interpretation in jsc.
    recipe_script = read_new_recipe()
    if recipe_script is None:
        return None, {"code": DO_DEPLOY_NO_NEWRECIPE, "message": "There is no recipe script to execute"}
    return recipe_script, None
Example #2
0
    def do_deploy(self, args):
        """
        Usage:
          deploy [--dev] <path>

        Deploys a recipe.

        Arguments:
          <path>        A path to the local recipe or a git repo which contains a recipe.

        Options:
          --dev         Uses git clone instead of git archive to keep .git.
                        This should NOT be done on an assembly that are going to be released.
        """
        try:
            self._rpc.do_deploy_reset_check()
            path = args['path']
            if not giturlparse.validate(path):
                if not path.startswith("/"):
                    path = os.path.join(os.getcwd(), path)
                rpc_put_recipe(self._rpc, path, should_skip=get_filter(os.path.join(path, ".jscignore")))
            rec = self._rpc.do_deploy_read_new_recipe({"path": path})
            state = recipe.run(self._rpc, rec, args['--dev'])
            args.update({"state": state})
            self._rpc.do_deploy_finalize(args)
        except SshRpcCallError as e:
            log.white(str(e))
 def url(self, url):
     """Setter to the repository's URL."""
     if validate(url):
         self._url = url
         git_parse = parse(url)
         self._git_platform = git_parse.platform
         self._git_host = git_parse.host
         self._git_owner = git_parse.owner
         self._git_repository = git_parse.repo
    def url(self, url):
        """Setter to the repository's URL."""
        if validate(url):
            self._url = url
        else:
            message = self.tr('Error: URL is not a valid GIT URL.')
            raise Exception(message)

        git_parse = parse(url)
        self._git_host = git_parse.host
        self._git_owner = git_parse.owner
        self._git_repository = git_parse.repo
 def url(self, url: str):
     """Setter to the repository's URL."""
     if validate(url):
         self._url = url
         git_parse = parse(url)
         self._git_platform = git_parse.platform
         self._git_host = git_parse.host
         self._git_owner = git_parse.owner
         self._git_repository = git_parse.repo
         LOGGER.debug("git parse URL: " + str(url))
         LOGGER.debug(" platform: " + str(git_parse.platform))
         LOGGER.debug(" host: " + str(git_parse.host))
         LOGGER.debug(" owner: " + str(git_parse.owner))
         LOGGER.debug(" repository: " + str(git_parse.repo))
Example #6
0
def check_git_url(repo_url):
    if not giturlparse.validate(repo_url):
        raise argparse.ArgumentTypeError(f'{repo_url} is not valid GitHub url')
    return repo_url