Exemplo n.º 1
0
def validate(options, args):
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    releaseConfigFile = path.join("buildbot-configs", options.releaseConfig)
    branchConfigFile = path.join("buildbot-configs", options.configfile)
    branchConfigDir = path.dirname(branchConfigFile)

    if not path.exists(branchConfigFile):
        log.info("%s does not exist!" % branchConfigFile)
        sys.exit(1)

    if options.chunks or options.thisChunk:
        assert options.chunks and options.thisChunk, \
          "chunks and this-chunk are required when one is passed"
        assert not options.locales, \
          "locale option cannot be used when chunking"
    else:
        if len(options.locales) < 1:
            raise Exception('Need at least one locale to repack')

    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=REQUIRED_RELEASE_CONFIG)
    sourceRepoName = releaseConfig['sourceRepositories'][options.source_repo_key]['name']
    branchConfig = readBranchConfig(branchConfigDir, branchConfigFile,
                                    sourceRepoName,
                                    required=REQUIRED_BRANCH_CONFIG)
    return branchConfig, releaseConfig
Exemplo n.º 2
0
def validate(options, args):
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    releaseConfigFile = path.join("buildbot-configs", options.releaseConfig)
    branchConfigFile = path.join("buildbot-configs", options.configfile)
    branchConfigDir = path.dirname(branchConfigFile)

    if not path.exists(branchConfigFile):
        log.info("%s does not exist!" % branchConfigFile)
        sys.exit(1)

    if options.chunks or options.thisChunk:
        assert options.chunks and options.thisChunk, \
          "chunks and this-chunk are required when one is passed"
        assert not options.locales, \
          "locale option cannot be used when chunking"
    else:
        if len(options.locales) < 1:
            raise Exception('Need at least one locale to repack')

    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=REQUIRED_RELEASE_CONFIG)
    sourceRepoName = releaseConfig['sourceRepositories'][options.source_repo_key]['name']
    branchConfig = readBranchConfig(branchConfigDir, branchConfigFile,
                                    sourceRepoName,
                                    required=REQUIRED_BRANCH_CONFIG)
    return branchConfig, releaseConfig
def bumpReleaseconfig(releaseConfigFile, options):
    processVars = ['buildNumber', ]
    build1BumpVars = ['version', 'baseTag', 'nextAppVersion', 'nextMilestone']
    build1ProcessVars = ['oldVersion', 'oldBuildNumber', 'oldBaseTag']

    oldReleaseConfig = readReleaseConfig(releaseConfigFile)
    newReleaseConfig = copy.copy(oldReleaseConfig)
    dictVars = {}

    if options.bumpVersion:
        newReleaseConfig['buildNumber'] = 1
        for param in build1BumpVars:
            newReleaseConfig[param] = increment(oldReleaseConfig[param])
        if not options.preserve_relbranch:
            dictVars['relbranch'] = None
        newReleaseConfig['oldVersion'] = oldReleaseConfig['version']
        newReleaseConfig['oldBuildNumber'] = oldReleaseConfig['buildNumber']
        newReleaseConfig['oldBaseTag'] = oldReleaseConfig['baseTag']
        processVars.extend(build1ProcessVars + build1BumpVars)
    else:
        newReleaseConfig['buildNumber'] = oldReleaseConfig['buildNumber'] + 1
        if newReleaseConfig['buildNumber'] == 2:
            if not options.relbranch:
                print "Error: relbranch is required for build2!"
                sys.exit(2)
            else:
                dictVars['relbranch'] = options.relbranch

    if not options.revision:
        print "Error: revision is required!"
        sys.exit(3)
    else:
        dictVars['revision'] = options.revision

    processFile(releaseConfigFile, processVars, dictVars, newReleaseConfig)
Exemplo n.º 4
0
def validate(options, args):
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    releaseConfigFile = "/".join(["buildbot-configs", options.releaseConfig])

    if options.chunks or options.thisChunk:
        assert options.chunks and options.thisChunk, \
            "chunks and this-chunk are required when one is passed"
        assert not options.locales, \
            "locale option cannot be used when chunking"
    else:
        if len(options.locales) < 1:
            raise Exception('Need at least one locale to repack')

    if options.balrog_api_root:
        if not options.credentials_file or not options.balrog_username:
            raise Exception("--credentials-file and --balrog-username must be set when --balrog-api-root is set.")

    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=REQUIRED_RELEASE_CONFIG)
    branchConfig = {
        'stage_ssh_key': options.stage_ssh_key,
        'hghost': options.hghost,
        'stage_server': options.stage_server,
        'stage_username': options.stage_username,
        'ftp_server': options.ftp_server,
        'compare_locales_repo_path': options.compare_locales_repo_path,
        'bucket_prefix': options.bucket_prefix,
    }
    return branchConfig, releaseConfig
