Example #1
0
    def new(self,
            summary,
            comment,
            product,
            component,
            whiteboard=None,
            priority=None,
            url=None,
            bug_type="task"):
        bug = bugsy.Bug(self.bugzilla,
                        type=bug_type,
                        summary=summary,
                        product=product,
                        component=component)
        # Self-assign bugs by default to get them off triage radars
        bz_username = env.config["bugzilla"]["username"]
        if bz_username:
            bug._bug["assigned_to"] = bz_username
        bug.add_comment(comment)
        if priority is not None:
            if priority not in ("P1", "P2", "P3", "P4", "P5"):
                raise ValueError("Invalid bug priority %s" % priority)
            bug._bug["priority"] = priority
        if whiteboard:
            bug._bug["whiteboard"] = whiteboard
        if url:
            bug._bug["url"] = url

        self.bugzilla.put(bug)
        self.bug_cache[bug.id] = bug
        return bug.id
    def create_bug_range(self, product, component, total):
        first = None
        last = None
        for i in range(0, total):
            bug = bugsy.Bug(self.client, product=product, component=component,
                            summary='Range %d' % (i + 1))
            self.client.put(bug)

            if i == 0:
                first = bug.id
            else:
                last = bug.id

        return total, first, last
Example #3
0
    def updated_bugs(self, bug_ids):
        """Get a list of all bugs which are associated with wpt results and have had their
        resolution changed since the last update time

        :param bug_ids: List of candidate bugs to check
        """
        rv = []

        params = {}
        update_date = None
        if self.last_update:
            update_date = self.last_update.strftime("%Y-%m-%d")
            params["chfieldfrom"] = update_date

        if bug_ids:
            # TODO: this could make the query over-long; we should probably split
            # into multiple queries
            params["bug_id"] = ",".join(str(item) for item in bug_ids)

        search_resp = env.bz.bugzilla.session.get("%s/rest/bug" % bugzilla_url,
                                                  params=params)
        search_resp.raise_for_status()
        search_data = search_resp.json()
        if self.last_update:
            history_params = {"new_since": update_date}
        else:
            history_params = {}
        for bug in search_data.get("bugs", []):
            if (not self.last_update or
                    from_iso_str(bug["last_change_time"]) > self.last_update):

                history_resp = env.bz.bugzilla.session.get(
                    "%s/rest/bug/%s/history" % (bugzilla_url, bug["id"]),
                    params=history_params)
                history_resp.raise_for_status()
                history_data = history_resp.json()
                bugs = history_data.get("bugs")
                if not bugs:
                    continue
                assert len(bugs) == 1
                for entry in bugs[0].get("history", []):
                    if not self.last_update or from_iso_str(
                            entry["when"]) > self.last_update:
                        if any(change["field_name"] == "resolution"
                               for change in entry["changes"]):
                            rv.append(bugsy.Bug(env.bz.bugzilla, **bug))
                            continue
        return rv
Example #4
0
def releaseStandalone(bugzilla, repo, useSystem, version, username):
    print "Creating a bug for standalone"

    print "Please enter the previous release version:"
    previousRelease = raw_input().rstrip("\r\n")

    print "Please enter any requests for the deployers, e.g.:"
    print "We'd like this to be deployed to production this week please, assuming no issues found."
    notes = raw_input("--> ").rstrip("\r\n")

    checkTag(repo, previousRelease)

    tag = checkTag(repo, version)

    bug = bugsy.Bug()
    bug.summary = "Please deploy loop standalone %s to STAGE" % version
    bug.product = DEFAULTS[useSystem]["product"]
    bug.component = "Client"
    bug.platform = "All"
    bug.add_comment("""------------------
RELEASE NOTES
------------------
https://github.com/mozilla/loop/blob/v%s/CHANGELOG.md

COMPARISONS
https://github.com/mozilla/loop/compare/v%s...v%s

TAGS
https://github.com/mozilla/loop/releases/tag/v%s
https://github.com/mozilla/loop/commit/%s

Notes: %s
""" % (version, previousRelease, version, version, tag.commit.hexsha, notes))

    bug._bug[
        "url"] = "https://github.com/mozilla/loop/releases/tag/v%s" % version
    bug._bug["cc"] = ["*****@*****.**"]

    bugzilla.put(bug)

    print "Bug id is: %s" % bug.id
    print "Bug url: https://%s/show_bug.cgi?id=%s" % (
        DEFAULTS[useSystem]["bugzilla"], bug.id)
