예제 #1
0
    def process_functest(args, executor, fileutils = FileUtils()):

        #probably this can be improved somehow - ask Min'an.

        runner_dir = os.sep.join(['jira-distribution', 'jira-func-tests-runner', 'target'])
        if not args.quick:
            maven = MavenCallable()
            maven.phase('package').project('jira-distribution/jira-func-tests-runner').option('-am')
            maven.profile('distribution')
            maven.property('maven.test.skip', 'true').property('jira.minify.skip', 'true').property('func.mode.plugins')
            maven.property('reference.plugins').property('jira.func.tests.runner.create').property('obrRepository', 'NONE')
            maven.property('skipSources')
            executor.append(maven.can_run_in_parallel())

            unpack_script = os.path.abspath(os.sep.join(['jira-distribution', 'jira-func-tests-runner', 'src', 'main', 'dist', 'prepare-runner.sh']))
            executor.append(SystemCallable(args, unpack_script, cwd=runner_dir))

        maven = MavenCallable(path = runner_dir)
        maven.phase('verify').profile('hallelujahClient').property('jira.security.disabled', 'true')

        if fileutils.file_exists(args.replay_file):
            replay_file = os.path.abspath(args.replay_file)
        else:
            replay_file = os.path.abspath(os.sep.join(['target', 'replays', args.replay_file]))
        maven.property('hallelujah.local.test.list', replay_file)

        maven.property('system.bamboo.agent.home', os.path.abspath(runner_dir))
        executor.append(maven)
예제 #2
0
    def get_tasks_to_build_jira(self, args, workspace_utils=WorkspaceUtils()):

        if not args.manifesto_jira:
            #for workspace build maven must be executed from parent directory
            maven = MavenCallable(args)
            maven.phase('package')

            maven.profile('ondemand').project(OD_WEBAPP_PROJECT_DIR).option('-am')
            maven.property('jira.home', args.layout.jira_home())

            maven.projects.extend(workspace_utils.get_workspace_projects_without_jira(args))
            self.add_devmode_plugins(args, maven)

            if not args.attach_sources:
                maven.property('skipSources')
            maven.skip_tests()
            if args.third_party_licensing:
                maven.profiles.extend(['third-party-licensing'])

            # return builder and manifesto plugins job:
            return [maven]
        else:

            mavenClean = MavenCallable(args, path=OD_WEBAPP_PROJECT_DIR)
            mavenClean.phase('clean')

            return [mavenClean,
                    self.manifesto_jira(args, manifesto=self.manifesto),
                    self.__create_target_dir_for_exploded_webapp(),
                    SystemCallable(args, command='unzip *.war -d war/exploded', cwd=os.sep.join([OD_WEBAPP_PROJECT_DIR, 'target']))]
예제 #3
0
    def get_values(self):
        def process_output(myself, log: Logger, line: str, num: int):
            if '[deprecation]' in line:
                self.hit(re.sub(r'(.*java:)\[\d+,\d+\] \[deprecation\]( .*)', r'\1\2',
                    re.sub(r'\s*\[WARNING\]\s+' , '', line.replace(os.getcwd() + '/', '').replace('[WARNING]', ''))
                ))
                if self.log.is_trace():
                    self.add_to_stats(line)
                return self.verbose or self.log.is_trace()

            return line.startswith("[INFO] Building Atlassian") or line.startswith('[ERROR]') or self.log.is_trace()

        maven = MavenCallable()
        maven.phase('clean').phase('test-compile').profile('jira-metrics').profile('ondemand')
        maven.property('jira.exclude.bundled.plugins')
        maven.option('--no-plugin-updates')
        if self.log.is_trace():
            maven.option('-X')
        self.log.info('Compiling workspace to find deprecated methods usage...')
        maven.process_output = types.MethodType(process_output, maven)

        super().pre_files_scan('irrelevant')
        maven_return_code = self.run_maven(maven)
        super().post_files_scan('irrelevant')

        if maven_return_code != MavenCallable.success:
            raise MavenExecutionException

        self.log.trace(
            json.JSONEncoder(indent=True).encode(sorted(self.deprecated_stats.items(), key=operator.itemgetter(1))))
        self.log.info('Compilation finished.')
        return super().get_values() if maven.returncode == 0 else {}
예제 #4
0
    def __third_party_licensing(self, args):

        licensing_maven_executable = MavenCallable(args)
        licensing_maven_executable.phase('verify').phases.extend(['license:bom', 'license:download'])
        licensing_maven_executable.profiles.extend(['distribution', '!build-source-distribution'])
        licensing_maven_executable.property('maven.test.skip', 'true')
        return licensing_maven_executable