Exemplo n.º 5
0
def validate(options, args):
    err = False
    config = {}
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    elif not path.exists(path.join('buildbot-configs', options.configfile)):
        log.info("%s does not exist!" % options.configfile)
        sys.exit(1)

    config = readReleaseConfig(path.join('buildbot-configs', options.configfile))
    for key in REQUIRED_CONFIG:
        if key not in config:
            err = True
            log.info("Required item missing in config: %s" % key)

    for r in config['sourceRepositories'].values():
        for key in REQUIRED_SOURCE_REPO_KEYS:
            if key not in r:
                err = True
                log.info("Missing required key '%s' for '%s'" % (key, r))
            
    if 'otherReposToTag' in config:
        if not callable(getattr(config['otherReposToTag'], 'iteritems')):
            err = True
            log.info("otherReposToTag exists in config but is not a dict")
    if err:
        sys.exit(1)
    return config
Exemplo n.º 6
0
def sendMailRD(smtpServer, From, cfgFile, r):
    # Send an email to the mailing after the build
    contentMail = ""
    release_config = readReleaseConfig(cfgFile)
    sources = release_config['sourceRepositories']
    To = release_config['ImportantRecipients']
    comment = r.get("comment")

    if comment:
        contentMail += "Comment:\n" + comment + "\n\n"

    contentMail += "A new build has been submitted through ship-it:\n"

    for name, source in sources.items():

        # We cannot use the source["revision"] value because it has not been
        # updated yet. It is done later in the process.
        # Select the one defined
        if name == "comm":
            # Thunderbird
            revision = r["commRevision"]
        else:
            revision = r["mozillaRevision"]

        # For now, firefox has only one source repo but Thunderbird has two
        contentMail += name + " commit: https://hg.mozilla.org/" + source['path'] + "/rev/" + revision + "\n"

    contentMail += "\nCreated by " + r["submitter"] + "\n"

    contentMail += "\nStarted by " + r["starter"] + "\n"

    Subject = 'Build of %s' % r["name"]

    sendmail(from_=From, to=To, subject=Subject, body=contentMail,
             smtp_server=smtpServer)
Exemplo n.º 7
0
def validate(options, args):
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    releaseConfigFile = "/".join(["buildbot-configs", options.releaseConfig])

    if options.chunks or options.thisChunk:
        assert options.chunks and options.thisChunk, \
            "chunks and this-chunk are required when one is passed"
        assert not options.locales, \
            "locale option cannot be used when chunking"
    else:
        if len(options.locales) < 1:
            raise Exception('Need at least one locale to repack')

    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=REQUIRED_RELEASE_CONFIG)
    branchConfig = {
        'stage_ssh_key': options.stage_ssh_key,
        'hghost': options.hghost,
        'stage_server': options.stage_server,
        'stage_username': options.stage_username,
        'compare_locales_repo_path': options.compare_locales_repo_path,
    }
    return branchConfig, releaseConfig
def validate(options, args):
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    releaseConfigFile = "/".join(["buildbot-configs", options.releaseConfig])

    if options.chunks or options.thisChunk:
        assert options.chunks and options.thisChunk, \
            "chunks and this-chunk are required when one is passed"
        assert not options.locales, \
            "locale option cannot be used when chunking"
    else:
        if len(options.locales) < 1:
            raise Exception('Need at least one locale to repack')

    if options.balrog_api_root:
        if not options.credentials_file or not options.balrog_username:
            raise Exception(
                "--credentials-file and --balrog-username must be set when --balrog-api-root is set."
            )

    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=REQUIRED_RELEASE_CONFIG)
    branchConfig = {
        'stage_ssh_key': options.stage_ssh_key,
        'hghost': options.hghost,
        'stage_server': options.stage_server,
        'stage_username': options.stage_username,
        'ftp_server': options.ftp_server,
        'compare_locales_repo_path': options.compare_locales_repo_path,
        'bucket_prefix': options.bucket_prefix,
    }
    return branchConfig, releaseConfig
