Skip to content

Commit

Permalink
Bug 1210539 - Add "updates" builder to release promotion task r=jlund…
Browse files Browse the repository at this point in the history
… DONTBUILD a=release

--HG--
rename : testing/mozharness/mozharness/mozilla/merge.py => testing/mozharness/mozharness/mozilla/repo_manupulation.py
extra : rebase_source : c8a8a2891fcdc50111e497acd33262c295da1ba2
  • Loading branch information
Rail Aliiev committed Feb 19, 2016
1 parent 0d93731 commit 942056d
Show file tree
Hide file tree
Showing 9 changed files with 507 additions and 39 deletions.
34 changes: 34 additions & 0 deletions testing/mozharness/configs/releases/updates_beta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

config = {
"log_name": "updates_date",
"repo": {
"repo": "https://hg.mozilla.org/build/tools",
"revision": "default",
"dest": "tools",
"vcs": "hg",
},
"push_dest": "ssh://hg.mozilla.org/build/tools",
"shipped-locales-url": "https://hg.mozilla.org/releases/mozilla-beta/raw-file/{revision}/browser/locales/shipped-locales",
"ignore_no_changes": True,
"ssh_user": "ffxbld",
"ssh_key": "~/.ssh/ffxbld_rsa",
"archive_domain": "archive.mozilla.org",
"archive_prefix": "https://archive.mozilla.org",
"previous_archive_prefix": "https://archive.mozilla.org",
"download_domain": "download.mozilla.org",
"balrog_url": "https://aus5.mozilla.org",
"balrog_username": "ffxbld",
"update_channels": {
"beta": {
"version_regex": r"^(\d+\.\d+(b\d+)?)$",
"requires_mirrors": False,
"patcher_config": "moBeta-branch-patcher2.cfg",
"update_verify_channel": "beta-localtest",
"mar_channel_ids": [
"firefox-mozilla-beta", "firefox-mozilla-beta",
],
"channel_names": ["beta", "beta-localtest", "beta-cdntest"],
"rules_to_update": ["firefox-beta-cdntest", "firefox-beta-localtest"],
},
},
}
34 changes: 34 additions & 0 deletions testing/mozharness/configs/releases/updates_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

config = {
"log_name": "bump_date",
# TODO: use real repo
"repo": {
"repo": "https://hg.mozilla.org/users/raliiev_mozilla.com/tools",
"revision": "default",
"dest": "tools",
"vcs": "hg",
},
# TODO: use real repo
"push_dest": "ssh://hg.mozilla.org/users/raliiev_mozilla.com/tools",
"shipped-locales-url": "https://hg.mozilla.org/projects/date/raw-file/{revision}/browser/locales/shipped-locales",
"ignore_no_changes": True,
"ssh_user": "ffxbld",
"ssh_key": "~/.ssh/ffxbld_rsa",
"archive_domain": "mozilla-releng-beet-mover-dev.s3-website-us-west-2.amazonaws.com",
"archive_prefix": "http://mozilla-releng-beet-mover-dev.s3-website-us-west-2.amazonaws.com",
"previous_archive_prefix": "https://archive.mozilla.org",
"download_domain": "download.mozilla.org",
"balrog_url": "http://ec2-54-241-39-23.us-west-1.compute.amazonaws.com",
"balrog_username": "stage-ffxbld",
"update_channels": {
"date": {
"version_regex": r"^(\d+\.\d+(b\d+)?)$",
"requires_mirrors": False,
"patcher_config": "mozDate-branch-patcher2.cfg",
"update_verify_channel": "date-localtest",
"mar_channel_ids": [],
"channel_names": ["date", "date-localtest", "date-cdntest"],
"rules_to_update": ["firefox-date-cdntest", "firefox-date-localtest"],
}
},
}
43 changes: 43 additions & 0 deletions testing/mozharness/configs/releases/updates_release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

