def _get_checked_out_project(self): """Determines the project initially checked out by Jenkins. If the build is triggered by Gerrit Trigger, then GERRIT_PROJECT environment variable exists, and the Jenkins build configuration needs to check out this project to properly integrate with different plugins. For other cases, CHECKOUT_PROJECT can also be used. Returns: Tuple[Project,RefSpec]: The checked out project and refspec. """ checkout_project = self._env.get('CHECKOUT_PROJECT', None) gerrit_project = self._env.get('GERRIT_PROJECT', None) if checkout_project is not None: checkout_project = Project.parse(checkout_project) refspec = self._env.get('CHECKOUT_REFSPEC', None) if refspec is None: raise ConfigurationError('CHECKOUT_REFSPEC not set') sha1 = self._env.get('{0}_HASH'.format(checkout_project.upper()), None) return checkout_project, RefSpec(refspec, sha1) if gerrit_project is not None: gerrit_project = Project.parse(gerrit_project) refspec = self._env.get('GERRIT_REFSPEC', None) if refspec is None: raise ConfigurationError('GERRIT_REFSPEC not set') return gerrit_project, RefSpec(refspec) raise ConfigurationError('Neither CHECKOUT_PROJECT nor GERRIT_PROJECT is set')
def main(args): # Parse the command line options options, args = Options.parseCommandLine(args) if options.help_commands: printCommands() return 0 if not args: fail("Command missing. Use one of %s" % ", ".join(getCommands().keys())) command = args[0] commands = getCommands() if options.verbose: Log.quiet = False else: Log.debug = lambda msg: None if options.quiet: Log.quiet = True if not command in commands: fail("Bad command. Use one of %s" % ", ".join(getCommands().keys())) # Install a task monitor taskMon = Task.RateLimitedTaskMonitor(TracyTaskMonitor()) Task.setMonitor(taskMon) # Read the project file project = Project.Project(options=options, fileName=options.project) getCommands()[command][0](project, options, args[1:]) return 0
def __init__(self, json_data): self.project = Project.parse(json_data['project']) self.branch = json_data['branch'] self.number = int(json_data['number']) self.url = json_data['url'] self.is_open = json_data['open'] patchset = json_data['currentPatchSet'] self.patchnumber = int(patchset['number']) self.refspec = RefSpec(patchset['ref'], patchset['revision'])
def __init__(self, json_data): self.project = Project.parse(json_data['project']) self.branch = json_data['branch'] self.number = int(json_data['number']) self.title = json_data['subject'] self.url = json_data['url'] self.is_open = json_data['open'] patchset = json_data['currentPatchSet'] self.patchnumber = int(patchset['number']) self.refspec = RefSpec(patchset['ref'], patchset['revision'])
def generateTargets(self): # Load the created project and generate each target options, args = Options.parseCommandLine( ["-c", "tracytest.tcy", "-o", "tracytest"]) proj = Project.Project(options, "tracytest.tcy") for target in Target.targets: assert target in proj.targets try: TracyGenerator.generate(proj, options, [target]) assert os.path.exists("tracytest") except RuntimeError: if target not in ["code"]: raise
def createAnalyzer(self, args=[]): # Parse the command line options options, args = Options.parseCommandLine(args) # Read the project file project = Project.Project(options=options, fileName=options.project) # Create the interactive analyzer analyzer = Analyzer.InteractiveAnalyzer(project, options) # Divert the output analyzer.reportInfo = self.logInfo Task.setMonitor(None) return analyzer
def main(args): # Parse the command line options options, args = Options.parseCommandLine(args) if options.verbose: Log.quiet = False if options.quiet: Log.quiet = True # If a project file was not given, present the possibilities if not options.project: projectFiles = getAvailableProjectFiles() try: projectFile = projectFiles[Console.chooseIndex( "Choose a project file", [f[1] for f in projectFiles])][0] except TypeError: return else: projectFile = options.project # Read the project file project = Project.Project(options=options, fileName=projectFile) # Create the interactive analyzer analyzer = Analyzer.InteractiveAnalyzer(project, options) if options.execute: for command in options.execute: try: analyzer.execute(command) except Analyzer.ExecutionError: return 1 analyzer.run() return 0
def _parse_checkout_project(self): checkout_project = self._env.get('CHECKOUT_PROJECT', None) if checkout_project is None: return None return Project.parse(checkout_project)
def get_triggering_project(self): gerrit_project = self._env.get('GERRIT_PROJECT', None) if gerrit_project is None: return None return Project.parse(gerrit_project)
parser_process.add_argument('-I', '--input-file', help='Input file as used in Jenkins (if given, other arguments are ignored)') parser_process.add_argument('-M', '--matrix', help='Matrix definition used to run the build') parser_process.add_argument('-J', '--job-name', help='Matrix job name') parser_process.add_argument('-n', '--build-number', help='Build number to process') parser_process.set_defaults(func=process_matrix) args = parser.parse_args() workspace_root = args.workspace if workspace_root is None: workspace_root = os.path.join(os.path.dirname(__file__), "..", "..") workspace_root = os.path.abspath(workspace_root) project = Project.GROMACS if args.project is not None: project = Project.parse(args.project) env = dict(os.environ) env.update({ 'GROMACS_REFSPEC': 'HEAD', 'RELENG_REFSPEC': 'HEAD', 'REGRESSIONTESTS_REFSPEC': 'HEAD', 'STATUS_FILE': 'logs/status.json', 'WORKSPACE': workspace_root, 'NODE_NAME': args.node }) # Please ensure that run_build() in __init__.py stays in sync. factory = ContextFactory(default_project=project, system=args.system, env=env) if not args.run: from executor import DryRunExecutor
parser_process.add_argument('-J', '--job-name', help='Matrix job name') parser_process.add_argument('-n', '--build-number', help='Build number to process') parser_process.set_defaults(func=process_matrix) args = parser.parse_args() workspace_root = args.workspace if workspace_root is None: workspace_root = os.path.join(os.path.dirname(__file__), "..", "..") workspace_root = os.path.abspath(workspace_root) project = Project.GROMACS if args.project is not None: project = Project.parse(args.project) env = dict(os.environ) env.update({ 'GROMACS_REFSPEC': 'HEAD', 'RELENG_REFSPEC': 'HEAD', 'REGRESSIONTESTS_REFSPEC': 'HEAD', 'STATUS_FILE': 'logs/status.json', 'WORKSPACE': workspace_root, 'NODE_NAME': args.node }) # Please ensure that run_build() in __init__.py stays in sync. factory = ContextFactory(default_project=project, system=args.system, env=env) if not args.run: from executor import DryRunExecutor
def setUp(self): self.options, args = Options.parseCommandLine(["-o", "tracytest.tcy"]) self.project = Project.Project(self.options, self.options.project) Log.quiet = True