def _create_config(self, with_local_site=False): """Create an integration config. Args: with_local_site (bool): Whether to limit the config to a local site. """ choice = ReviewRequestRepositoriesChoice() condition_set = ConditionSet(conditions=[ Condition(choice=choice, operator=choice.get_operator('any')) ]) if with_local_site: local_site = self.get_local_site(name=self.local_site_name) else: local_site = None config = self.integration.create_config(name='Config 1', enabled=True, local_site=local_site) config.set('conditions', condition_set.serialize()) config.set('branch_name', 'review-requests') config.save() return config
def _create_config(self, job_name='job_1', with_local_site=False): """Create an integration config. Args: job_name (string, optional): The Jenkins job name, which is used in constructing the URL to start a build on Jenkins. """ choice = ReviewRequestRepositoriesChoice() condition_set = ConditionSet(conditions=[ Condition(choice=choice, operator=choice.get_operator('any')) ]) if with_local_site: local_site = self.get_local_site(name=self.local_site_name) else: local_site = None config = self.integration.create_config(name='Config 1', enabled=True, local_site=local_site) config.set('conditions', condition_set.serialize()) config.set('jenkins_job_name', job_name) config.set('jenkins_endpoint', 'http://localhost:8000') config.set('jenkins_username', 'admin') config.set('jenkins_password', 'admin') config.save() return config
def _create_config(self, with_local_site=False): """Create an integration config. Args: with_local_site (bool): Whether to limit the config to a local site. """ choice = ReviewRequestRepositoriesChoice() condition_set = ConditionSet(conditions=[ Condition(choice=choice, operator=choice.get_operator('any')) ]) if with_local_site: local_site = self.get_local_site(name=self.local_site_name) else: local_site = None config = self.integration.create_config(name='Config 1', enabled=True, local_site=local_site) config.set('conditions', condition_set.serialize()) config.set('branch_name', 'review-requests') config.save() return config
def _create_config(self, enterprise=False, with_local_site=False): """Create an integration config. Args: enterprise (bool, optional): Whether to use an enterprise endpoint or the default open-source endpoint. with_local_site (bool, optional): Whether to limit the config to a local site. """ choice = ReviewRequestRepositoriesChoice() condition_set = ConditionSet(conditions=[ Condition(choice=choice, operator=choice.get_operator('any')) ]) if with_local_site: local_site = self.get_local_site(name=self.local_site_name) else: local_site = None config = self.integration.create_config(name='Config 1', enabled=True, local_site=local_site) config.set('conditions', condition_set.serialize()) config.set('travis_yml', 'script:\n python ./tests/runtests.py') config.set('branch_name', 'review-requests') if enterprise: config.set('travis_endpoint', TravisAPI.ENTERPRISE_ENDPOINT) config.set('travis_custom_endpoint', 'https://travis.example.com/') else: config.set('travis_endpoint', TravisAPI.OPEN_SOURCE_ENDPOINT) config.save() return config