Esempio n. 1
0
 def prepare(self, dryrun=False):
     """ Prepare the release."""
     cwd = os.getcwd()
     if not os.path.isdir(self.repo.mp_dir):
         self.clone()
     os.chdir(self.repo.mp_dir)
     marketplaces_skipped = []
     for marketplace in self.get_packages_list():
         log("")
         if self.mp_config.has_option(marketplace, "skip"):
             log("[%s]" % marketplace)
             log("[WARN] Skipped '%s' (%s)" % (marketplace, self.mp_config.get(marketplace, "skip")))
             marketplaces_skipped.append(marketplace)
             upgrade_only = True
         else:
             upgrade_only = False
         if self.mp_config.getboolean(marketplace, "prepared"):
             log("[%s]" % marketplace)
             log("Skipped '%s' (%s)" % (marketplace, "Already prepared"))
             continue
         try:
             mp_dir = os.path.join(self.repo.mp_dir, marketplace)
             if not os.path.isdir(mp_dir):
                 os.chdir(self.repo.mp_dir)
                 self.repo.git_pull(marketplace, self.mp_config.get(marketplace, "branch"))
             else:
                 log("[%s]" % marketplace)
             os.chdir(mp_dir)
             mp_repo = Repository(os.getcwd(), self.alias)
             if upgrade_only:
                 log("Upgrade skipped %s..." % marketplace)
             else:
                 log("Prepare release of %s..." % marketplace)
             mp_release = Release(mp_repo,
                                  self.mp_config.get(marketplace, "branch"),
                                  self.mp_config.get(marketplace, "tag"),
                                  self.mp_config.get(marketplace, "next_snapshot"),
                                  self.mp_config.get(marketplace, "maintenance_version"),
                                  is_final=True,
                                  skipTests=self.mp_config.getboolean(marketplace, "skipTests"),
                                  skipITs=self.mp_config.getboolean(marketplace, "skipITs"),
                                  other_versions=self.mp_config.get(marketplace, "other_versions", None),
                                  auto_increment_policy=self.mp_config.get(marketplace, "auto_increment_policy",
                                                                           "auto_patch"))
             mp_release.log_summary()
             mp_release.prepare(dryrun=dryrun, upgrade_only=upgrade_only, dodeploy=True)
             prepared = True
         except Exception, e:
             stack = traceback.format_exc()
             if hasattr(e, 'message') and e.message is not None:
                 stack = e.message + "\n" + stack
             log("[ERROR] %s" % stack)
             prepared = False
             stack = stack.replace("%", "%%")
             self.mp_config.set(marketplace, "skip", "Failed! %s" % stack)
         self.mp_config.set(marketplace, "prepared", str(prepared))
         self.repo.save_mp_config(self.mp_config)
         if prepared and not upgrade_only:
             self.upload(CONNECT_TEST_URL, marketplace, dryrun=dryrun)
Esempio n. 2
0
 def prepare(self, dryrun=False):
     """ Prepare the release."""
     cwd = os.getcwd()
     if not os.path.isdir(self.repo.mp_dir):
         self.clone()
     os.chdir(self.repo.mp_dir)
     marketplaces_skipped = []
     for marketplace in self.get_packages_list():
         log("")
         if self.mp_config.has_option(marketplace, "skip"):
             log("[%s]" % marketplace)
             log("[WARN] Skipped '%s' (%s)" % (marketplace, self.mp_config.get(marketplace, "skip")))
             marketplaces_skipped.append(marketplace)
             upgrade_only = True
         else:
             upgrade_only = False
         if self.mp_config.getboolean(marketplace, "prepared"):
             log("[%s]" % marketplace)
             log("Skipped '%s' (%s)" % (marketplace, "Already prepared"))
             continue
         try:
             mp_dir = os.path.join(self.repo.mp_dir, marketplace)
             if not os.path.isdir(mp_dir):
                 os.chdir(self.repo.mp_dir)
                 self.repo.git_pull(marketplace, self.mp_config.get(marketplace, "branch"))
             else:
                 log("[%s]" % marketplace)
             os.chdir(mp_dir)
             mp_repo = Repository(os.getcwd(), self.alias)
             if upgrade_only:
                 log("Upgrade skipped %s..." % marketplace)
             else:
                 log("Prepare release of %s..." % marketplace)
             mp_release = Release(mp_repo,
                                  self.mp_config.get(marketplace, "branch"),
                                  self.mp_config.get(marketplace, "tag"),
                                  self.mp_config.get(marketplace, "next_snapshot"),
                                  self.mp_config.get(marketplace, "maintenance_version"),
                                  is_final=True,
                                  skipTests=self.mp_config.getboolean(marketplace, "skipTests"),
                                  skipITs=self.mp_config.getboolean(marketplace, "skipITs"),
                                  other_versions=self.mp_config.get(marketplace, "other_versions", None))
             mp_release.log_summary()
             mp_release.prepare(dryrun=dryrun, upgrade_only=upgrade_only, dodeploy=True)
             prepared = True
         except Exception, e:
             stack = traceback.format_exc()
             if hasattr(e, 'message') and e.message is not None:
                 stack = e.message + "\n" + stack
             log("[ERROR] %s" % stack)
             prepared = False
             stack = stack.replace("%", "%%")
             self.mp_config.set(marketplace, "skip", "Failed! %s" % stack)
         self.mp_config.set(marketplace, "prepared", str(prepared))
         self.repo.save_mp_config(self.mp_config)
         if prepared and not upgrade_only:
             self.upload(CONNECT_TEST_URL, marketplace, dryrun=dryrun)
