[英]python tox, creating rpm virtualenv, as part of ci pipeline, unsure about where in workflow
I'm investigating how Python applications can also use a CI pipeline, but I'm not sure how to create the standard work-flow. 我正在研究Python应用程序如何也可以使用CI管道,但是我不确定如何创建标准工作流程。
Jenkins is used to do the initial repository clone, and then initiates tox. Jenkins用于进行初始存储库克隆,然后启动tox。 Basically this is where maven, and/or msbuild, would get dependency packages and build.... which tox does via pip, so all good here. 基本上,这是maven和/或msbuild可以获取依赖包并进行构建的地方。...tox通过pip来完成,因此在这里一切都很好。
But now for the confusing part, the last part of the pipeline is creating and uploading packages. 但是现在令人困惑的是,管道的最后一部分是创建和上传软件包。 Devs would likely upload created packages to a local pip repository, BUT then also possibly create a deployment package. 开发人员可能会将创建的程序包上传到本地pip存储库,然后可能还会创建部署程序包。 In this case it would need to be an RPM containing a virtualenv of the application. 在这种情况下,它将需要是一个包含应用程序虚拟环境的RPM。 I have made one manually using rpmvenev, but regardless of how its made, how what such a step be added to a tox config? 我已经使用rpmvenev手动制作了一个,但是不管它是如何制作的,如何将这样的步骤添加到tox配置中? In the case if rpmvenv, it creates its own virtualenv, a self contained command so to speak. 在rpmvenv的情况下,它会创建自己的virtualenv,可以说这是一个自包含的命令。
I like going with the Unix philosophy for this problem. 我喜欢使用Unix哲学解决这个问题。 Have a tool that does one thing incredibly well, then compose other tools together. 拥有一个可以出色地完成一件事情的工具,然后将其他工具组合在一起。 Tox is purpose built to run your tests in a bunch of different python environments so using it to then build a deb / rpm / etc for you I feel is a bit of a misuse of that tool. Tox旨在在一系列不同的python环境中运行测试,因此使用它来为您构建deb / rpm / etc等,我觉得这是对该工具的误用。 It's probably easier to use tox just to run all your tests then depending on the results have another step in your pipeline deal with building a package for what was just tested. 仅使用tox来运行所有测试可能会更容易,然后根据结果在您的管道中又迈出了一步,即为刚刚测试的内容构建程序包。
Jenkins 2.x which is fairly recent at the time of this writing seems to be much better about building pipelines. 在撰写本文时,Jenkins 2.x似乎是最新的,它似乎在构建管道方面要好得多。 BuildBot is going through a decent amount of development and already makes it fairly easy to build a good pipeline for this as well. BuildBot正在经历大量的开发,并且已经相当容易为此建立良好的管道。
What we've done at my work is 我们在工作中所做的是
That deb package is also just available as a build artifact, similar to what Jenkins 1.x would do. 该deb包也可以作为构建工件使用,类似于Jenkins 1.x所做的事情。 Once we're ready to go to staging, we just take that package and promote it to the staging debian repo manually. 一旦准备好进行登台,我们只需获取该软件包并将其手动升级到登台的debian repo。 Ditto for rolling it to prod. 同上,将其滚动到产品。
Tools I've found useful for all this: 我发现所有这些有用的工具:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.