config = {
"log_name": "updates_date",
"repo": {
"repo": "https://hg.mozilla.org/build/tools",
"revision": "default",
"dest": "tools",
"vcs": "hg",
},
"push_dest": "ssh://hg.mozilla.org/build/tools",
"shipped-locales-url": "https://hg.mozilla.org/releases/mozilla-release/raw-file/{revision}/browser/locales/shipped-locales",
"ignore_no_changes": True,
"ssh_user": "ffxbld",
"ssh_key": "~/.ssh/ffxbld_rsa",
"archive_domain": "archive.mozilla.org",
"archive_prefix": "https://archive.mozilla.org",
"previous_archive_prefix": "https://archive.mozilla.org",
"download_domain": "download.mozilla.org",
"balrog_url": "https://aus5.mozilla.org",
"balrog_username": "ffxbld",
"update_channels": {
"beta": {
"version_regex": r"^(\d+\.\d+(b\d+)?)$",
"requires_mirrors": False,
"patcher_config": "moBeta-branch-patcher2.cfg",
"update_verify_channel": "beta-localtest",
"mar_channel_ids": [
"firefox-mozilla-beta", "firefox-mozilla-beta",
],
"channel_names": ["beta", "beta-localtest", "beta-cdntest"],
"rules_to_update": ["firefox-beta-cdntest", "firefox-beta-localtest"],
},
"release": {
"version_regex": r"^\d+\.\d+(\.\d+)?$",
"requires_mirrors": True,
"patcher_config": "mozRelease-branch-patcher2.cfg",
"update_verify_channel": "release-localtest",
"mar_channel_ids": [],
"channel_names": ["release", "release-localtest", "release-cdntest"],
"rules_to_update": ["firefox-release-cdntest", "firefox-release-localtest"],
},
},
}
22 changes: 22 additions & 0 deletions testing/mozharness/mozharness/mozilla/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

import os
from distutils.version import LooseVersion, StrictVersion

from mozharness.base.config import parse_config_file

Expand Down Expand Up @@ -48,3 +49,24 @@ def query_release_config(self):
self.release_config[key] = c[key]
self.info("Release config:\n%s" % self.release_config)
return self.release_config


def get_previous_version(version, partial_versions):
""" The patcher config bumper needs to know the exact previous version
We use LooseVersion for ESR because StrictVersion can't parse the trailing
'esr', but StrictVersion otherwise because it can sort X.0bN lower than X.0.
The current version is excluded to avoid an error if build1 is aborted
before running the updates builder and now we're doing build2
"""
if version.endswith('esr'):
return str(max(LooseVersion(v) for v in partial_versions if
v != version))
else:
# StrictVersion truncates trailing zero in versions with more than 1
# dot. Compose a structure that will be sorted by StrictVersion and
# return untouched version
composed = sorted([(v, StrictVersion(v)) for v in partial_versions if
v != version], key=lambda x: x[1], reverse=True)
return composed[0][0]


Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from mozharness.base.vcs.mercurial import MercurialVCS


class GeckoMigrationMixin(object):
class MercurialRepoManipulationMixin(object):

