How to use get_job_info method in autotest

Best Python code snippet using autotest_python

build_private.py

Source:build_private.py Github

copy

Full Screen

...19def build_package(branch, tar):20 os.environ['PYTHONHTTPSVERIFY'] = '0'21 server = jenkins.Jenkins('https://cd.myones.net/', jenkins_user_name, jenkins_token_cd)22 project_name = f'development/generate-package/tar-{tar}/{branch}'23 build_history = server.get_job_info(project_name)['builds']24 if len(build_history) > 0:25 build_num_1 = server.get_job_info(project_name)['builds'][0]['number']26 else:27 build_num_1 = 028 server.build_job(project_name)29 if build_num_1 == 0:30 while True:31 build_new = server.get_job_info(project_name)['builds']32 if len(build_new) > 0:33 build_num = server.get_job_info(project_name)['builds'][0]['number']34 success = str(server.get_build_console_output(project_name, build_num))[-8:-1]35 if success == 'SUCCESS' or success == 'FAILURE':36 break37 else:38 time.sleep(10)39 else:40 time.sleep(10)41 else:42 while True:43 build_num = server.get_job_info(project_name)['builds'][0]['number']44 if build_num != build_num_1:45 success = str(server.get_build_console_output(project_name, build_num))[-8:-1]46 if success == 'SUCCESS' or success == 'FAILURE':47 break48 else:49 time.sleep(10)50 else:51 time.sleep(10)52 if success == 'SUCCESS':53 SUCCESS_list.append(tar)54 else:55 FAILURE_list.append(56 f'https://cd.myones.net/job/development/job/generate-package/job/tar-{tar}/job/{branch}/')57def build_image(branch, tag_list: list):58 os.environ['PYTHONHTTPSVERIFY'] = '0'59 server = jenkins.Jenkins('https://marsdev-ci.myones.net/', jenkins_user_name, jenkins_token_ci)60 project_name = f'build-image-v2'61 build_num_1 = server.get_job_info(project_name)['builds'][0]['number']62 parameters = {'projectApiBranch': 'master',63 'projectWebBranch': 'master',64 'wikiApiBranch': 'master',65 'wikiWebBranch': 'master',66 'thirdImportTag': 'v1.0.7',67 'devopsBranch': 'master',68 'auditlogSyncTag': 'master',69 'mobileWebTag': '3.6.x_integration',70 'binlogSyncTag': 'master',71 'ones_platform_api': 'master',72 'ones_plugin_hostboot': 'master',73 'ones_plugin': 'master',74 'ones_plugin_node': 'master',75 'enablePerformancePro': 'true',76 'supersetBranch': 'master',77 'biSyncBranch': 'master',78 'project_migrations': '',79 'wiki_migrations': '',80 'wizEditorBranch': 'master',81 'wizEditorConvertBranch': 'master',82 '': '',83 'onesAIDockerVersion': 'master',84 'baseImageVersion': 'v1.0.19',85 'onesDataCollectorBranch': 'master',86 'plugin_service_proxy': 'master',87 'mysqlOperator': 'S1092',88 'kafkaBackup': 'kafka-backup-dev-v0.0.5'89 }90 for i in tag_list:91 parameters[change[i]] = branch92 server.build_job(project_name, parameters)93 while True:94 build_num = server.get_job_info(project_name)['builds'][0]['number']95 if build_num != build_num_1:96 break97 else:98 time.sleep(10)99 while True:100 success = str(server.get_build_console_output(project_name, build_num))[-8:-1]101 if success == 'SUCCESS' or success == 'FAILURE':102 break103 else:104 time.sleep(10)105 version = str(server.get_build_console_output(project_name, build_num)).split('\n')[22][-9:]106 if success == 'SUCCESS':107 return version108 else:109 return False110def build_install_pak(version):111 os.environ['PYTHONHTTPSVERIFY'] = '0'112 server = jenkins.Jenkins('https://marsdev-ci.myones.net/', jenkins_user_name, jenkins_token_ci)113 project_name = f'build-install-pak'114 build_num_1 = server.get_job_info(project_name)['builds'][0]['number']115 parameters = {'parameters': 'master',116 'version': version,117 'certificate': 'master_cn'}118 server.build_job(project_name, parameters)119 while True:120 build_num = server.get_job_info(project_name)['builds'][0]['number']121 if build_num != build_num_1:122 break123 else:124 time.sleep(10)125 while True:126 success = str(server.get_build_console_output(project_name, build_num))[-8:-1]127 if success == 'SUCCESS' or success == 'FAILURE':128 break129 else:130 time.sleep(10)131 return success132def build_create_test_env(branch, version, config='--'):133 os.environ['PYTHONHTTPSVERIFY'] = '0'134 server = jenkins.Jenkins('https://marsdev-ci.myones.net/', jenkins_user_name, jenkins_token_ci)135 project_name = f'create-test-env'136 build_num_1 = server.get_job_info(project_name)['builds'][0]['number']137 parameters = {'instance_name': branch,138 'version': version,139 'onesConfigureInitExtraParams': config}140 server.build_job(project_name, parameters)141 while True:142 build_num = server.get_job_info(project_name)['builds'][0]['number']143 if build_num != build_num_1:144 break145 else:146 time.sleep(10)147 while True:148 success = str(server.get_build_console_output(project_name, build_num))[-8:-1]149 if success == 'SUCCESS' or success == 'FAILURE':150 break151 else:152 time.sleep(10)153 return success154SUCCESS_list = []155FAILURE_list = []156def build_private(branch, tag_list):...

