Bug 791924 - Allow mozharness pinning for jobs that use hg shared checkouts. r=rail
--- a/misc.py
+++ b/misc.py
@@ -710,16 +710,17 @@ def makeMHFactory(config, pf, mh_cfg=Non
scriptRepo=scriptRepo,
interpreter=mh_cfg.get('mozharness_python', pf.get('mozharness_python')),
scriptName=mh_cfg['script_name'],
reboot_command=mh_cfg.get('reboot_command', pf.get('reboot_command')),
extra_args=extra_args,
script_timeout=mh_cfg.get('script_timeout', pf.get('timeout', 3600)),
script_maxtime=mh_cfg.get('script_maxtime', pf.get('maxTime', 4 * 3600)),
script_repo_cache=script_repo_cache,
+ script_repo_manifest=config.get('script_repo_manifest'),
tools_repo_cache=mh_cfg.get('tools_repo_cache',
pf.get('tools_repo_cache')),
**kwargs
)
return factory
def makeBundleBuilder(config, name):
@@ -993,16 +994,18 @@ def generateDesktopMozharnessBuilders(na
# look mom, no buildbot properties needed for desktop
# mozharness builds!!
mh_build_properties = {
# our buildbot master.cfg requires us to at least have
# these but mozharness doesn't need them
'branch': name,
'platform': platform,
'product': pf['stage_product'],
+ 'repo_path': config['repo_path'],
+ 'script_repo_revision': config["mozharness_tag"],
}
dep_signing_servers = secrets.get(pf.get('dep_signing_servers'))
nightly_signing_servers = secrets.get(pf.get('nightly_signing_servers'))
# grab the l10n schedulers that nightlies will trigger (if any)
triggered_nightly_schedulers = []
if (config['enable_l10n'] and platform in config['l10n_platforms'] and
'%s nightly' % pf['base_name'] in l10nNightlyBuilders):
--- a/process/factory.py
+++ b/process/factory.py
@@ -5345,59 +5345,88 @@ class ScriptFactory(RequestSortingBuildF
workdir="."
))
self.env['EXTRA_DATA'] = WithProperties('%(basedir)s/data.json')
self.addStep(ShellCommand(
name="clobber_properties",
command=['rm', '-rf', 'properties'],
workdir=".",
))
- self.addStep(SetProperty(
- name='set_script_repo_url',
- command=['echo', scriptRepo],
- property='script_repo_url',
+ self.addStep(SetBuildProperty(
+ property_name='script_repo_url',
+ value=scriptRepo,
))
script_repo_url = WithProperties('%(script_repo_url)s')
if self.script_repo_cache:
# all slaves bar win tests have a copy of hgtool on their path.
# However, let's use runner's checkout version like we do for
# script repo
assert self.tools_repo_cache
# ScriptFactory adds the props file into its env but we don't
# want to pass that to the hgtool call because hgtool will assume
# things like ['sourcestamp']['branch'] should be our branch
# that script_repo pulls from
+ hgtool_path = \
+ os.path.join(self.tools_repo_cache,
+ 'buildfarm',
+ 'utils',
+ 'hgtool.py')
+ repository_manifest_path = \
+ os.path.join(self.tools_repo_cache,
+ 'buildfarm',
+ 'utils',
+ 'repository_manifest.py')
+
+ if script_repo_manifest:
+ self.addStep(SetProperty(
+ name="set_script_repo_url_and_script_repo_revision",
+ extract_fn=extractProperties,
+ command=['bash', '-c',
+ WithProperties(
+ 'python %s ' % repository_manifest_path +
+ '--default-repo %s ' % scriptRepo +
+ '--default-revision %(script_repo_revision:-default)s ' +
+ '--default-checkout %s ' % self.script_repo_cache +
+ '--checkout %(basedir)s/build/scripts ' +
+ '--manifest-url %s' % script_repo_manifest)],
+ log_eval_func=rc_eval_func({0: SUCCESS, None: EXCEPTION}),
+ haltOnFailure=True,
+ ))
+ else:
+ self.addStep(SetBuildProperty(
+ property_name='script_repo_checkout',
+ value=self.script_repo_cache,
+ ))
+
hg_script_repo_env = self.env.copy()
hg_script_repo_env.pop('PROPERTIES_FILE', None)
- hgtool_path = os.path.join(self.tools_repo_cache,
- 'buildfarm',
- 'utils',
- 'hgtool.py')
+
hgtool_cmd = [
'python', hgtool_path, '--purge',
'-r', WithProperties('%(script_repo_revision:-default)s'),
- scriptRepo, self.script_repo_cache
+ WithProperties('%(script_repo_url)s'),
+ WithProperties('%(script_repo_checkout)s'),
]
+
self.addStep(ShellCommand(
name='update_script_repo_cache',
command=hgtool_cmd,
env=hg_script_repo_env,
haltOnFailure=True,
- workdir=os.path.dirname(self.script_repo_cache),
flunkOnFailure=True,
))
self.addStep(SetProperty(
name='get_script_repo_revision',
property='script_repo_revision',
command=[hg_bin, 'id', '-i'],
- workdir=self.script_repo_cache,
+ workdir=WithProperties('%(script_repo_checkout)s'),
haltOnFailure=False,
))
- script_path = '%s/%s' % (script_repo_cache, scriptName)
+ script_path = WithProperties('%(script_repo_checkout)s/' + scriptName)
else:
# fall back to legacy clobbering + cloning script repo
if script_repo_manifest:
# By setting scriptRepoManifest we indicate that we don't
# want to use scriptRepo but we want to let the manifest associated
# to set the repo to checkout and which revision/branch to update to
# If the repo specified in the manifest matches scriptRepo we will
# use the cached version if available (i.e. script_repo_cache has