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 __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 _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