Esempio n. 3
0
 def prepare(self, dryrun=False):
     """ Prepare the release."""
     cwd = os.getcwd()
     marketplaces = self.mp_config.sections()
     if self.restart_from:
         idx = marketplaces.index(self.restart_from)
         marketplaces = marketplaces[idx:]
     for marketplace in marketplaces:
         if self.mp_config.has_option(marketplace, "skip"):
             log("[WARN] Skipped '%s' (%s)" % (marketplace,
                                 self.mp_config.get(marketplace, "skip")))
             continue
         if self.mp_config.getboolean(marketplace, "prepared"):
             log("Skipped '%s' (%s)" % (marketplace, "Already prepared"))
             continue
         try:
             log("Prepare %s" % marketplace)
             os.chdir(os.path.join(self.repo.mp_dir, marketplace))
             mp_repo = Repository(os.getcwd(), self.alias)
             # Prepare release
             mp_release = Release(mp_repo,
                     self.mp_config.get(marketplace, "branch"),
                     self.mp_config.get(marketplace, "tag"),
                     self.mp_config.get(marketplace, "next_snapshot"),
                     self.mp_config.get(marketplace, "maintenance_version"),
                     is_final=True, skipTests=False,
                     other_versions=self.mp_config.get(
                                             marketplace, "other_versions",
                                             None))
             mp_release.log_summary()
             mp_release.prepare(dryrun=dryrun)
             prepared = True
         except:
             stack = traceback.format_exc()
             log("[ERROR] %s" % stack)
             prepared = False
             self.mp_config.set(marketplace, "skip", "Failed! %s" % stack)
         self.mp_config.set(marketplace, "prepared", prepared)
         self.repo.save_mp_config(self.mp_config)
         if (prepared):
             # Upload on Connect test
             for dirpath, _, filenames in os.walk(mp_repo.basedir):
                 for name in filenames:
                     path = os.path.join(dirpath, name)
                     if (os.path.isfile(path) and
                         fnmatch.fnmatch(path[len(mp_repo.basedir) + 1:],
                         self.mp_config.get(marketplace, "mp_to_upload"))):
                         self.upload(CONNECT_TEST_URL, path)
                         self.mp_config.set(marketplace, "uploaded",
                                            CONNECT_TEST_URL + ": " + path)
                         self.repo.save_mp_config(self.mp_config)
     os.chdir(cwd)