예제 #5
0
    def __call__(self, args, executor):
        maven = MavenCallable(args)
        maven.project('jira-distribution/jira-standalone-distribution').option('-am')
        maven.phase('package').profile('distribution')
        maven.property('maven.test.unit.skip', 'true').property('maven.test.func.skip', 'true').property(
            'maven.test.selenium.skip', 'true')
        executor.append(maven)

        executor.append(SystemCallable(args, 'bin/unpackStandalone' + (' run' if args.run else '')))
예제 #6
0
    def __third_party_licensing(self, args):

        licensing_maven_executable = MavenCallable(args)
        licensing_maven_executable.phase('verify').phases.extend(
            ['license:bom', 'license:download'])
        licensing_maven_executable.profiles.extend(
            ['distribution', '!build-source-distribution'])
        licensing_maven_executable.property('maven.test.skip', 'true')
        return licensing_maven_executable
예제 #7
0
def general_func_test_runner(args, additional_options=None):
    if not additional_options: additional_options = {}
    maven = MavenCallable(args)
    maven.projects = ['jira-distribution/jira-func-tests-runner']
    maven.option('-am')
    maven.profile('distribution')
    maven.phase('verify')
    maven.properties.update(additional_options)
    maven.property('system.bamboo.agent.home', os.path.abspath(os.sep.join(['jira-distribution', 'jira-func-tests-runner', 'target'])))
    return maven
예제 #8
0
    def __call__(self, args, executor):
        maven = MavenCallable(args)
        maven.project('jira-distribution/jira-standalone-distribution').option(
            '-am')
        maven.phase('package').profile('distribution')
        maven.property('maven.test.unit.skip', 'true').property(
            'maven.test.func.skip',
            'true').property('maven.test.selenium.skip', 'true')
        executor.append(maven)

        executor.append(
            SystemCallable(
                args, 'bin/unpackStandalone' + (' run' if args.run else '')))
예제 #9
0
def general_func_test_runner(args, additional_options=None):
    if not additional_options: additional_options = {}
    maven = MavenCallable(args)
    maven.projects = ['jira-distribution/jira-func-tests-runner']
    maven.option('-am')
    maven.profile('distribution')
    maven.phase('verify')
    maven.properties.update(additional_options)
    maven.property(
        'system.bamboo.agent.home',
        os.path.abspath(
            os.sep.join(
                ['jira-distribution', 'jira-func-tests-runner', 'target'])))
    return maven
예제 #10
0
    def process_webdriver(args, executor, fileutils=FileUtils()):

        maven = MavenCallable()
        maven.project('jira-distribution/jira-webdriver-tests-runner').option(
            '-am')
        maven.phase('verify').profile('hallelujahClient').profile(
            'distribution')
        maven.property('maven.test.unit.skip', 'true')

        if fileutils.file_exists(args.replay_file):
            replay_file = os.path.abspath(args.replay_file)
        else:
            replay_file = os.path.abspath(
                os.sep.join(['target', 'replays', args.replay_file]))
        maven.property('jira.user.extra.jvmargs',
                       '"-Dhallelujah.local.test.list=%s"' % replay_file)
        maven.property('func.mode.plugins').property('reference.plugins')

        maven.property(
            'system.bamboo.agent.home',
            os.path.abspath(
                os.sep.join([
                    'jira-distribution', 'jira-webdriver-tests-runner',
                    'target'
                ])))
        executor.append(maven.can_run_in_parallel())
예제 #11
0
    def __call__(self, args, executor):
        maven = MavenCallable(args)
        maven.project('jira-distribution/jira-webdriver-tests-runner').option('-am')
        maven.phase('integration-test').profile('distribution')
        maven.property('maven.test.unit.skip', 'true').property('maven.test.func.skip', 'true').property(
            'jira.security.disabled', 'true').property('dev.mode.plugins').property(
            'jira.functest.single.testclass', 'com.atlassian.jira.webtest.webdriver.qunit.TestQunit').property(
            'jira.minify.skip', 'true').property('func.mode.plugins').property('java.awt.headless', 'true')

        self.surefire.set_roots(maven.projects)
        executor.append(self.surefire.clean_executable())
        executor.append(maven)
        # because the qunit suite contains just the runner it will always be successful, unless the tests
        # cannot be ran. Thus, the report has to provide exit code (while it should run in post_commands):
        executor.append(self.surefire.report_executable())
