本文介绍了如何使用buildbot创建每日构建文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想保存每晚构建的副本,我认为将每个构建放入其自己的日常文件夹中将是一个好主意。但是我不能使用来自buildbot master.cfg的时间,因为它是在配置时设置的:
I want to save a copy of the nightly build, I figured putting each build into its own daily folder would be idea. However I cannot use the time from buildbot master.cfg because that it set when it is configured:
copy_files = [".\\release\\MyProgram.exe",
".\\install\\ChangeLog.js",
".\\translations.txt"]
server_dest_path_by_date = server_dest_path + "\\{0}".format(time.strftime("%Y-%m-%d"))
my_return.addStep(steps.MakeDirectory(dir=server_dest_path_by_date))
for file in copy_files:
my_return.addStep(ShellCommand(command=["copy", file, server_dest_path_by_date, "/y"]))
如何获取当前在目的地使用的运行日期?
How would I get the current run date for use in the destination?
推荐答案
您需要在运行时在构建配置中将日期设置为属性。做这样的事情:
You need to set the date as a Property during runtime in your build config. Do something like this:
my_return.addStep(SetPropertyFromCommand(
property = 'dateRightNow',
command = ['python', '-c', '"import datetime;print datetime.datetime.now().strftime('%y-%m-%d')"']
))
对于Python 3.6:
For Python 3.6:
my_return.addStep(SetPropertyFromCommand(
property = 'dateRightNow',
command = ['python', '-c', 'import datetime;print(datetime.datetime.now().strftime("%y-%m-%d"))']
))
然后使用以下属性:
my_return.addStep(steps.MakeDirectory(
dir=Interpolate('%(prop:dateRightNow)s')))
for file in copy_files:
my_return.addStep(ShellCommand(command=["copy", file, Interpolate('%(prop:dateRightNow)s'), "/y"]))
请确保将Interpolate和setPropertyFromCommand导入:
Make sure you import Interpolate and setPropertyFromCommand unto:
from buildbot.process.properties import Interpolate
from buildbot.steps.shell import SetPropertyFromCommand
这篇关于如何使用buildbot创建每日构建文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!