Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to package and build code for python jenkins

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to package and build code for python jenkins, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Python jenkins package build code # pip install python-jenkinsimport jenkinsimport pprintimport time# under jenkins's Configure Global Security, uncheck "prevent cross-site request forgery (Prevent Cross Site Request Forgery exploits)" server = jenkins.Jenkins ('http://192.168.100.151:8081', username='admin', password='admin') # next build idjenkins_next_build_number = server.get_job_info ("test") [' nextBuildNumber'] # start building build_job (self, name Parameters=None, token=None) parameters can add the parameter server.build_job ("test", parameters= {'version':' 1.0.2') "env": "test"}) time.sleep (10) while True: time.sleep (1) if server.get_job_info ("test") ['lastCompletedBuild'] [' number'] = = jenkins_next_build_number: print ("- build completed -") Break result = server.get_build_console_output ("test" Jenkins_next_build_number) print (result) info = server.get_build_info ("test") Jenkins_next_build_number) print (f "build time {int (info ['duration']) / 1000} seconds") if server.get_job_info ("test") [' lastCompletedBuild'] ['number'] = =\ server.get_job_info ("test") [' lastSuccessfulBuild'] ['number']: print ("build successful") else: print ("build failed") about how python jenkins packages The answer to the question of building the code is shared here. I hope the above content can help you to a certain extent, if you still have a lot of doubts to be solved, you can follow the industry information channel to learn more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report