def process_configs(repo, attempt): """Helper method that encapsulates all of the things necessary to run release runner for all releases.""" log.info("Bumping %s, attempt #%s" % (repo, attempt)) for release in rr.new_releases: rr.update_status(release, 'Writing configs') l10nContents = rr.get_release_l10n(release['name']) tags.update( getTags(getBaseTag(release['product'], release['version']), release['buildNumber'])) update(configs_workdir, revision='default') cfgFile = getReleaseConfigName(release['product'], path.basename(release['branch']), release['version'], staging) bump_configs(release=release, cfgFile=cfgFile, l10nContents=l10nContents, workdir=configs_workdir, hg_username=hg_username, productionBranch=buildbot_configs_branch) rr.update_status(release, 'Running release sanity') rs_args = get_release_sanity_args(configs_workdir, release, cfgFile, masters_json, buildbot_configs_branch) release_sanity_script = "%s/buildbot-helpers/release_sanity.py" % tools_workdir run_cmd(['python', release_sanity_script] + rs_args + ['--dry-run']) rr.update_status( release, 'Waiting for other releases to run release sanity')
def process_configs(repo, attempt): """Helper method that encapsulates all of the things necessary to run release runner for all releases.""" log.info("Bumping %s, attempt #%s" % (repo, attempt)) for release in rr.new_releases: rr.update_status(release, 'Writing configs') l10nContents = rr.get_release_l10n(release['name']) tags.extend(getTags( getBaseTag(release['product'], release['version']), release['buildNumber']) ) update(configs_workdir, revision='default') cfgFile = getReleaseConfigName( release['product'], path.basename(release['branch']), release['version'], staging) bump_configs(release=release, cfgFile=cfgFile, l10nContents=l10nContents, workdir=configs_workdir, hg_username=hg_username, productionBranch=buildbot_configs_branch) rr.update_status(release, 'Running release sanity') rs_args = get_release_sanity_args(configs_workdir, release, cfgFile, masters_json, buildbot_configs_branch) release_sanity_script = "%s/buildbot-helpers/release_sanity.py" % tools_workdir run_cmd(['python', release_sanity_script] + rs_args + ['--dry-run']) rr.update_status( release, 'Waiting for other releases to run release sanity' )
def bump_configs(release, cfgFile, l10nContents, workdir, hg_username, productionBranch, defaultBranch='default'): # Update the production branch first, because that's where we want to read # the templates from update(workdir, productionBranch) cfgDir = path.join(workdir, 'mozilla') templateFile = path.join(cfgDir, '%s.template' % cfgFile) tags = set(getTags(getBaseTag(release['product'], release['version']), release['buildNumber'])) cfgFile = path.join(cfgDir, cfgFile) l10nChangesetsFile = path.join( cfgDir, readReleaseConfig(cfgFile)['l10nRevisionFile'] ) subs = release.copy() if 'partials' in release: subs['partials'] = getPartials(release) # This is true 99% of the time. It's exceedingly rare that we ship a point # release that we first push to the beta channel. If we need to, the # expectation is that this will be ignored by hardcoding True in the # template. if isFinalRelease(release["version"]): subs["betaChannelEnabled"] = True else: subs["betaChannelEnabled"] = False with open(templateFile) as f: template = f.read() releaseConfig = substituteReleaseConfig(template, **subs) # Write out the new configs on the production branch... with open(cfgFile, 'w') as f: f.write(releaseConfig) with open(l10nChangesetsFile, 'w') as f: f.write(l10nContents) prodRev = commit(workdir, 'Update release config for %s' % release['name'], user=hg_username) # We always force tagging, because it makes it easier to retrigger a # release that fails for infrastructure reasons. tag(workdir, tags, rev=prodRev, force=True, user=hg_username) # And then write the same files to the default branch update(workdir, defaultBranch) with open(cfgFile, 'w') as f: f.write(releaseConfig) with open(l10nChangesetsFile, 'w') as f: f.write(l10nContents) commit(workdir, 'Update release config for %s' % release['name'], user=hg_username)
def bump_configs(release, cfgFile, l10nContents, workdir, hg_username, productionBranch, defaultBranch='default'): # Update the production branch first, because that's where we want to read # the templates from update(workdir, productionBranch) cfgDir = path.join(workdir, 'mozilla') templateFile = path.join(cfgDir, '%s.template' % cfgFile) tags = set( getTags(getBaseTag(release['product'], release['version']), release['buildNumber'])) cfgFile = path.join(cfgDir, cfgFile) l10nChangesetsFile = path.join( cfgDir, readReleaseConfig(cfgFile)['l10nRevisionFile']) subs = release.copy() if 'partials' in release: subs['partials'] = getPartials(release) with open(templateFile) as f: template = f.read() releaseConfig = substituteReleaseConfig(template, **subs) # Write out the new configs on the production branch... with open(cfgFile, 'w') as f: f.write(releaseConfig) with open(l10nChangesetsFile, 'w') as f: f.write(l10nContents) prodRev = commit(workdir, 'Update release config for %s' % release['name'], user=hg_username) # We always force tagging, because it makes it easier to retrigger a # release that fails for infrastructure reasons. tag(workdir, tags, rev=prodRev, force=True, user=hg_username) # And then write the same files to the default branch update(workdir, defaultBranch) with open(cfgFile, 'w') as f: f.write(releaseConfig) with open(l10nChangesetsFile, 'w') as f: f.write(l10nContents) commit(workdir, 'Update release config for %s' % release['name'], user=hg_username)
def bump_configs(server, username, sshKey, repo, repoPath, configsToBump, configsToOverride): reponame = get_repo_name(repo) repo_url = make_hg_url(server, '%s/%s' % (repoPath, reponame)) pushRepo = make_hg_url(server, '%s/%s' % (repoPath, reponame), protocol='ssh') retry(mercurial, args=(repo_url, reponame)) def bump(repo, configsToBump, configsToOverride): """Process dynamic (version, buildNumber, etc.) variables in configsToBump, then append overrides files to both configsToBump and configsToOverride.""" # First pass. Bump variables in configsToBump. configs = ['%s/%s' % (repo, x) for x in configsToBump.keys()] cmd = ['python', BUMP_SCRIPT, '--bump-version', '--revision=tip'] cmd.extend(configs) run_cmd(cmd) # Second pass. Append override files to configsToBump and # configsToOverride. for config, overrides in \ configsToBump.items() + configsToOverride.items(): newContent = cat([path.join(repo, config)] + [path.join(repo, x) for x in overrides]) fh = open(path.join(repo, config), 'wb') fh.write(newContent) fh.close() run_cmd(['hg', 'commit', '-m', 'Automatic config bump'], cwd=repo) def bump_wrapper(r, n): bump(r, configsToBump, configsToOverride) def cleanup_wrapper(): cleanOutgoingRevs(reponame, pushRepo, username, sshKey) retry(apply_and_push, cleanup=cleanup_wrapper, args=(reponame, pushRepo, bump_wrapper), kwargs=dict(ssh_username=username, ssh_key=sshKey)) tags = [] for configfile in configsToBump.keys(): config = readReleaseConfig(path.join(reponame, configfile)) tags.extend( getTags(config['baseTag'], config['buildNumber'], buildTag=True)) return tags
def bump_configs(server, username, sshKey, repo, repoPath, configsToBump, configsToOverride): reponame = get_repo_name(repo) repo_url = make_hg_url(server, '%s/%s' % (repoPath, reponame)) pushRepo = make_hg_url(server, '%s/%s' % (repoPath, reponame), protocol='ssh') retry(mercurial, args=(repo_url, reponame)) def bump(repo, configsToBump, configsToOverride): """Process dynamic (version, buildNumber, etc.) variables in configsToBump, then append overrides files to both configsToBump and configsToOverride.""" # First pass. Bump variables in configsToBump. configs = ['%s/%s' % (repo, x) for x in configsToBump.keys()] cmd = ['python', BUMP_SCRIPT, '--bump-version', '--revision=tip'] cmd.extend(configs) run_cmd(cmd) # Second pass. Append override files to configsToBump and # configsToOverride. for config, overrides in \ configsToBump.items() + configsToOverride.items(): newContent = cat([path.join(repo, config)] + [path.join(repo, x) for x in overrides]) fh = open(path.join(repo, config), 'wb') fh.write(newContent) fh.close() run_cmd(['hg', 'commit', '-m', 'Automatic config bump'], cwd=repo) def bump_wrapper(r, n): bump(r, configsToBump, configsToOverride) def cleanup_wrapper(): cleanOutgoingRevs(reponame, pushRepo, username, sshKey) retry(apply_and_push, cleanup=cleanup_wrapper, args=(reponame, pushRepo, bump_wrapper), kwargs=dict(ssh_username=username, ssh_key=sshKey)) tags = [] for configfile in configsToBump.keys(): config = readReleaseConfig(path.join(reponame, configfile)) tags.extend(getTags(config['baseTag'], config['buildNumber'], buildTag=True)) return tags
def bump_configs(release, cfgFile, l10nContents, workdir, hg_username, productionBranch, defaultBranch='default'): # Update the production branch first, because that's where we want to read # the templates from update(workdir, productionBranch) cfgDir = path.join(workdir, 'mozilla') templateFile = path.join(cfgDir, '%s.template' % cfgFile) tags = getTags(getBaseTag(release['product'], release['version']), release['buildNumber']) cfgFile = path.join(cfgDir, cfgFile) l10nChangesetsFile = path.join( cfgDir, readReleaseConfig(cfgFile)['l10nRevisionFile'] ) subs = release.copy() if 'partials' in release: subs['partials'] = getPartials(release) with open(templateFile) as f: template = f.read() releaseConfig = substituteReleaseConfig(template, **subs) # Write out the new configs on the production branch... with open(cfgFile, 'w') as f: f.write(releaseConfig) with open(l10nChangesetsFile, 'w') as f: f.write(l10nContents) prodRev = commit(workdir, 'Update release config for %s' % release['name'], user=hg_username) # We always force tagging, because it makes it easier to retrigger a # release that fails for infrastructure reasons. tag(workdir, tags, rev=prodRev, force=True, user=hg_username) # And then write the same files to the default branch update(workdir, defaultBranch) with open(cfgFile, 'w') as f: f.write(releaseConfig) with open(l10nChangesetsFile, 'w') as f: f.write(l10nContents) commit(workdir, 'Update release config for %s' % release['name'], user=hg_username)
help="Tag the other repo(s).") options, args = parser.parse_args() mercurial(options.buildbot_configs, 'buildbot-configs') update('buildbot-configs', revision=options.release_tag) config = validate(options, args) configDir = path.dirname(options.configfile) # We generate this upfront to ensure that it's consistent throughout all # repositories that use it. However, in cases where a relbranch is provided # for all repositories, it will not be used generatedRelbranch = generateRelbranchName(config['version']) if config.get('relbranchPrefix'): generatedRelbranch = generateRelbranchName( config['version'], prefix=config['relbranchPrefix']) tags = getTags(config['baseTag'], config['buildNumber']) l10nRevisionFile = path.join('buildbot-configs', configDir, config['l10nRevisionFile']) l10nRepos = getL10nRepositories( open(l10nRevisionFile).read(), config['l10nRepoPath']) if options.tag_source: for repo in config['sourceRepositories'].values(): relbranch = repo['relbranch'] or generatedRelbranch tagRepo(config, repo['path'], repo['name'], repo['revision'], tags, repo['bumpFiles'], relbranch, options.attempts) failed = [] if options.tag_l10n: for l in sorted(l10nRepos): info = l10nRepos[l]
help="Release tag to update buildbot-configs to") options, args = parser.parse_args() retry(mercurial, args=(options.buildbot_configs, 'buildbot-configs')) update('buildbot-configs', revision=options.release_tag) config = validate(options, args) configDir = path.dirname(options.configfile) # We generate this upfront to ensure that it's consistent throughout all # repositories that use it. However, in cases where a relbranch is provided # for all repositories, it will not be used generatedRelbranch = generateRelbranchName(config['milestone']) if config.get('relbranchPrefix'): generatedRelbranch = generateRelbranchName( config['milestone'], prefix=config['relbranchPrefix']) tags = getTags(config['baseTag'], config['buildNumber']) l10nRepos = getL10nRepositories(path.join('buildbot-configs', configDir, config['l10nRevisionFile']), config['l10nRepoPath']) for repo in config['sourceRepositories'].values(): relbranch = repo['relbranch'] or generatedRelbranch tagRepo(config, repo['path'], repo['name'], repo['revision'], tags, repo['bumpFiles'], relbranch, options.attempts) failed = [] for l in sorted(l10nRepos): info = l10nRepos[l] relbranch = config['l10nRelbranch'] or generatedRelbranch try: tagRepo(config, l, path.basename(l), info['revision'], tags, info['bumpFiles'], relbranch, options.attempts)