Full Screen

Full Screen

job_info.py

Source:job_info.py Github

copy

Full Screen

...18 key = 'IRISJOB:%s:%s'%(job_id, service_name)19 self.job_status[key] = {'job_id': job_id, 'service_name': service_name, 'start_time': datetime.now(), 'host_name': self._get_host_name(), 'host_ip': self._get_host_ip()}20 return self.job_status[key]21 22 def get_job_info(self, job_id=None, service_name=None):23 key = 'IRISJOB:%s:%s'%(job_id, service_name)24 if job_id is None or service_name is None:25 return self.job_status26 elif key in self.job_status:27 return self.job_status[key]28 else:29 return None30 31 def del_job_info(self, job_id=None, service_name=None):32 key = 'IRISJOB:%s:%s'%(job_id, service_name)33 if key in self.job_status:34 return self.job_status.pop(key)35 else:36 return None37 38 def get_job_status(self, job_id=None, service_name=None):39 job_status = self.get_job_info(job_id=job_id, service_name=service_name)40 if job_status:41 return StepStatus.RUNNING.value42 return None43 44 45if __name__=='__main__':46 from pprint import pprint47 48 class T1(threading.Thread):49 50 def __init__(self):51 threading.Thread.__init__(self)52 self.a = JobInfo()53 self.a.set_job_info('1', 'afm')54 self.a.set_job_info('2', 'ag')55 56 def run(self):57 print('T1')58 pprint(self.a.get_job_info())59 #time.sleep(10)60 61 class T2(threading.Thread):62 63 def __init__(self):64 threading.Thread.__init__(self)65 self.b = JobInfo()66 self.b.set_job_info('3', 'sc')67 68 def run(self):69 print('T2')70 pprint(self.b.get_job_info())71 t1 = T1()72 t1.start()73 time.sleep(1)74 t2 = T2()75 t2.start()76 77 time.sleep(1)78 c = JobInfo()79 print('Delete C')80 pprint(c.del_job_info('3', 'sc'))81 print('All C')82 pprint(c.get_job_info())83 ...

Full Screen

Full Screen

jenkinsManager.py

Source:jenkinsManager.py Github

copy

Full Screen

...27 CONFIG.USERID_AND_APITOKEN_173[0],28 CONFIG.USERID_AND_APITOKEN_173[1]29 )30 if jobName in CONFIG.SLAVELIST_173:31 # print server.get_job_info(jobName)['property'][4]['parameterDefinitions']32 parameterDefinitionsList = server.get_job_info(jobName)['property'][4]['parameterDefinitions']33 else:34 # print server.get_job_info(jobName)['property'][5]['parameterDefinitions']35 parameterDefinitionsList = server.get_job_info(jobName)['property'][5]['parameterDefinitions']36 for i in parameterDefinitionsList:37 parameterList.append(i['name'])...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful