Example #1
0
def execute(options, conf_dict):

    yb = yum.YumBase()

    if options.command == 'git':
        if yb.rpmdb.searchNevra(name='git'):
            logger.log.info("Git rpm found.")

            git = Git(options, conf_dict)
            git.get_archive()
        else:
            logger.log.error("Git rpm not installed.")
            sys.exit(2)

    elif options.command == 'beaker':
        if yb.rpmdb.searchNevra(name='beaker-client'):
            logger.log.info("beaker-client rpm found")

            beaker = Beaker(options, conf_dict)
            beaker.run(options, conf_dict)
        else:
            logger.log.error("beaker-client rpm not found")
            sys.exit(2)

    elif options.command == 'brew':
        if yb.rpmdb.searchNevra(name='koji'):
            logger.log.info("Koji rpm found.")

            brew = Brew(options, conf_dict)
            brew.get_latest(options, conf_dict)
        else:
            logger.log.error("Koji rpm not installed.")
            sys.exit(2)

    elif options.command == 'restraint':
        if yb.rpmdb.searchNevra(name='restraint-client'):
            logger.log.info("restraint-client rpm found.")
            restraint = Restraint(options, conf_dict)
            restraint.run_restraint(options, conf_dict)
            restraint.restraint_junit()
        else:
            logger.log.error("restraint-client rpm not installed.")
            sys.exit(2)

    elif options.command == 'errata':
        errata = Errata(options, conf_dict)
        errata.download_errata_builds()
    elif options.command == 'jenkins':
        jenkins = Jenkins(options, conf_dict)
        jenkins.main(options, conf_dict)
    elif options.command == 'ci':
        ci = CI(options, conf_dict)
        ci.run(options, conf_dict)
Example #2
0
def execute(options, conf_dict):

    yb = yum.YumBase()

    if options.command == 'git':
        if yb.rpmdb.searchNevra(name='git'):
            logger.log.info("Git rpm found.")

            git = Git(options, conf_dict)
            git.get_archive()
        else:
            logger.log.error("Git rpm not installed.")
            sys.exit(2)

    elif options.command == 'beaker':
        if yb.rpmdb.searchNevra(name='beaker-client'):
            logger.log.info("beaker-client rpm found")

            beaker = Beaker(options, conf_dict)
            beaker.run(options, conf_dict)
        else:
            logger.log.error("beaker-client rpm not found")
            sys.exit(2)

    elif options.command == 'brew':
        if yb.rpmdb.searchNevra(name='koji'):
            logger.log.info("Koji rpm found.")

            brew = Brew(options, conf_dict)
            brew.get_latest(options, conf_dict)
        else:
            logger.log.error("Koji rpm not installed.")
            sys.exit(2)

    elif options.command == 'restraint':
        if yb.rpmdb.searchNevra(name='restraint-client'):
            logger.log.info("restraint-client rpm found.")
            restraint = Restraint(options, conf_dict)
            restraint.run_restraint(options, conf_dict)
            restraint.restraint_junit()
        else:
            logger.log.error("restraint-client rpm not installed.")
            sys.exit(2)

    elif options.command == 'errata':
        errata = Errata(options, conf_dict)
        errata.download_errata_builds()
    elif options.command == 'jenkins':
        jenkins = Jenkins(options, conf_dict)
        jenkins.main(options, conf_dict)
    elif options.command == 'ci':
        ci = CI(options, conf_dict)
        ci.run(options, conf_dict)
Example #3
0
File: ci.py Project: stvgov/nexus
    def run(self, options, conf_dict):
        if self.provisioner == "beaker" and self.framework == "restraint":
            git = Git(options, conf_dict)
            git.get_archive()

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            restraint = Restraint(options, conf_dict)

            """ This function actually runs restraint command and
            executed the job on beaker.
            """
            restraint.run_restraint(options, conf_dict)

        elif self.provisioner == "beaker" and self.framework == "pytest":

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            pytest = Pytest(options, conf_dict)
            pytest.run_pytest(options, conf_dict)

            if options.coverage is True:
                logger.log.info("Get coverage report")
                coverage = Testcoverage(options, conf_dict)
                coverage.coverage_reports(options, conf_dict)
                coverage.get_reports(options, conf_dict)
            else:
                logger.log.info("No coverage report since option not set")

        elif self.provisioner == "openstack" and self.framework == "pytest":

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            pytest = Pytest(options, conf_dict)
            pytest.run_pytest(options, conf_dict)

            if options.coverage is True:
                logger.log.info("Get coverage report")
                coverage = Testcoverage(options, conf_dict)
                coverage.coverage_reports(options, conf_dict)
                coverage.get_reports(options, conf_dict)
            else:
                logger.log.info("No coverage report since option not set")

        else:
            logger.log.error("Unknown provisioner or framework")
Example #4
0
    def run(self, options, conf_dict):
        if self.provisioner == "beaker" and self.framework == "restraint":
            git = Git(options, conf_dict)
            git.get_archive()

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            restraint = Restraint(options, conf_dict)
            """ This function actually runs restraint command and
            executed the job on beaker.
            """
            restraint.run_restraint(options, conf_dict)

        elif self.provisioner == "beaker" and self.framework == "pytest":
            #TODO write code to run tests using pytest
            print "pytest code"

        else:
            logger.log.error("Unknown provisioner or framework")
Example #5
0
    def run(self, options, conf_dict):
        if self.provisioner == "beaker" and self.framework == "restraint":
            git = Git(options, conf_dict)
            git.get_archive()

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            restraint = Restraint(options, conf_dict)

            """ This function actually runs restraint command and
            executed the job on beaker.
            """
            restraint.run_restraint(options, conf_dict)

        elif self.provisioner == "beaker" and self.framework == "pytest":
            #TODO write code to run tests using pytest
            print "pytest code"

        else:
            logger.log.error("Unknown provisioner or framework")
Example #6
0
    def run(self, options, conf_dict):
        if self.provisioner == "beaker" and self.framework == "restraint":
            git = Git(options, conf_dict)
            git.get_archive()

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            restraint = Restraint(options, conf_dict)

            """ This function actually runs restraint command and
            executed the job on beaker.
            """
            restraint.run_restraint(options, conf_dict)

        elif self.provisioner == "beaker" and self.framework == "pytest":

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            pytest = Pytest(options, conf_dict)
            pytest.run_pytest(options, conf_dict)

            if options.coverage is True:
                logger.log.info("Get coverage report")
                coverage = Testcoverage(options, conf_dict)
                coverage.coverage_reports(options, conf_dict)
                coverage.get_reports(options, conf_dict)
            else:
                logger.log.info("No coverage report since option not set")

        elif self.provisioner == "openstack" and self.framework == "pytest":

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            pytest = Pytest(options, conf_dict)
            pytest.run_pytest(options, conf_dict)

            if options.coverage is True:
                logger.log.info("Get coverage report")
                coverage = Testcoverage(options, conf_dict)
                coverage.coverage_reports(options, conf_dict)
                coverage.get_reports(options, conf_dict)
            else:
                logger.log.info("No coverage report since option not set")

        elif self.provisioner == "openstack" and self.framework == "restraint":

            git = Git(options, conf_dict)
            git.get_archive()

            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)

            restraint = Restraint(options, conf_dict)
            restraint.run_restraint(options, conf_dict)

        elif self.provisioner == "openstack" and self.framework == "dogtag-pytest":
            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)
            pkitest = PkiTest(options, conf_dict)
            pkitest.set_hostnames()
            pkitest.update_etc_hosts()
            yaml_file = pkitest.create_yaml()
            logger.log.info("we completed creating yaml file")
            logger.log.info("Current working directory is: %s"%(os.environ.get('PWD')))
            pkitest.deploy_ssh_keys()
            if pkitest.copy_extras_repo():
                logger.log.info("Extra's repo configured successfull")
                if pkitest.install_prereqs():
                    logger.log.info("Pre-requisites to run pytest has been installed successfull")
                    pkitest.pytest_setup()
                    if pkitest.run_pytest(yaml_file):
                        logger.log.info("pytest ran successfully")
                    else:
                        logger.log.info("pytest failed")
                else:
                    logger.log.info("Pre-requisites to run pytest has not been installed")
            else:
                logger.log.info("Extras repo did not configure")

        elif self.provisioner == "beaker" and self.framework == "dogtag-pytest":
            repo = Repos(options, conf_dict)
            repo.run_repo_setup(options, conf_dict)
            pkitest = PkiTest(options, conf_dict)
            pkitest.update_etc_hosts()
            yaml_file = pkitest.create_yaml()
            pkitest.deploy_ssh_keys()
            if pkitest.copy_extras_repo():
                logger.log.info("Extra's repo configured successfull")
                if pkitest.install_prereqs():
                    logger.log.info("Pre-requisites to run pytest has been installed successfull")
                    if pkitest.run_pytest(yaml_file):
                        logger.log.info("pytest ran successfully")
                    else:
                        logger.log.info("pytest failed")
                else:
                    logger.log.info("Pre-requisites to run pytest has not been installed")
            else:
                logger.log.info("Extras repo did not configure")
        else:
            logger.log.error("Unknown provisioner or framework")