Exemplo n.º 9
0
def validate(options, args):
    assert options.chunks and options.thisChunk, \
        "chunks and this-chunk are required"

    releaseConfigFile = path.join("buildbot-configs", options.releaseConfig)
    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=(options.configDict,))
    uvConfig = path.join(UPDATE_VERIFY_DIR,
                         releaseConfig[options.configDict][options.release_channel]["verifyConfigs"][options.platform])
    assert path.isfile(uvConfig), "Update verify config must exist!"
    return releaseConfig
Exemplo n.º 10
0
def extract_config_info(release_config_url):
    """ Grab the contents of release configs to construct a URL to
    shipped_locales """
    log.info("Grabbing release configs from %s", release_config_url)
    try:
        subprocess.check_call(
            ['wget', '-O', './release_config.py', release_config_url])
    except subprocess.CalledProcessError:
        log.fatal("error grabbing release configs")
        raise
    log.info("Attempting to import release_config.py...")
    return readReleaseConfig('release_config.py')
Exemplo n.º 11
0
def validate(options, args):
    assert options.chunks and options.thisChunk, \
        "chunks and this-chunk are required"

    releaseConfigFile = path.join("buildbot-configs", options.releaseConfig)
    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=(options.configDict, ))
    uvConfig = path.join(
        UPDATE_VERIFY_DIR, releaseConfig[options.configDict][
            options.release_channel]["verifyConfigs"][options.platform])
    assert path.isfile(uvConfig), "Update verify config must exist!"
    return releaseConfig
Exemplo n.º 12
0
def extract_config_info(release_config_url):
    """ Grab the contents of release configs to construct a URL to
    shipped_locales """
    log.info("Grabbing release configs from %s", release_config_url)
    try:
        subprocess.check_call(['wget',
            '-O', './release_config.py',
            release_config_url])
    except subprocess.CalledProcessError:
        log.fatal("error grabbing release configs")
        raise
    log.info("Attempting to import release_config.py...")
    return readReleaseConfig('release_config.py')
Exemplo n.º 13
0
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)
Exemplo n.º 14
0
def validate(options, args):
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    releaseConfigFile = path.join("buildbot-configs", options.releaseConfig)
    branchConfigFile = path.join("buildbot-configs", options.configfile)
    branchConfigDir = path.dirname(branchConfigFile)

    if not path.exists(branchConfigFile):
        log.info("%s does not exist!" % branchConfigFile)
        sys.exit(1)

    releaseConfig = readReleaseConfig(releaseConfigFile, required=REQUIRED_RELEASE_CONFIG)
    sourceRepoName = releaseConfig["sourceRepositories"][options.sourceRepoKey]["name"]
    branchConfig = readBranchConfig(branchConfigDir, branchConfigFile, sourceRepoName, required=REQUIRED_BRANCH_CONFIG)
    return branchConfig, releaseConfig
Exemplo n.º 15
0
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)
Exemplo n.º 16
0
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
Exemplo n.º 17
0
def validate(options):
    err = False
    config = {}

    if not path.exists(path.join("buildbot-configs", options.release_config)):
        print "%s does not exist!" % options.release_config
        sys.exit(1)

    config = readReleaseConfig(path.join("buildbot-configs", options.release_config))
    for key in REQUIRED_CONFIG:
        if key not in config:
            err = True
            print "Required item missing in config: %s" % key

    if err:
        sys.exit(1)
    return config
Exemplo n.º 18
0
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 validate(options):
    err = False
    config = {}

    if not path.exists(path.join('buildbot-configs', options.release_config)):
        print "%s does not exist!" % options.release_config
        sys.exit(1)

    config = readReleaseConfig(
        path.join('buildbot-configs', options.release_config))
    for key in REQUIRED_CONFIG:
        if key not in config:
            err = True
            print "Required item missing in config: %s" % key

    if err:
        sys.exit(1)
    return config
def validate(options):
    err = False
    config = {}

    if not path.exists(path.join('buildbot-configs', options.release_config)):
        log.error("%s does not exist!" % options.release_config)
        exit(1)

    config = readReleaseConfig(path.join('buildbot-configs',
                                         options.release_config))
    for key in REQUIRED_CONFIG:
        if key not in config:
            err = True
            log.error("Required item missing in config: %s" % key)

    if err:
        exit(1)

    return config
Exemplo n.º 21
0
def sendMailRD(smtpServer, From, cfgFile, r):
    # Send an email to the mailing after the build
    contentMail = ""
    release_config = readReleaseConfig(cfgFile)
    sources = release_config['sourceRepositories']
    To = release_config['ImportantRecipients']
    comment = r.get("comment")

    if comment:
        contentMail += "Comment:\n" + comment + "\n\n"

    contentMail += "A new build has been submitted through ship-it:\n"

    for name, source in sources.items():

        if name == "comm":
            # Thunderbird
            revision = source["revision"]
            path = source["path"]
        else:
            revision = source["revision"]
            path = source["path"]

        # For now, firefox has only one source repo but Thunderbird has two
        contentMail += name + " commit: https://hg.mozilla.org/" + path + "/rev/" + revision + "\n"

    contentMail += "\nCreated by " + r["submitter"] + "\n"

    contentMail += "\nStarted by " + r["starter"] + "\n"

    subjectPrefix = ""

    # On r-d, we prefix the subject of the email in order to simplify filtering
    # We don't do it for thunderbird
    if "Fennec" in r["name"]:
        subjectPrefix = "[mobile] "
    if "Firefox" in r["name"]:
        subjectPrefix = "[desktop] "

    Subject = subjectPrefix + 'Build of %s' % r["name"]

    sendmail(from_=From, to=To, subject=Subject, body=contentMail,
             smtp_server=smtpServer)
Exemplo n.º 22
0
def validate(options, args):
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    releaseConfigFile = path.join("buildbot-configs", options.releaseConfig)
    branchConfigFile = path.join("buildbot-configs", options.configfile)
    branchConfigDir = path.dirname(branchConfigFile)

    if not path.exists(branchConfigFile):
        log.info("%s does not exist!" % branchConfigFile)
        sys.exit(1)

    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=REQUIRED_RELEASE_CONFIG)
    sourceRepoName = releaseConfig['sourceRepositories'][
        options.sourceRepoKey]['name']
    branchConfig = readBranchConfig(branchConfigDir,
                                    branchConfigFile,
                                    sourceRepoName,
                                    required=REQUIRED_BRANCH_CONFIG)
    return branchConfig, releaseConfig
Exemplo n.º 23
0
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)
Exemplo n.º 24
0
def validate(options, args):
    err = False
    config = {}
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    elif not path.exists(path.join('buildbot-configs', options.configfile)):
        log.info("%s does not exist!" % options.configfile)
        sys.exit(1)

    config = readReleaseConfig(
        path.join('buildbot-configs', options.configfile))
    for key in REQUIRED_CONFIG:
        if key not in config:
            err = True
            log.info("Required item missing in config: %s" % key)

    for r in config['sourceRepositories'].values():
        for key in REQUIRED_SOURCE_REPO_KEYS:
            if key not in r:
                err = True
                log.info("Missing required key '%s' for '%s'" % (key, r))

    if 'otherReposToTag' in config:
        if not callable(getattr(config['otherReposToTag'], 'iteritems')):
            err = True
            log.info("otherReposToTag exists in config but is not a dict")
    if err:
        sys.exit(1)

    # Non-fatal warnings only after this point
    if not (options.tag_source or options.tag_l10n or options.tag_other):
        log.info("No tag directive specified, defaulting to all")
        options.tag_source = True
        options.tag_l10n = True
        options.tag_other = True

    return config
Exemplo n.º 25
0
def validate(options, args):
    err = False
    config = {}
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    elif not path.exists(path.join('buildbot-configs', options.configfile)):
        log.info("%s does not exist!" % options.configfile)
        sys.exit(1)

    config = readReleaseConfig(
        path.join('buildbot-configs', options.configfile))
    for key in REQUIRED_CONFIG:
        if key not in config:
            err = True
            log.info("Required item missing in config: %s" % key)

    for r in config['sourceRepositories'].values():
        for key in REQUIRED_SOURCE_REPO_KEYS:
            if key not in r:
                err = True
                log.info("Missing required key '%s' for '%s'" % (key, r))

    if 'otherReposToTag' in config:
        if not callable(getattr(config['otherReposToTag'], 'iteritems')):
            err = True
            log.info("otherReposToTag exists in config but is not a dict")
    if err:
        sys.exit(1)

    # Non-fatal warnings only after this point
    if not (options.tag_source or options.tag_l10n or options.tag_other):
        log.info("No tag directive specified, defaulting to all")
        options.tag_source = True
        options.tag_l10n = True
        options.tag_other = True

    return config
