热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

python持续集成_python有什么好用的持续集成工具么?

python的有比较强悍,google等公司在用的构建框架buidbot。另外python也有jenkinsAPI。python相关的库参考下:buil

python的有比较强悍,google等公司在用的构建框架buidbot。另外python也有jenkins API。

python相关的库参考下:

buildbot - google等公司使用的持续集成框架,上手比Jenkins难,功能和性能远比Jenkins强大。 链接 python库介绍-buildbot教程

BitBake – 嵌入式Linux上类似make工具。链接

buildout – 用于从多个部分创建,组装和部署应用程序的构建系统。链接

PlatformIO – 在不同的开发平台的控制台构建工具。链接

PyBuilder – 纯Python编写的持续构建工具。链接

SCons – 软件构建工具。链接

jenkinsapi – Hudson & Jenkins python API。链接

另外我个人觉得python一个强悍的地方在于很容易自行开发出构建工具, 参见 china-testing/python-api-tesing以下python库在自行开发构建工具时比较常用。

DevOps工具(DevOps Tools)DevOps的软件和库。*

Ansible - 极其简单的IT自动化平台。 --推荐

Cloud-Init - 处理云实例的早期初始化的多分发包。

cuisine - 为 Fabric 提供一系列高级函数。

Fabric - 简单的Pythonic远程执行和部署工具。 --推荐

Fabtools - 编写真棒Fabric文件的工具。

nova - OpenStack计算。 --推荐

swift - OpenStack存储。 --推荐

pexpect - 在像GNU expect这样的伪终端中控制交互式程序。 --强烈推荐

psutil - 跨平台的进行和系统实用程序模块。 --推荐

SaltStack - 基础设施自动化和管理系统。 --推荐

supervisor - 用于UNIX的Supervisor进程控制系统。

gitapi:Git 的纯 Python API。官网

hgapi:Mercurial 的纯 Python API。官网

honcho:Foreman 的 Python 克隆版,用来管理基于 Procfile 的应用。官网

全栈 Web 框架。Django:Python 界最流行的 web 框架。链接 wesome-django系列 链接 --强烈推荐

Flask:Python 微型框架。链接 awesome-flask系列 链接 --强烈推荐 python web框架第一名

pyramid:一个小巧,快速,接地气的开源Python web 框架。链接 awesome-pyramid系列 链接

Bottle:一个快速小巧,轻量级的 WSGI 微型 web 框架。链接 --推荐

CherryPy:一个极简的 Python web 框架,支持HTTP/1.1 协议且具有WSGI 线程池。链接

sanic:python3 快速的web服务器,类似flask。链接 --推荐

web.py:既简单,又强大的web 框架。链接

TurboGears:易于扩展的全栈微框架。链接

web2py:全栈 web 框架和平台,用于安全数据库访问的web用。链接

Tornado - web 框架和异步网络库. 链接人工智能医药中医:python库介绍-buildbot教程​zhuanlan.zhihu.com

Buildbot是python实现的开源持续构建和持续交付工具,为Python, Mozilla, Chromium, WebKit等知名项目使用。

与Jenkins相比,Buildbot在大陆使用者较少。原因在于Jenkins的界面相对较美观,更容易上手;Jenkins的中文文档比较丰富。但是Jenkins因为资源消耗庞大、不太方便定制而不受一些有实力的公司欢迎。这些不少把目光聚焦在Buildbot。

究竟Buildbot有哪些优点让这些公司青睐呢?Buildbot基于python网络框架Twisted,分布式做得好。Buildbot可以直接使用python包,轻松拥有上万库,具备强大的扩展能力。如果你觉得Jenkins已经轻松地满足你的需求,你不需要Buildbot。如果你在Jenkins时觉得效率低下、扩展困难、一些用python等脚本可以实现的动作在Jenkins困难重重,那么可以看看Buildbot。

Buildbot是开源的自动化软件构建,测试,发布流程的框架。

Buildbot支持跨平台,分布式,并行执行jobs,与版本控制系统的灵活集成,丰富的状态报告等等。

Buildbot是一个作业调度系统:它会对作业进行排队,在所需要的资源可用时执行任务,并报告结果。

Buildbot有一个或多个主机和从机。主机监控源代码库的变化,调配从机,并给用户和开发者报告结果。从机可在多种操作系统上运行。