예제 #12
0
    def __call__(self, args, executor):

        if self.fileutils.file_exists(dependencies_tmp):
            executor.append(lambda logger: self.fileutils.remove(dependencies_tmp) or 0)

        maven = MavenCallable(args, process_utils=self.process_utils)
        maven.projects = ['jira-components/jira-tests-parent/jira-tests',
                          'jira-components/jira-tests-parent/jira-tests-unit']
        if not args.skip_legacy:
            maven.project('jira-components/jira-tests-parent/jira-tests-legacy')
        maven.option('-am')
        maven.phase('compile' if args.vdep else 'test')
        maven.property('verifyDependencies').property('jira.minify.skip', 'true').property('performApiCheck').property(
            'ajEnforcer')

        maven.property('maven.test.func.skip', 'true').property('maven.test.selenium.skip', 'true')
        if not args.skip_bp:
            report_projects = ['jira-components/jira-tests-parent',
                               'jira-func-tests',
                               'jira-components/jira-plugins']
            maven.project('jira-components/jira-plugins/jira-bundled-plugins')
        else:
            report_projects = ['jira-components/jira-tests-parent',
                               'jira-func-tests']
            maven.project('jira-func-tests')

        try:
            maven.require_mvn3().can_run_in_parallel()
        except MavenVersionInaccessibleException:
            pass

        self.surefire.set_roots(report_projects)
        executor.append(self.surefire.clean_executable())

        if args.findbugs:
            try:
                executor.append(maven.phase('test').profile('findbugs').require_mvn3())
            except MavenVersionInaccessibleException as e:
                executor.append(maven.mvn3_inaccessible_msg_callable('unit tests with findbugs', e))
        else:
            if args.vdep:
                executor.append(maven.phase('compile'))
            else:
                executor.append(maven.phase('test').option('--fail-at-end'))
                executor.append_post(self.surefire.report_executable())

        executor.append_post(DependenciesReport(args))
예제 #13
0
    def get_values(self):
        def process_output(myself, log: Logger, line: str, num: int):
            if '[deprecation]' in line:
                self.hit(
                    re.sub(
                        r'(.*java:)\[\d+,\d+\] \[deprecation\]( .*)', r'\1\2',
                        re.sub(
                            r'\s*\[WARNING\]\s+', '',
                            line.replace(os.getcwd() + '/',
                                         '').replace('[WARNING]', ''))))
                if self.log.is_trace():
                    self.add_to_stats(line)
                return self.verbose or self.log.is_trace()

            return line.startswith(
                "[INFO] Building Atlassian") or line.startswith(
                    '[ERROR]') or self.log.is_trace()

        maven = MavenCallable()
        maven.phase('clean').phase('test-compile').profile(
            'jira-metrics').profile('ondemand')
        maven.property('jira.exclude.bundled.plugins')
        maven.option('--no-plugin-updates')
        if self.log.is_trace():
            maven.option('-X')
        self.log.info(
            'Compiling workspace to find deprecated methods usage...')
        maven.process_output = types.MethodType(process_output, maven)

        super().pre_files_scan('irrelevant')
        maven_return_code = self.run_maven(maven)
        super().post_files_scan('irrelevant')

        if maven_return_code != MavenCallable.success:
            raise MavenExecutionException

        self.log.trace(
            json.JSONEncoder(indent=True).encode(
                sorted(self.deprecated_stats.items(),
                       key=operator.itemgetter(1))))
        self.log.info('Compilation finished.')
        return super().get_values() if maven.returncode == 0 else {}
예제 #14
0
    def __call__(self, args, executor):
        maven = MavenCallable(args)
        maven.project('jira-distribution/jira-webdriver-tests-runner').option(
            '-am')
        maven.phase('integration-test').profile('distribution')
        maven.property('maven.test.unit.skip', 'true').property(
            'maven.test.func.skip', 'true').property(
                'jira.security.disabled',
                'true').property('dev.mode.plugins').property(
                    'jira.functest.single.testclass',
                    'com.atlassian.jira.webtest.webdriver.qunit.TestQunit'
                ).property('jira.minify.skip',
                           'true').property('func.mode.plugins').property(
                               'java.awt.headless', 'true')

        self.surefire.set_roots(maven.projects)
        executor.append(self.surefire.clean_executable())
        executor.append(maven)
        # because the qunit suite contains just the runner it will always be successful, unless the tests
        # cannot be ran. Thus, the report has to provide exit code (while it should run in post_commands):
        executor.append(self.surefire.report_executable())