def validate(options, args):
    if not options.configfile:
        log.info("Must pass --configfile")
        sys.exit(1)
    releaseConfigFile = path.join("buildbot-configs", options.releaseConfig)

    if options.chunks or options.thisChunk:
        assert options.chunks and options.thisChunk, "chunks and this-chunk are required when one is passed"
        assert not options.locales, "locale option cannot be used when chunking"
    else:
        if len(options.locales) < 1:
            raise Exception("Need at least one locale to repack")

    releaseConfig = readReleaseConfig(releaseConfigFile, required=REQUIRED_RELEASE_CONFIG)
    sourceRepoName = releaseConfig["sourceRepositories"][options.source_repo_key]["name"]
    branchConfig = {
        "stage_ssh_key": options.stage_ssh_key,
        "hghost": options.hghost,
        "stage_server": options.stage_server,
        "stage_username": options.stage_username,
        "compare_locales_repo_path": options.compare_locales_repo_path,
    }
    return branchConfig, releaseConfig
Exemplo n.º 27
0
def sendMailRD(smtpServer, From, cfgFile, r):
    # Send an email to the mailing after the build
    contentMail = ""
    release_config = readReleaseConfig(cfgFile)
    sources = release_config['sourceRepositories']
    To = release_config['ImportantRecipients']
    comment = r.get("comment")

    if comment:
        contentMail += "Comment:\n" + comment + "\n\n"

    contentMail += "A new build has been submitted through ship-it:\n"

    for name, source in sources.items():

        # We cannot use the source["revision"] value because it has not been
        # updated yet. It is done later in the process.
        # Select the one defined
        if name == "comm":
            # Thunderbird
            revision = r["commRevision"]
        else:
            revision = r["mozillaRevision"]

        # For now, firefox has only one source repo but Thunderbird has two
        contentMail += name + " commit: https://hg.mozilla.org/" + source[
            'path'] + "/rev/" + revision + "\n"

    contentMail += "\n" + r["submitter"] + "\n"

    Subject = 'Build of %s' % r["name"]

    sendmail(from_=From,
             to=To,
             subject=Subject,
             body=contentMail,
             smtp_server=smtpServer)
Exemplo n.º 28
0
    else:
        cleanup_configs = True
        configs_dir = mkdtemp()
        remote = make_hg_url(HG, options.configs_repo_url)
        retry(mercurial, args=(remote, configs_dir),
              kwargs={'branch': options.configs_branch})
        update(configs_dir, options.configs_branch)

    # https://bugzilla.mozilla.org/show_bug.cgi?id=678103#c5
    # This goes through the list of config files in reverse order, which is a
    # hacky way of making sure that the config file that's listed first is the
    # one that's loaded in releaseConfig for the sendchange.
    for releaseConfigFile in list(reversed(options.releaseConfigFiles)):
        abs_release_config_file = path.join(configs_dir, 'mozilla',
                                            releaseConfigFile)
        releaseConfig = readReleaseConfig(abs_release_config_file)
        products.append(releaseConfig['productName'])

        if not options.buildNumber:
            log.warn("No buildNumber specified, using buildNumber in"
                     " release_config, which may be out of date!")
            options.buildNumber = releaseConfig['buildNumber']

        if options.check:
            site.addsitedir(path.join(configs_dir, 'mozilla'))
            from config import BRANCHES
            source_repo = 'mozilla'
            try:
                branchConfig = BRANCHES[options.branch]
            except KeyError:
                from thunderbird_config import BRANCHES