可以配置Python脚本到主机。这个脚本可以简单到只配置内置组件,也可以充分发挥python所长,可以动态生成的配置,定制的组件及其他任何你能想到的。

该框架基于Twisted实现,并与所有主要的操作系统兼容。

Buildbot支持持续集成,持续部署,发布管理等的。Buildbot支持持续集成测试,自动化复杂的编译系统,应用程序部署和复杂的软件发布流程管理。比CruiseControl或Jenkins更适合混合语言的环境。在 Chromium,WebKit, Firefox, Python和Twisted等有广泛的使用。

缺点:buildbot对多项目支持并不好。参考资料:

安装

目的

本教程从零开始,尽可能快地运行您的第一个buildbot master和worker,而不会更改默认配置。

本教程假设您正在运行Linux,但可能适用于Windows。

准备

#!python

pip3 install buildbot

pip3 install buildbot-www

pip3 install buildbot-grid-view

pip3 install buildbot-console_view

pip3 install buildbot-worker

pip3 install setuptools-trial

创建master

#!python

$ buildbot create-master master

mkdir /opt/master

creating /opt/master/master.cfg.sample

creating database (sqlite:///state.sqlite)

buildmaster configured in /opt/master

$ mv master/master.cfg.sample master/master.cfg

$ buildbot start master

Following twistd.log until startup finished..

The buildmaster appears to have (re)started correctly.

日志在master/twistd.log

此时访问 http://localhost:8010/

创建worker

#!python

$ buildbot-worker create-worker worker localhost example-worker pass

mkdir /opt/worker

mkdir /opt/worker/info

Creating info/admin, you need to edit it appropriately.

Creating info/host, you need to edit it appropriately.

Not creating info/access_uri - add it if you wish

Please edit the files in /opt/worker/info appropriately.

worker configured in /opt/worker

$ buildbot-worker start worker

Following twistd.log until startup finished..

The buildbot-worker appears to have (re)started correctly.

日志在worker/twistd.log

快速入门

本章从china-testing拉取代码,调用pytest执行buildbot/hello-world/hello下的单元测试。

配置项目名和URL

#!python

$ vi master/master.cfg

# -*- python -*-

# ex: set filetype=python:

from buildbot.plugins import *

# This is a sample buildmaster config file. It must be installed as

# 'master.cfg' in your buildmaster's base directory.

# This is the dictionary that the buildmaster pays attention to. We also use

# a shorter alias to save typing.

c = BuildmasterConfig = {}

####### WORKERS

# The 'workers' list defines the set of recognized workers. Each element is

# a Worker object, specifying a unique worker name and password. The same

# worker name and password must be configured on the worker.

c['workers'] = [worker.Worker("example-worker", "pass")]

# 'protocols' contains information about protocols which master will use for

# communicating with workers. You must define at least 'port' option that workers

# could connect to your master with this protocol.

# 'port' must match the value configured into the workers (with their

# --master option)

c['protocols'] = {'pb': {'port': 9989}}

####### CHANGESOURCES

# the 'change_source' setting tells the buildmaster how it should find out

# about source code changes. Here we point to the buildbot version of a python hello-world project.

c['change_source'] = []

c['change_source'].append(changes.GitPoller(

'git://github.com/china-testing/python-api-tesing.git',

workdir='gitpoller-workdir', branch='master',

pollinterval=300))

####### SCHEDULERS

# Configure the Schedulers, which decide how to react to incoming changes. In this

# case, just kick off a 'runtests' build

c['schedulers'] = []

c['schedulers'].append(schedulers.SingleBranchScheduler(

name="all",

change_filter=util.ChangeFilter(branch='master'),

treeStableTimer=None,

builderNames=["runtests"]))

c['schedulers'].append(schedulers.ForceScheduler(

name="force",

builderNames=["runtests"]))

####### BUILDERS

# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:

# what steps, and which workers can execute them. Note that any particular build will

# only take place on one worker.

factory = util.BuildFactory()

# check out the source

factory.addStep(steps.Git(repourl='git://github.com/china-testing/python-api-tesing.git', mode='incremental'))

# run the tests (note that this will require that 'trial' is installed)

factory.addStep(steps.ShellCommand(command=["pytest", "buildbot/hello-world/hello"]))

c['builders'] = []

c['builders'].append(

util.BuilderConfig(name="runtests",

workernames=["example-worker"],

factory=factory))

####### BUILDBOT SERVICES

# 'services' is a list of BuildbotService items like reporter targets. The

# status of each build will be pushed to these targets. buildbot/reporters/*.py

# has a variety to choose from, like IRC bots.

c['services'] = []

####### PROJECT IDENTITY

# the 'title' string will appear at the top of this buildbot installation's

# home pages (linked to the 'titleURL').

c['title'] = "Hello World CI"

c['titleURL'] = "https://github.com/china-testing/python-api-tesing"

# the 'buildbotURL' string should point to the location where the buildbot's

# internal web server is visible. This typically uses the port number set in

# the 'www' entry below, but with an externally-visible host name which the

# buildbot cannot figure out without some help.

c['buildbotURL'] = "http://localhost:8010/"

# minimalistic config to activate new web UI

c['www'] = dict(port=8010,

plugins=dict(waterfall_view={}, console_view={}, grid_view={}))

####### DB URL

c['db'] = {

# This specifies what database buildbot uses to store its state. You can leave

# this at its default for all but the largest installations.

'db_url' : "sqlite:///state.sqlite",

}

$ $ buildbot reconfig master

sending SIGHUP to process 4194

b'2018-01-24 15:13:07+0800 [-] beginning configuration update'

b"2018-01-24 15:13:07+0800 [-] Loading configuration from '/opt/master/master.cfg'"

b'2018-01-24 15:13:07+0800 [-] /usr/local/lib/python3.5/dist-packages/buildbot/config.py:102: buildbot.config.ConfigWarning: [0.9.0 and later] `buildbotNetUsageData` is not configured and defaults to basic.'

b'\tThis parameter helps the buildbot development team to understand the installation base.'

b'\tNo personal information is collected.'

b'\tOnly installation software version info and plugin usage is sent.'

b'\tYou can `opt-out` by setting this variable to None.'

b'\tOr `opt-in` for more information by setting it to "full".'

b'\t'

b"2018-01-24 15:13:07+0800 [-] gitpoller: using workdir '/opt/master/gitpoller-workdir'"

b"2018-01-24 15:13:08+0800 [-] initializing www plugin 'waterfall_view'"

b"2018-01-24 15:13:08+0800 [-] initializing www plugin 'console_view'"

b"2018-01-24 15:13:08+0800 [-] initializing www plugin 'grid_view'"

b'2018-01-24 15:13:08+0800 [-] configuration update complete'

Reconfiguration appears to have completed successfully

首次构建

打开:http://localhost:8010/#/builders

点击右上角的force,表单可以什么都不填,点击“Start Build”就会开始构建。

很快可以看到输出:

#!python

SESSION=ubuntu

SESSIONTYPE=gnome-session

SESSION_MANAGER=local/andrew-MS-7A71:@/tmp/.ICE-unix/2824,unix/andrew-MS-7A71:/tmp/.ICE-unix/2824

SHELL=/bin/bash

SHLVL=1

SSH_AUTH_SOCK=/run/user/1000/keyring/ssh

TERM=xterm

TMDB_API_KEY=ee6623075bcc5519ef16be16e1f139e7

UPSTART_EVENTS=xsession started

UPSTART_INSTANCE=

UPSTART_JOB=unity7

UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/2570

USER=andrew

XAUTHORITY=/home/andrew/.Xauthority

XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg

XDG_CURRENT_DESKTOP=Unity

XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/snapd/desktop

XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/andrew

XDG_MENU_PREFIX=gnome-

XDG_RUNTIME_DIR=/run/user/1000

XDG_SEAT=seat0

XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0

XDG_SESSION_DESKTOP=ubuntu

XDG_SESSION_ID=c2

XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0

XDG_SESSION_TYPE=x11

XDG_VTNR=7

XMODIFIERS=@im=fcitx

_=/usr/local/bin/buildbot-worker

using PTY: False

============================= test session starts ==============================

platform linux2 -- Python 2.7.12, pytest-2.8.7, py-1.4.31, pluggy-0.3.1

rootdir: /opt/worker/runtests/build/buildbot/hello-world, inifile:

collected 2 items

buildbot/hello-world/hello/test_hello.py ..

=========================== 2 passed in 0.01 seconds ===========================

program finished with exit code 0

elapsedTime=0.168047

欢迎 关注 点赞,谢谢!

zhouaimei1​www.zhihu.com



推荐阅读
  • SAPC/4HANA与人工智能和增强现实(AR)技术结合的又一个创新案例
    今天这篇迟到的文章,来自我的同事Aviva。去年SAPC4HANA发布之后,SAP的从业者们可能或多或少都读过一些来自SAP官方渠道,比如微信公众号"SA ... [详细]
  • 如何在服务器主机上实现文件共享的方法和工具
    本文介绍了在服务器主机上实现文件共享的方法和工具,包括Linux主机和Windows主机的文件传输方式,Web运维和FTP/SFTP客户端运维两种方式,以及使用WinSCP工具将文件上传至Linux云服务器的操作方法。此外,还介绍了在迁移过程中需要安装迁移Agent并输入目的端服务器所在华为云的AK/SK,以及主机迁移服务会收集的源端服务器信息。 ... [详细]
  • CentOS7.8下编译muduo库找不到Boost库报错的解决方法
    本文介绍了在CentOS7.8下编译muduo库时出现找不到Boost库报错的问题,并提供了解决方法。文章详细介绍了从Github上下载muduo和muduo-tutorial源代码的步骤,并指导如何编译muduo库。最后,作者提供了陈硕老师的Github链接和muduo库的简介。 ... [详细]
  • ShiftLeft:将静态防护与运行时防护结合的持续性安全防护解决方案
    ShiftLeft公司是一家致力于将应用的静态防护和运行时防护与应用开发自动化工作流相结合以提升软件开发生命周期中的安全性的公司。传统的安全防护方式存在误报率高、人工成本高、耗时长等问题,而ShiftLeft提供的持续性安全防护解决方案能够解决这些问题。通过将下一代静态代码分析与应用开发自动化工作流中涉及的安全工具相结合,ShiftLeft帮助企业实现DevSecOps的安全部分,提供高效、准确的安全能力。 ... [详细]
  • 在本教程中,我们将看到如何使用FLASK制作第一个用于机器学习模型的RESTAPI。我们将从创建机器学习模型开始。然后,我们将看到使用Flask创建AP ... [详细]
  • k8s+springboot+Eureka如何平滑上下线服务
    k8s+springboot+Eureka如何平滑上下线服务目录服务平滑上下线-k8s版本目录“上篇介绍了springboot+Euraka服务平滑上下线的方式,有部分小伙伴反馈k ... [详细]
  • 面条|发生_做到这7点,避免微服务落地失败
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了做到这7点,避免微服务落地失败相关的知识,希望对你有一定的参考价值。 ... [详细]
  • AndroidWeeklyhttp:androidweekly.net这份免费的周报里面应有尽有,包括文章、教程、视频和Git ... [详细]
  • 这一点|主文_fabricSDKgo初探
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了fabric-SDK-go初探相关的知识,希望对你有一定的参考价值。1.环境安装本教程不会 ... [详细]
  • 安卓select模态框样式改变_微软Office风格的多端(Web、安卓、iOS)组件库——Fabric UI...
    介绍FabricUI是微软开源的一套Office风格的多端组件库,共有三套针对性的组件,分别适用于web、android以及iOS,Fab ... [详细]
  • Google Play推出全新的应用内评价API,帮助开发者获取更多优质用户反馈。用户每天在Google Play上发表数百万条评论,这有助于开发者了解用户喜好和改进需求。开发者可以选择在适当的时间请求用户撰写评论,以获得全面而有用的反馈。全新应用内评价功能让用户无需返回应用详情页面即可发表评论,提升用户体验。 ... [详细]
  • 本文介绍了Linux系统中正则表达式的基础知识,包括正则表达式的简介、字符分类、普通字符和元字符的区别,以及在学习过程中需要注意的事项。同时提醒读者要注意正则表达式与通配符的区别,并给出了使用正则表达式时的一些建议。本文适合初学者了解Linux系统中的正则表达式,并提供了学习的参考资料。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 提供:ZStack云计算原创2016-12-26张鑫讲师介绍张鑫ZStack总架构师、联合创始人《系统虚拟化》主要作者,曾任职Intel开源软件技术中心 ... [详细]
  • 本文整理了Java中org.eclipse.jgit.api.DeleteTagCommand类的一些代码示例,展示了DeleteTagCommand ... [详细]
author-avatar
fseiei
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有