Esempio n. 4
0
    def prepare(self, dryrun=False):
        """ Prepare the release."""
        cwd = os.getcwd()
        if not os.path.isdir(self.repo.mp_dir):
            self.clone()
        os.chdir(self.repo.mp_dir)
        marketplaces_skipped = []
        for marketplace in self.get_packages_list():
            log("")
            if self.mp_config.has_option(marketplace, "skip"):
                log("[%s]" % marketplace)
                log("[WARN] Skipped '%s' (%s)" %
                    (marketplace, self.mp_config.get(marketplace, "skip")))
                marketplaces_skipped.append(marketplace)
                upgrade_only = True
            else:
                upgrade_only = False
            if self.mp_config.getboolean(marketplace, "prepared"):
                log("[%s]" % marketplace)
                log("Skipped '%s' (%s)" % (marketplace, "Already prepared"))
                continue
            try:
                mp_dir = os.path.join(self.repo.mp_dir, marketplace)
                if not os.path.isdir(mp_dir):
                    os.chdir(self.repo.mp_dir)
                    self.repo.git_pull(
                        marketplace, self.mp_config.get(marketplace, "branch"))
                else:
                    log("[%s]" % marketplace)
                os.chdir(mp_dir)
                mp_repo = Repository(os.getcwd(), self.alias)
                if upgrade_only:
                    log("Upgrade skipped %s..." % marketplace)
                else:
                    log("Prepare release of %s..." % marketplace)

                release_info = ReleaseInfo(
                    module=marketplace,
                    remote_alias=self.alias,
                    branch=self.mp_config.get(marketplace, "branch"),
                    tag=self.mp_config.get(marketplace, "tag"),
                    next_snapshot=self.mp_config.get(marketplace,
                                                     "next_snapshot"),
                    maintenance_version=self.mp_config.get(
                        marketplace, "maintenance_version"),
                    is_final=self.mp_config.getboolean(marketplace,
                                                       "is_final"),
                    skip_tests=self.mp_config.getboolean(
                        marketplace, "skipTests"),
                    skip_its=self.mp_config.getboolean(marketplace, "skipITs"),
                    profiles=self.mp_config.get(marketplace, "profiles"),
                    other_versions=self.mp_config.get(marketplace,
                                                      "other_versions"),
                    #files_pattern, props_pattern, msg_commit, msg_tag,
                    auto_increment_policy=self.mp_config.get(
                        marketplace, "auto_increment_policy"),
                    dryrun=dryrun)
                mp_release = Release(mp_repo, release_info)
                release_log = mp_release.log_summary()
                release_info.read_release_log(release_log)
                if dryrun:
                    print "DEBUG -- init %s with:" % marketplace
                for key, value in vars(release_info).iteritems():
                    if dryrun:
                        print "DEBUG: %s-%s=%s" % (marketplace, key, value)
                    self.mp_config.set("DEFAULT", marketplace + "-" + key,
                                       str(value))
                if dryrun:
                    print

                mp_release.prepare(dryrun=dryrun,
                                   upgrade_only=upgrade_only,
                                   dodeploy=True)
                prepared = True
            except Exception, e:
                stack = traceback.format_exc()
                if hasattr(e, 'message') and e.message is not None:
                    stack = e.message + "\n" + stack
                log("[ERROR] %s" % stack)
                prepared = False
                stack = stack.replace("%", "%%")
                self.mp_config.set(marketplace, "skip", "Failed! %s" % stack)
            self.mp_config.set(marketplace, "prepared", str(prepared))
            self.repo.save_mp_config(self.mp_config)
            if prepared and not upgrade_only:
                self.upload(CONNECT_TEST_URL, marketplace, dryrun=dryrun)