Exemplo n.º 29
0
        cleanup_configs = True
        configs_dir = mkdtemp()
        remote = make_hg_url(HG, options.configs_repo_url)
        retry(mercurial,
              args=(remote, configs_dir),
              kwargs={'branch': options.configs_branch})
        update(configs_dir, options.configs_branch)

    # https://bugzilla.mozilla.org/show_bug.cgi?id=678103#c5
    # This goes through the list of config files in reverse order, which is a
    # hacky way of making sure that the config file that's listed first is the
    # one that's loaded in releaseConfig for the sendchange.
    for releaseConfigFile in list(reversed(options.releaseConfigFiles)):
        abs_release_config_file = path.join(configs_dir, 'mozilla',
                                            releaseConfigFile)
        releaseConfig = readReleaseConfig(abs_release_config_file)
        products.append(releaseConfig['productName'])

        if not options.buildNumber:
            log.warn("No buildNumber specified, using buildNumber in"
                     " release_config, which may be out of date!")
            options.buildNumber = releaseConfig['buildNumber']

        if options.check:
            site.addsitedir(path.join(configs_dir, 'mozilla'))
            from config import BRANCHES
            source_repo = 'mozilla'
            try:
                branchConfig = BRANCHES[options.branch]
            except KeyError:
                from thunderbird_config import BRANCHES
Exemplo n.º 30
0
                                               DEFAULT_BUILDBOT_CONFIGS_REPO))
    parser.add_argument("-t", "--release-tag", required=True)
    parser.add_argument("--product", help="Override for stage_product")
    parser.add_argument("--ssh-user", required=True)
    parser.add_argument("--ssh-key", required=True)
    parser.add_argument("--overwrite", default=False, action="store_true")
    parser.add_argument("--extra-excludes", action="append")
    parser.add_argument("actions", nargs="+", help="Script actions")

    args = parser.parse_args()
    actions = args.actions
    mercurial(args.buildbot_configs, "buildbot-configs")
    update("buildbot-configs", revision=args.release_tag)

    releaseConfigFile = path.join("buildbot-configs", args.release_config)
    releaseConfig = readReleaseConfig(
        releaseConfigFile, required=REQUIRED_RELEASE_CONFIG)

    productName = args.product or releaseConfig['stage_product']
    version = releaseConfig['version']
    buildNumber = releaseConfig['buildNumber']
    stageServer = releaseConfig['stagingServer']
    stageUsername = args.ssh_user
    stageSshKey = args.ssh_key
    stageSshKey = path.join(os.path.expanduser("~"), ".ssh", stageSshKey)
    createIndexFiles = releaseConfig.get('makeIndexFiles', False) \
        and productName != 'xulrunner'
    syncPartnerBundles = releaseConfig.get('syncPartnerBundles', False) \
        and productName != 'xulrunner'
    ftpSymlinkName = releaseConfig.get('ftpSymlinkName')
    bouncer_aliases = releaseConfig.get('bouncer_aliases')
    productDetailsRepo = releaseConfig.get('productDetailsRepo')