Example #5
0
import bugsy
bz = bugsy.Bugsy("username", "password",
                 "https://bugzilla-dev.allizom.org/rest")

# Create a new bug with a comment 0 set.
bug = bugsy.Bug()
bug.summary = "I love cheese"
bug.add_comment('I do love sausages too')
bz.put(bug)

# Add another comment to that bug.
bug.add_comment('I do love eggs too')

# Add a comment to an existing bug for whom we don't
# have a bug object (and don't wish to fetch it).
bug = bz.get(123456)
bug.add_comment("I love cheese")
Example #6
0
def releaseMozillaCentral(bugzilla, repoDir, useSystem, mcRepoPath, version,
                          username, ircNick):
    print "Exporting to m-c"

    if not mcRepoPath:
        print >> sys.stderr, "mozilla-central repository not supplied!"
        sys.exit(1)

    if not ircNick:
        print >> sys.stderr, "irc nick not supplied!"
        sys.exit(1)

    pushToTry = getInput("Push result to try (assumes git-cinnibar)?") == "y"

    os.environ["EXPORT_MC_LOCATION"] = mcRepoPath

    mcRepo = Repo(os.path.realpath(mcRepoPath))

    # XXX Drop this, prompt user
    if mcRepo.active_branch.name != "default":
        print "Checking out default"
        mcRepo.heads.default.checkout()

    print "Creating new branch for version %s" % version
    mcRepo.create_head(version)

    mcRepo.heads[version].checkout()

    print "Doing a git export..."

    runProcess(['make', 'clean'], repoDir, "Failed to make clean: %s")

    runProcess(['make', 'export_mc'], repoDir, "Failed to make export_mc: %s")

    # Can't find a way to do this via gitPython APIs, so do it manually.
    mcRepo.git.execute(["git", "add", "browser/extensions/loop"])

    print "Building..."

    runProcess(['./mach', 'build'], mcRepoPath,
               "Failed to build in mc repo: %s")

    runProcess(['./browser/extensions/loop/run-all-loop-tests.sh'], mcRepoPath,
               "Tests failed! %s \nTree left in unclean state.")

    print "Filing bug..."

    baseVersionText = "Land version %s of the Loop system add-on in mozilla-central" % version

    bug = bugsy.Bug()
    bug.summary = baseVersionText
    bug.add_comment(
        "Changelog: https://github.com/mozilla/loop/blob/release/CHANGELOG.md")
    bug.assigned_to = username
    bug.product = DEFAULTS[useSystem]["product"]
    bug.component = "Client"
    bug.platform = "All"
    bug._bug[
        "url"] = "https://github.com/mozilla/loop/releases/tag/v%s" % version
    bug._bug["whiteboard"] = "[btpp-fix-now]"
    bug._bug["priority"] = "P1"
    bug._bug["cf_rank"] = 1

    bugzilla.put(bug)

    print "Bug id is: %s" % bug.id
    print "Bug url: https://%s/show_bug.cgi?id=%s" % (
        DEFAULTS[useSystem]["bugzilla"], bug.id)

    print "Attaching patch to bug"

    index = mcRepo.index

    index.commit("Bug %s - %s, rs=%s for already reviewed code." %
                 (bug.id, baseVersionText, ircNick))

    bugzillaHost = DEFAULTS[useSystem]["bugzilla"]

    runProcess(
        ["git-bz", "attach", "-n", bugzillaHost + ":" + str(bug.id), "HEAD"],
        mcRepoPath, "Failed to attach file: %s")

    if pushToTry:
        print "Pushing to try"
        runProcess([
            "git", "commit", "-m",
            "try: -b do -p linux,linux64,macosx64,win32,win64 -u xpcshell," +
            "marionette,marionette-e10s,mochitest-bc,mochitest-dt," +
            "mochitest-e10s-bc,mochitest-e10s-devtools-chrome -t none",
            "--allow-empty"
        ])

        runProcess(["git", "push", "try"])

    print "Done, please:"
    print "- Check the diffs in the bug"
    print "- Add r+ as the review flag"
    print "- Merge branch %s and push to fx-team" % version
 def create_bug(self, product, component, summary):
     bug = bugsy.Bug(self.client, product=product, component=component,
                     summary=summary)
     self.client.put(bug)