def get_version(self, repo_root,
version_file="browser/config/version.txt"):
Expand Down Expand Up @@ -60,7 +60,7 @@ def clean_repos(self):
"""
dirs = self.query_abs_dirs()
hg = self.query_exe("hg", return_type="list")
hg_repos = self.query_gecko_repos()
hg_repos = self.query_repos()
hg_strip_error_list = [{
'substr': r'''abort: empty revision set''', 'level': INFO,
'explanation': "Nothing to clean up; we're good!",
Expand Down Expand Up @@ -112,6 +112,31 @@ def commit_changes(self):
)
self.info("Now verify |hg out| and |hg out --patch| if you're paranoid, and --push")

def hg_tag(self, cwd, tags, user=None, message=None, revision=None,
force=None, halt_on_failure=True):
if isinstance(tags, basestring):
tags = [tags]
cmd = self.query_exe('hg', return_type='list') + ['tag']
if not message:
message = "No bug - Tagging %s" % os.path.basename(cwd)
if revision:
message = "%s %s" % (message, revision)
message = "%s with %s" % (message, ', '.join(tags))
message += " a=release DONTBUILD CLOSED TREE"
self.info(message)
cmd.extend(['-m', message])
if user:
cmd.extend(['-u', user])
if revision:
cmd.extend(['-r', revision])
if force:
cmd.append('-f')
cmd.extend(tags)
return self.run_command(
cmd, cwd=cwd, halt_on_failure=halt_on_failure,
error_list=HgErrorList
)

def push(self):
"""
"""
Expand Down
38 changes: 5 additions & 33 deletions testing/mozharness/scripts/merge_day/gecko_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from mozharness.mozilla.selfserve import SelfServeMixin
from mozharness.mozilla.updates.balrog import BalrogMixin
from mozharness.mozilla.buildbot import BuildbotMixin
from mozharness.mozilla.merge import GeckoMigrationMixin
from mozharness.mozilla.repo_manupulation import MercurialRepoManipulationMixin

VALID_MIGRATION_BEHAVIORS = (
"beta_to_release", "aurora_to_beta", "central_to_aurora", "release_to_esr",
Expand All @@ -40,7 +40,8 @@

# GeckoMigration {{{1
class GeckoMigration(MercurialScript, BalrogMixin, VirtualenvMixin,
SelfServeMixin, BuildbotMixin, GeckoMigrationMixin):
SelfServeMixin, BuildbotMixin,
MercurialRepoManipulationMixin):
config_options = [
[['--hg-user', ], {
"action": "store",
Expand Down Expand Up @@ -138,7 +139,7 @@ def query_abs_dirs(self):
)
return self.abs_dirs

def query_gecko_repos(self):
def query_repos(self):
""" Build a list of repos to clone.
"""
if self.gecko_repos:
Expand Down Expand Up @@ -194,31 +195,6 @@ def query_to_revision(self):
dirs = self.query_abs_dirs()
return self.query_hg_revision(dirs['abs_to_dir'])

def hg_tag(self, cwd, tags, user=None, message=None, revision=None,
force=None, halt_on_failure=True):
if isinstance(tags, basestring):
tags = [tags]
message = "No bug - Tagging %s" % os.path.basename(cwd)
if revision:
message = "%s %s" % (message, revision)
message = "%s with %s" % (message, ', '.join(tags))
message += " a=release DONTBUILD CLOSED TREE"
self.info(message)
cmd = self.query_exe('hg', return_type='list') + ['tag']
if user:
cmd.extend(['-u', user])
if message:
cmd.extend(['-m', message])
if revision:
cmd.extend(['-r', revision])
if force:
cmd.append('-f')
cmd.extend(tags)
return self.run_command(
cmd, cwd=cwd, halt_on_failure=halt_on_failure,
error_list=HgErrorList
)

def hg_merge_via_debugsetparents(self, cwd, old_head, new_head,
preserve_tags=True, user=None):
""" Merge 2 heads avoiding non-fastforward commits
Expand Down Expand Up @@ -483,7 +459,7 @@ def pull(self):
"revision": self.config["tools_repo_revision"],
"dest": "tools",
"vcs": "hg",
}] + self.query_gecko_repos()
}] + self.query_repos()
super(GeckoMigration, self).pull(repos=repos)

def lock_update_paths(self):
Expand All @@ -501,8 +477,6 @@ def migrate(self):
end_tag = self.config['end_tag'] % {'major_version': to_fx_major_version}
self.hg_tag(
dirs['abs_from_dir'], base_tag, user=self.config['hg_user'],
message="Added %s tag for changeset %s. IGNORE BROKEN CHANGESETS DONTBUILD CLOSED TREE NO BUG a=release" %
(base_tag, base_from_rev),
revision=base_from_rev,
)
new_from_rev = self.query_from_revision()
Expand All @@ -522,8 +496,6 @@ def migrate(self):
)
self.hg_tag(
dirs['abs_to_dir'], end_tag, user=self.config['hg_user'],
message="Added %s tag for changeset %s. IGNORE BROKEN CHANGESETS DONTBUILD CLOSED TREE NO BUG a=release" %
(end_tag, base_to_rev),
revision=base_to_rev, force=True,
)
# Call beta_to_release etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
sys.path.insert(1, os.path.dirname(os.path.dirname(sys.path[0])))
from mozharness.base.vcs.vcsbase import MercurialScript
from mozharness.mozilla.buildbot import BuildbotMixin
from mozharness.mozilla.merge import GeckoMigrationMixin
from mozharness.mozilla.repo_manupulation import MercurialRepoManipulationMixin


# PostReleaseVersionBump {{{1
class PostReleaseVersionBump(MercurialScript, BuildbotMixin,
GeckoMigrationMixin):
MercurialRepoManipulationMixin):
config_options = [
[['--hg-user', ], {
"action": "store",
Expand Down Expand Up @@ -102,7 +102,7 @@ def query_abs_dirs(self):
self.abs_dirs['abs_work_dir'], self.config["repo"]["dest"])
return self.abs_dirs

def query_gecko_repos(self):
def query_repos(self):
"""Build a list of repos to clone."""
return [self.config["repo"]]

Expand All @@ -125,7 +125,7 @@ def query_push_args(self, cwd):

def pull(self):
super(PostReleaseVersionBump, self).pull(
repos=self.query_gecko_repos())
repos=self.query_repos())

def bump_postrelease(self, *args, **kwargs):
"""Bump version"""
Expand Down
Loading

0 comments on commit 942056d

Please sign in to comment.