Exemplo n.º 31
0
    if not options.dryrun and not args:
        parser.error(
            "Need to provide a master to sendchange to, or -d for a dryrun")
    elif not options.branch:
        parser.error("Need to provide a branch to release")
    elif not options.releaseConfigFiles:
        parser.error("Need to provide a release config file")

    logging.basicConfig(level=options.loglevel,
                        format="%(asctime)s : %(levelname)s : %(message)s")

    releaseConfig = None
    test_success = True
    buildNumber = options.buildNumber
    for releaseConfigFile in list(reversed(options.releaseConfigFiles)):
        releaseConfig = readReleaseConfig(releaseConfigFile)

        if not options.buildNumber:
            log.warn(
                "No buildNumber specified, using buildNumber in release_config, which may be out of date!"
            )
            options.buildNumber = releaseConfig['buildNumber']

        if options.check:
            from config import BRANCHES
            branchConfig = BRANCHES[options.branch]
            #Match command line options to defaults in release_configs
            if not verify_options(options, releaseConfig):
                test_success = False
                log.error(
                    "Error verifying command-line options, attempting checking repo"
Exemplo n.º 32
0
        for release in rr.new_releases:
            rr.mark_as_failed(release, 'Failed: %s' % repr(e))
        raise

    rc = 0
    for release in rr.new_releases:
        try:
            rr.update_status(release, 'Running sendchange command')
            staging = config.getboolean('release-runner', 'staging')
            update(configs_workdir, revision='default')
            cfgFile = path.join(configs_workdir, 
                                'mozilla', 
                                getReleaseConfigName(release['product'], 
                                                     path.basename(release['branch']),
                                                     release['version'], staging))
            enUSPlatforms = readReleaseConfig(cfgFile)['enUSPlatforms']
            rr.start_release_automation(release, sendchange_master, enUSPlatforms)
        except:
            # We explicitly do not raise an error here because there's no
            # reason not to start other releases if the sendchange fails for
            # another one. We _do_ need to set this in order to exit
            # with the right code, though.
            rc = 2
            rr.update_status(release, 'Sendchange failed')
            log.error('Sendchange failed for %s: ' % release, exc_info=True)

    if rc != 0:
        sys.exit(rc)

if __name__ == '__main__':
    parser = OptionParser(__doc__)
Exemplo n.º 33
0
        parser.error("Need to provide a list of products, e.g. -p firefox,fennec")
    if not options.dryrun and not args:
        parser.error("Need to provide a master to sendchange to, or -d for a dryrun")
    elif not options.branch:
        parser.error("Need to provide a branch to release")
    elif not options.releaseConfigFiles:
        parser.error("Need to provide a release config file")

    logging.basicConfig(level=options.loglevel,
            format="%(asctime)s : %(levelname)s : %(message)s")

    releaseConfig = None
    test_success = True
    buildNumber = options.buildNumber
    for releaseConfigFile in list(reversed(options.releaseConfigFiles)):
        releaseConfig = readReleaseConfig(releaseConfigFile)

        if not options.buildNumber:
            log.warn("No buildNumber specified, using buildNumber in release_config, which may be out of date!")
            options.buildNumber = releaseConfig['buildNumber']

        if options.check:
            from config import BRANCHES
            branchConfig = BRANCHES[options.branch]
            #Match command line options to defaults in release_configs
            if not verify_options(options, releaseConfig):
                test_success = False
                log.error("Error verifying command-line options, attempting checking repo")

            # verify that mozconfigs for this release pass diff with nightly, compared to a whitelist
            try:
Exemplo n.º 34
0
                                               DEFAULT_BUILDBOT_CONFIGS_REPO))
    parser.add_argument("-t", "--release-tag", required=True)
    parser.add_argument("--product", help="Override for stage_product")
    parser.add_argument("--ssh-user", required=True)
    parser.add_argument("--ssh-key", required=True)
    parser.add_argument("--overwrite", default=False, action="store_true")
    parser.add_argument("--extra-excludes", action="append")
    parser.add_argument("actions", nargs="+", help="Script actions")

    args = parser.parse_args()
    actions = args.actions
    mercurial(args.buildbot_configs, "buildbot-configs")
    update("buildbot-configs", revision=args.release_tag)

    releaseConfigFile = path.join("buildbot-configs", args.release_config)
    releaseConfig = readReleaseConfig(releaseConfigFile,
                                      required=REQUIRED_RELEASE_CONFIG)

    productName = args.product or releaseConfig['stage_product']
    version = releaseConfig['version']
    buildNumber = releaseConfig['buildNumber']
    stageServer = releaseConfig['stagingServer']
    stageUsername = args.ssh_user
    stageSshKey = args.ssh_key
    stageSshKey = path.join(os.path.expanduser("~"), ".ssh", stageSshKey)
    createIndexFiles = releaseConfig.get('makeIndexFiles', False) \
        and productName != 'xulrunner'
    syncPartnerBundles = releaseConfig.get('syncPartnerBundles', False) \
        and productName != 'xulrunner'
    ftpSymlinkName = releaseConfig.get('ftpSymlinkName')
    bouncer_aliases = releaseConfig.get('bouncer_aliases')
Exemplo n.º 35
0
        for release in rr.new_releases:
            rr.mark_as_failed(release, 'Failed: %s' % repr(e))
        raise

    rc = 0
    for release in rr.new_releases:
        try:
            rr.update_status(release, 'Running sendchange command')
            staging = config.getboolean('release-runner', 'staging')
            update(configs_workdir, revision='default')
            cfgFile = path.join(
                configs_workdir, 'mozilla',
                getReleaseConfigName(release['product'],
                                     path.basename(release['branch']),
                                     release['version'], staging))
            enUSPlatforms = readReleaseConfig(cfgFile)['enUSPlatforms']
            rr.start_release_automation(release, sendchange_master,
                                        enUSPlatforms)
        except:
            # We explicitly do not raise an error here because there's no
            # reason not to start other releases if the sendchange fails for
            # another one. We _do_ need to set this in order to exit
            # with the right code, though.
            rc = 2
            rr.update_status(release, 'Sendchange failed')
            log.error('Sendchange failed for %s: ' % release, exc_info=True)

    if rc != 0:
        sys.exit(rc)