Esempio n. 5
0
 def prepare(self, dryrun=False):
     """ Prepare the release."""
     cwd = os.getcwd()
     if not os.path.isdir(self.repo.mp_dir):
         self.clone()
     os.chdir(self.repo.mp_dir)
     marketplaces = self.mp_config.sections()
     marketplaces_skipped = []
     if self.restart_from:
         idx = marketplaces.index(self.restart_from)
         marketplaces = marketplaces[idx:]
     for marketplace in marketplaces:
         log("")
         if self.mp_config.has_option(marketplace, "skip"):
             log("[%s]" % marketplace)
             log("[WARN] Skipped '%s' (%s)" % (marketplace,
                                 self.mp_config.get(marketplace, "skip")))
             marketplaces_skipped.append(marketplace)
             upgrade_only = True
         else:
             upgrade_only = False
         if self.mp_config.getboolean(marketplace, "prepared"):
             log("[%s]" % marketplace)
             log("Skipped '%s' (%s)" % (marketplace, "Already prepared"))
             continue
         try:
             mp_dir = os.path.join(self.repo.mp_dir, marketplace)
             if not os.path.isdir(mp_dir):
                 os.chdir(self.repo.mp_dir)
                 self.repo.git_pull(marketplace,
                                 self.mp_config.get(marketplace, "branch"))
             else:
                 log("[%s]" % marketplace)
             os.chdir(mp_dir)
             mp_repo = Repository(os.getcwd(), self.alias)
             if upgrade_only:
                 log("Upgrade skipped %s..." % marketplace)
             else:
                 log("Prepare release of %s..." % marketplace)
             mp_release = Release(mp_repo,
                     self.mp_config.get(marketplace, "branch"),
                     self.mp_config.get(marketplace, "tag"),
                     self.mp_config.get(marketplace, "next_snapshot"),
                     self.mp_config.get(marketplace, "maintenance_version"),
                     is_final=True, skipTests=False, skipITs=False,
                     other_versions=self.mp_config.get(
                                             marketplace, "other_versions",
                                             None))
             mp_release.log_summary()
             mp_release.prepare(dryrun=dryrun, upgrade_only=upgrade_only,
                                dodeploy=True)
             prepared = True
         except Exception, e:
             stack = traceback.format_exc()
             if hasattr(e, 'message') and e.message is not None:
                 stack = e.message + "\n" + stack
             log("[ERROR] %s" % stack)
             prepared = False
             stack = stack.replace("%", "%%")
             self.mp_config.set(marketplace, "skip", "Failed! %s" % stack)
         self.mp_config.set(marketplace, "prepared", str(prepared))
         self.repo.save_mp_config(self.mp_config)
         if prepared and not upgrade_only:
             # Upload on Connect test
             for dirpath, _, filenames in os.walk(mp_repo.basedir):
                 for name in filenames:
                     path = os.path.join(dirpath, name)
                     if (os.path.isfile(path) and
                         fnmatch.fnmatch(path[len(mp_repo.basedir) + 1:],
                         self.mp_config.get(marketplace, "mp_to_upload"))):
                         self.upload(CONNECT_TEST_URL, path, dryrun=dryrun)
                         self.mp_config.set(marketplace, "uploaded",
                                            CONNECT_TEST_URL + ": " + path)
                         self.repo.save_mp_config(self.mp_config)
Esempio n. 6
0
 def prepare(self, dryrun=False):
     """ Prepare the release."""
     cwd = os.getcwd()
     if not os.path.isdir(self.repo.mp_dir):
         self.clone()
     os.chdir(self.repo.mp_dir)
     marketplaces = self.mp_config.sections()
     marketplaces_skipped = []
     if self.restart_from:
         idx = marketplaces.index(self.restart_from)
         marketplaces = marketplaces[idx:]
     for marketplace in marketplaces:
         log("")
         if self.mp_config.has_option(marketplace, "skip"):
             log("[%s]" % marketplace)
             log("[WARN] Skipped '%s' (%s)" %
                 (marketplace, self.mp_config.get(marketplace, "skip")))
             marketplaces_skipped.append(marketplace)
             upgrade_only = True
         else:
             upgrade_only = False
         if self.mp_config.getboolean(marketplace, "prepared"):
             log("[%s]" % marketplace)
             log("Skipped '%s' (%s)" % (marketplace, "Already prepared"))
             continue
         try:
             mp_dir = os.path.join(self.repo.mp_dir, marketplace)
             if not os.path.isdir(mp_dir):
                 os.chdir(self.repo.mp_dir)
                 self.repo.git_pull(
                     marketplace, self.mp_config.get(marketplace, "branch"))
             else:
                 log("[%s]" % marketplace)
             os.chdir(mp_dir)
             mp_repo = Repository(os.getcwd(), self.alias)
             if upgrade_only:
                 log("Upgrade skipped %s..." % marketplace)
             else:
                 log("Prepare release of %s..." % marketplace)
             mp_release = Release(
                 mp_repo,
                 self.mp_config.get(marketplace, "branch"),
                 self.mp_config.get(marketplace, "tag"),
                 self.mp_config.get(marketplace, "next_snapshot"),
                 self.mp_config.get(marketplace, "maintenance_version"),
                 is_final=True,
                 skipTests=False,
                 skipITs=False,
                 other_versions=self.mp_config.get(marketplace,
                                                   "other_versions", None))
             mp_release.log_summary()
             mp_release.prepare(dryrun=dryrun,
                                upgrade_only=upgrade_only,
                                dodeploy=True)
             prepared = True
         except Exception, e:
             stack = traceback.format_exc()
             if hasattr(e, 'message') and e.message is not None:
                 stack = e.message + "\n" + stack
             log("[ERROR] %s" % stack)
             prepared = False
             stack = stack.replace("%", "%%")
             self.mp_config.set(marketplace, "skip", "Failed! %s" % stack)
         self.mp_config.set(marketplace, "prepared", str(prepared))
         self.repo.save_mp_config(self.mp_config)
         if prepared and not upgrade_only:
             # Upload on Connect test
             for dirpath, _, filenames in os.walk(mp_repo.basedir):
                 for name in filenames:
                     path = os.path.join(dirpath, name)
                     if (os.path.isfile(path) and fnmatch.fnmatch(
                             path[len(mp_repo.basedir) + 1:],
                             self.mp_config.get(marketplace,
                                                "mp_to_upload"))):
                         self.upload(CONNECT_TEST_URL, path, dryrun=dryrun)
                         self.mp_config.set(marketplace, "uploaded",
                                            CONNECT_TEST_URL + ": " + path)
                         self.repo.save_mp_config(self.mp_config)
Esempio n. 7
0
    def prepare(self, dryrun=False):
        """ Prepare the release."""
        cwd = os.getcwd()
        if not os.path.isdir(self.repo.mp_dir):
            self.clone()
        os.chdir(self.repo.mp_dir)
        marketplaces_skipped = []
        for marketplace in self.get_packages_list():
            log("")
            if self.mp_config.has_option(marketplace, "skip"):
                log("[%s]" % marketplace)
                log("[WARN] Skipped '%s' (%s)" % (marketplace, self.mp_config.get(marketplace, "skip")))
                marketplaces_skipped.append(marketplace)
                upgrade_only = True
            else:
                upgrade_only = False
            if self.mp_config.getboolean(marketplace, "prepared"):
                log("[%s]" % marketplace)
                log("Skipped '%s' (%s)" % (marketplace, "Already prepared"))
                continue
            try:
                mp_dir = os.path.join(self.repo.mp_dir, marketplace)
                if not os.path.isdir(mp_dir):
                    os.chdir(self.repo.mp_dir)
                    self.repo.git_pull(marketplace, self.mp_config.get(marketplace, "branch"))
                else:
                    log("[%s]" % marketplace)
                os.chdir(mp_dir)
                mp_repo = Repository(os.getcwd(), self.alias)
                if upgrade_only:
                    log("Upgrade skipped %s..." % marketplace)
                else:
                    log("Prepare release of %s..." % marketplace)

                release_info = ReleaseInfo(module=marketplace, remote_alias=self.alias,
                                           branch=self.mp_config.get(marketplace, "branch"),
                                           tag=self.mp_config.get(marketplace, "tag"),
                                           next_snapshot=self.mp_config.get(marketplace, "next_snapshot"),
                                           maintenance_version=self.mp_config.get(marketplace, "maintenance_version"),
                                           is_final=self.mp_config.getboolean(marketplace, "is_final"),
                                           skip_tests=self.mp_config.getboolean(marketplace, "skipTests"),
                                           skip_its=self.mp_config.getboolean(marketplace, "skipITs"),
                                           profiles=self.mp_config.get(marketplace, "profiles"),
                                           other_versions=self.mp_config.get(marketplace, "other_versions"),
                                           #files_pattern, props_pattern, msg_commit, msg_tag,
                                           auto_increment_policy=self.mp_config.get(marketplace,
                                                                                    "auto_increment_policy"),
                                           dryrun=dryrun)
                mp_release = Release(mp_repo, release_info)
                release_log = mp_release.log_summary()
                release_info.read_release_log(release_log)
                if dryrun:
                    print "DEBUG -- init %s with:" % marketplace
                for key, value in vars(release_info).iteritems():
                    if dryrun:
                        print "DEBUG: %s-%s=%s" % (marketplace, key, value)
                    self.mp_config.set("DEFAULT", marketplace + "-" + key, str(value))
                if dryrun:
                    print

                mp_release.prepare(dryrun=dryrun, upgrade_only=upgrade_only, dodeploy=True)
                prepared = True
            except Exception, e:
                stack = traceback.format_exc()
                if hasattr(e, 'message') and e.message is not None:
                    stack = e.message + "\n" + stack
                log("[ERROR] %s" % stack)
                prepared = False
                stack = stack.replace("%", "%%")
                self.mp_config.set(marketplace, "skip", "Failed! %s" % stack)
            self.mp_config.set(marketplace, "prepared", str(prepared))
            self.repo.save_mp_config(self.mp_config)
            if prepared and not upgrade_only:
                owner = None
                if self.mp_config.has_option(marketplace, "owner"):
                    owner = self.mp_config.get(marketplace, "owner")
                self.upload(CONNECT_TEST_URL, marketplace, dryrun=dryrun, owner=owner)