예제 #15
0
    def get_tasks_to_build_jira(self, args, workspace_utils=WorkspaceUtils()):
        #for workspace build maven must be executed from parent directory
        maven = MavenCallable(args)
        maven.phase('package')

        if not args.build_war:
            maven.property('jira.do.not.prepare.war')

        maven.project('jira-components/jira-webapp').option('-am')
        maven.property('jira.home', args.layout.jira_home())

        maven.projects.extend(
            workspace_utils.get_workspace_projects_without_jira(args))
        self.add_plugins_maven_goals(args, maven)
        if not args.attach_sources:
            maven.property('skipSources')
        maven.skip_tests()
        if args.third_party_licensing:
            maven.profiles.extend(['third-party-licensing'])

        # return builder and the bundled plugins
        return [
            maven, lambda logger: self.stale_plugins.remember_plugins_profiles(
                maven.profiles) or 0
        ]
예제 #16
0
    def process_functest(args, executor, fileutils=FileUtils()):

        #probably this can be improved somehow - ask Min'an.

        runner_dir = os.sep.join(
            ['jira-distribution', 'jira-func-tests-runner', 'target'])
        if not args.quick:
            maven = MavenCallable()
            maven.phase('package').project(
                'jira-distribution/jira-func-tests-runner').option('-am')
            maven.profile('distribution')
            maven.property('maven.test.skip', 'true').property(
                'jira.minify.skip', 'true').property('func.mode.plugins')
            maven.property('reference.plugins').property(
                'jira.func.tests.runner.create').property(
                    'obrRepository', 'NONE')
            maven.property('skipSources')
            executor.append(maven.can_run_in_parallel())

            unpack_script = os.path.abspath(
                os.sep.join([
                    'jira-distribution', 'jira-func-tests-runner', 'src',
                    'main', 'dist', 'prepare-runner.sh'
                ]))
            executor.append(SystemCallable(args, unpack_script,
                                           cwd=runner_dir))

        maven = MavenCallable(path=runner_dir)
        maven.phase('verify').profile('hallelujahClient').property(
            'jira.security.disabled', 'true')

        if fileutils.file_exists(args.replay_file):
            replay_file = os.path.abspath(args.replay_file)
        else:
            replay_file = os.path.abspath(
                os.sep.join(['target', 'replays', args.replay_file]))
        maven.property('hallelujah.local.test.list', replay_file)

        maven.property('system.bamboo.agent.home', os.path.abspath(runner_dir))
        executor.append(maven)
예제 #17
0
    def process_webdriver(args, executor, fileutils = FileUtils()):

        maven = MavenCallable()
        maven.project('jira-distribution/jira-webdriver-tests-runner').option('-am')
        maven.phase('verify').profile('hallelujahClient').profile('distribution')
        maven.property('maven.test.unit.skip', 'true')

        if fileutils.file_exists(args.replay_file):
            replay_file = os.path.abspath(args.replay_file)
        else:
            replay_file = os.path.abspath(os.sep.join(['target', 'replays', args.replay_file]))
        maven.property('jira.user.extra.jvmargs', '"-Dhallelujah.local.test.list=%s"' % replay_file)
        maven.property('func.mode.plugins').property('reference.plugins')

        maven.property('system.bamboo.agent.home', os.path.abspath(os.sep.join(['jira-distribution', 'jira-webdriver-tests-runner', 'target'])))
        executor.append(maven.can_run_in_parallel())
예제 #18
0
    def get_tasks_to_build_jira(self, args, workspace_utils=WorkspaceUtils()):
        #for workspace build maven must be executed from parent directory
        maven = MavenCallable(args)
        maven.phase('package')

        if not args.build_war:
            maven.property('jira.do.not.prepare.war')

        maven.project('jira-components/jira-webapp').option('-am')
        maven.property('jira.home', args.layout.jira_home())

        maven.projects.extend(workspace_utils.get_workspace_projects_without_jira(args))
        self.add_plugins_maven_goals(args, maven)
        if not args.attach_sources:
            maven.property('skipSources')
        maven.skip_tests()
        if args.third_party_licensing:
            maven.profiles.extend(['third-party-licensing'])

        # return builder and the bundled plugins
        return [maven, lambda logger: self.stale_plugins.remember_plugins_profiles(maven.profiles) or 0]
예제 #19
0
 def __call__(self, args, executor):
     maven = MavenCallable(args)
     maven.phase('install')
     maven.property('skipTests', 'true')
     executor.append(maven)
예제 #20
0
 def __call__(self, args, executor):
     maven = MavenCallable(args)
     maven.phase('install')
     maven.property('skipTests', 'true')
     executor.append(maven)