Me whakarite e au te tikanga mo te whakahiato me te tuku i nga kete rorohiko mai i te putunga Git ki te pae. A, i taku kitenga, kaore i roa i mua, i konei i runga i a Habré tetahi tuhinga mo te buildbot (hono i te mutunga), ka whakatau ahau ki te whakamatau me te whakamahi.
I te mea he punaha toha a buildbot, he mea tika ki te hanga i tetahi kaihautu hanga motuhake mo ia hoahoanga me te punaha whakahaere. I a maatau, ko enei nga ipu LXC (i roto i te keehi o Linux) me te qemu (i te keehi o Windows):
vm-srv-build1 - centos 7, ka noho he rangatira hangahanga me tetahi o nga kaimahi
vm-srv-build2 - debian 10, mo te hanga i nga kohinga DEB
vm-srv-build3 - windows 10, mo te huihuinga, e mohio ana koe mo te aha
Ka kohi matou Rac GUI — he atanga kauwhata mo te 1C rac mo te whakahaere i te roopu o nga kaitoro. Mo Linux, ka whakamahia nga taputapu paerewa mo ia OS; ki te hanga i tetahi konae exe mo Windows mai i te tuhinga tcl, whakamahia takai korekore.
tāutanga
GNU / Linux
He nui nga tuhinga kei runga ipurangi hei whakaurunga 1,2. Ae, a kaore he raruraru motuhake:
Mo te rangatira:
Ae ra, he pai ake te kohi kete mo ia OS, engari kei tua atu i te waahanga o te tuhinga. Ka whakakorehia ano e matou te whakamaarama mo te whakatu ipu mo te mahi, ka mahara noa ahau kei te whakamahi ahau i te ProxMox VE. Ka hiahia hoki koe ki te whakauru i nga kohinga mo ia tuaka e hiahiatia ana mo te huihuinga (centos: rpmdevtools, etc.; debian: build-essential, dh-make, pbuilder, etc.)
Ko nga kaupapa hanga me nga ratonga buildbot ka whakarewahia hei kaiwhakamahi karekau, na me hanga e koe tetahi ki nga kaihautu katoa e uru ana ki te mahi:
adduser buildbot
I muri mai, ka whirihorahia e matou te whakarewatanga aunoa o nga ratonga, i runga i ia o nga kaihautu (pupu):
I muri i tenei, ka taea e koe te hanga i tetahi hanganga whaiaronga mo nga "kaimahi" (i runga i nga ope katoa), ki te mahi i tenei, rehita i raro i te kaiwhakamahi buildbot ka whakahaere i nga whakahau e whai ake nei:
I te ope tuatahi vm-srv-build1:
su - buildbot
mkdir /home/buildbot/worker
cd ~
buildbot-worker create-worker --umask=0o22 --keepalive=60 worker vm-srv-build1:4000 CentOS 123456
I te ope tuarua vm-srv-build2:
su - buildbot
mkdir /home/buildbot/worker
cd ~
buildbot-worker create-worker --umask=0o22 --keepalive=60 worker vm-srv-build1:4000 Debian-10 123456
I runga i nga kaihautu kaimahi, ka taea te timata te mahi hanga-kaimahi
systemctl start buildbot-worker
MS Matapihi
Hei "kaimahi" mo te huihuinga i raro i te Matapihi, ka whakamahia he miihini mariko me te putanga hou o Win10.
Hei mahi ka hiahia koe:
I muri i te whakaurunga o nga mea katoa i runga ake nei, ka taea e koe te whakauru i te buildbot ake:
pip install buildbot-worker
Me hanga he whaiaronga mahi
md c:worker
A kia whakarewa tatou
buildbot-worker start c:worker
Mena ka pai nga mea katoa (tirohia te takiuru c:workertwistd.log), ka taea e koe te rehita i to maatau "kaimahi" hei ratonga ma te taapiri i tetahi mea me te raarangi mahi ki te rehita (ka mahia nga whakahau i roto i te powershell e whakahaere ana hei kaiwhakahaere):
Ko nga mea katoa me nga "kaimahi", kaore koe e pa atu ki a raatau, ko nga mana whakahaere katoa mai i te rangatira.
Tatūnga ruānuku
Hei timata, me hanga e tatou nga hanganga mo te rangatira (i runga i te kaihautu matua), ki te mahi i tenei, rehita i raro i te kaiwhakamahi buildbot ka whakahaere i nga whakahau e whai ake nei:
su - buildbot
mkdir /home/buildbot/master
cd ~
buildbot create-master master
Mo nga kohinga kua rite, hangahia he raarangi hanga
mkdir /home/buildbot/builds
I hangaia he kōnae master.cfg i roto i te whaiaronga /home/buildbot/master/. He waehere python tenei konae kei roto he whakamaarama mo nga tikanga katoa o te punaha; ka mahi tahi tatou me a muri ake nei.
Hei whakaaunoa i te huihuinga o nga kohinga rereke rereke, kia kore ai e uru ki roto i te waehere o te konae master.cfg, i roto i te tuhinga matua o te kaupapa rac_gui.tcl, ko nga rarangi me te putanga o naianei me te tuku i whakauruhia ki te pane. :
A i runga i enei rarangi, ka tatauhia e buildbot nga kete. Hei tango raraunga, whakamahia te waea papatohu grep. I roto i te buildbot kaore e taea e koe te tautuhi i nga taurangi mo nga "kaimahi" (te iti rawa, kaore au i kitea me pehea). Koinei te mea e whakamahia ana nga taonga. Ko era. I roto i te tukanga huihuinga, ka taapirihia e matou nga waahanga ki te whakatau i te putanga me te tuku, a, na reira, ka whakatauhia te putanga me nga taonga tuku. Ka taea te whakarite i nga taonga ki nga huarahi rereke, i tenei keehi ma te karanga i te whakahau papatohu:
# Добавим определение версии из основного файла
rac_gui_build_RPM.addStep(
steps.SetPropertyFromCommand(
command="grep version ../rac-gui/rac_gui.tcl | grep -oE 'b[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}b'", property="version"
)
)
# Добавим определение релиза из основного файла
rac_gui_build_RPM.addStep(
steps.SetPropertyFromCommand(
command="grep release ../rac-gui/rac_gui.tcl | grep -oE 'b[0-9]{1,3}b'", property="release"
)
)
Ka taea e koe te whakakapi i nga uara ka puta ma te waea util.Interpolate().
Hei tautuhi i te tukunga tika me nga tau putanga, whakamahia te waea sed paerewa, i.e. ka whakakapihia e te whakahau nga uara kei roto i te konae motuhake me nga mea e hiahiatia ana
Ka kapehia e matou te kete kua oti te kohikohi me te puranga me nga puna ki te rangatira. Engari ka taea e koe te kape i nga konae mai i to konae mahi ki to putunga, paetukutuku ranei.
# Скопируем файл на мастер
rac_gui_build_RPM.addStep(
steps.FileUpload(
workersrc=util.Interpolate("/home/buildbot/rpmbuild/RPMS/noarch/rac-gui-%(prop:version)s-%(prop:release)s.noarch.rpm"),
masterdest=util.Interpolate("/home/buildbot/builds/rac-gui-%(prop:version)s-%(prop:release)s.noarch.rpm")
)
)
rac_gui_build_RPM.addStep(
steps.FileUpload(
workersrc=util.Interpolate("/home/buildbot/rpmbuild/SOURCES/rac-gui-%(prop:version)s-%(prop:release)s.tar.gz"),
masterdest=util.Interpolate("/home/buildbot/builds/rac-gui-%(prop:version)s-%(prop:release)s.tar.gz")
)
)
Me timata te mahi ki te kape i nga kohinga kua kohia ki te manaaki ma te FTP i runga i te rangatira. Mo tenei kaupapa ka whakamahia tuhinga kei runga tcl.
Koina me te RPM. Inaianei me timata taatau ki te whakaahua i te algorithm mo te hanga i tetahi kete DEB. I te mea ko nga tukanga mo te hanga kete mo nga punaha rereke he mea motuhake tetahi ki tetahi, he maha nga waahanga ka tukuna ano.
rac_gui_build_DEB = util.BuildFactory()
rac_gui_build_DEB.addStep(steps.Git(
repourl = 'https://bitbucket.org/svk28/rac-gui.git',
haltOnFailure = True,
submodules = True,
mode='full',
workdir='build',
progress = True)
)
# Добавим определение версии из основного файла
rac_gui_build_DEB.addStep(
steps.SetPropertyFromCommand(
command="grep version rac_gui.tcl | grep -oE 'b[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}b'", property="version"
)
)
# Добавим определение релиза из основного файла
rac_gui_build_DEB.addStep(
steps.SetPropertyFromCommand(
command="grep release rac_gui.tcl | grep -oE 'b[0-9]{1,3}b'", property="release"
)
)
# Переименуем запускаемый файл
rac_gui_build_DEB.addStep(steps.ShellCommand(
command=["mv", "rac_gui.tcl", "racgui"]))
Mo te kete RPM, ko etahi o nga tikanga e whai ake nei ka mahia e te rpm ano i te wa o te huihuinga ka whakaahuahia i roto i te waahanga; mo Debian, me mahi koe i konei:
# Поменяем пути к библиотекам
rac_gui_build_DEB.addStep(steps.ShellCommand(
command=["sed", "-i", "s+^set dir(lib)+set dir(lib) /usr/share/rac-gui/lib ;#+g", "racgui"]))
# Поменяем пути к файлам
rac_gui_build_DEB.addStep(steps.ShellCommand(
command=["sed", "-i", "s+[pwd]+/usr/share/rac-gui+g", "racgui"]))
# заархивируем исходники
rac_gui_build_DEB.addStep(steps.ShellCommand(
command=["tar", "czf", util.Interpolate("../rac-gui_%(prop:version)s.orig.tar.gz"), "."]))
# Соберём пакет
rac_gui_build_DEB.addStep(steps.ShellCommand(
command=["dpkg-buildpackage"]))
# Скопируем файл на мастер
rac_gui_build_DEB.addStep(
steps.FileUpload(
workersrc=util.Interpolate("../rac-gui_%(prop:version)s-%(prop:release)s_amd64.deb"),
masterdest=util.Interpolate("/home/buildbot/builds/rac-gui_%(prop:version)s-%(prop:release)s_amd64.deb")
)
)
rac_gui_build_DEB.addStep(
steps.MasterShellCommand(
command=["/usr/local/bin/deploy-ftp.tcl",
util.Interpolate("--local-file=/home/buildbot/builds/rac-gui_%(prop:version)s-%(prop:release)s_amd64.deb"),
util.Interpolate("--remote-file=uploads/rac-gui/rac-gui_%(prop:version)s-%(prop:release)s_amd64.deb")]
)
)
Tiakina te kōnae ka taea e koe te ngana ki te timata i te ratonga ruānuku:
systemctl restart buildbot-master
I roto i te raarangi ka tirohia kei te pai nga mea katoa me te whirihora me te mahi o nga mea katoa. Me hono nga kaimahi katoa inaianei, ka harikoa te panui ki te raarangi »»'/home/buildbot/master/twistd.log»»':
2019-07-24 16:50:35+0300 [-] Loading buildbot.tac...
2019-07-24 16:50:35+0300 [-] Loaded.
2019-07-24 16:50:35+0300 [-] twistd 19.2.1 (/usr/bin/python3.6 3.6.8) starting up.
2019-07-24 16:50:35+0300 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2019-07-24 16:50:35+0300 [-] Starting BuildMaster -- buildbot.version: 2.3.1
2019-07-24 16:50:35+0300 [-] Loading configuration from '/home/buildbot/master/master.cfg'
2019-07-24 16:50:36+0300 [-] /usr/local/lib/python3.6/site-packages/buildbot/config.py:90: buildbot.config.ConfigWarning: [0.9.0 and later] `buildbotNetUsageData` is not configured and defaults to basic.
This parameter helps the buildbot development team to understand the installation base.
No personal information is collected.
Only installation software version info and plugin usage is sent.
You can `opt-out` by setting this variable to None.
Or `opt-in` for more information by setting it to "full".
2019-07-24 16:50:36+0300 [-] Setting up database with URL 'sqlite:/state.sqlite'
2019-07-24 16:50:36+0300 [-] setting database journal mode to 'wal'
2019-07-24 16:50:36+0300 [-] adding 1 new services, removing 0
2019-07-24 16:50:36+0300 [-] adding 1 new change_sources, removing 0
2019-07-24 16:50:36+0300 [-] gitpoller: using workdir '/home/buildbot/master/gitpoller-work'
2019-07-24 16:50:36+0300 [-] adding 3 new builders, removing 0
2019-07-24 16:50:36+0300 [-] adding 1 new schedulers, removing 0
2019-07-24 16:50:36+0300 [-] initializing www plugin 'waterfall_view'
2019-07-24 16:50:36+0300 [-] initializing www plugin 'console_view'
2019-07-24 16:50:36+0300 [-] initializing www plugin 'grid_view'
2019-07-24 16:50:36+0300 [-] NOTE: www plugin 'sitenav' is installed but not configured
2019-07-24 16:50:36+0300 [-] initializing www plugin 'waterfall_view'
2019-07-24 16:50:36+0300 [-] initializing www plugin 'console_view'
2019-07-24 16:50:36+0300 [-] initializing www plugin 'grid_view'
2019-07-24 16:50:36+0300 [-] NOTE: www plugin 'sitenav' is installed but not configured
2019-07-24 16:50:36+0300 [-] BuildbotSite starting on 80
2019-07-24 16:50:36+0300 [-] Starting factory <buildbot.www.service.BuildbotSite object at 0x7fe31c2657b8>
2019-07-24 16:50:36+0300 [-] adding 3 new workers, removing 0
2019-07-24 16:50:36+0300 [-] PBServerFactory starting on 4000
2019-07-24 16:50:36+0300 [-] Starting factory <twisted.spread.pb.PBServerFactory object at 0x7fe31c147470>
2019-07-24 16:50:37+0300 [-] BuildMaster is running
2019-07-24 16:50:37+0300 [-] buildbotNetUsageData: sending {'installid': 'b6193b126b96689351d2fe95787c5a03fc0879f9', 'versions': {'Python': '3.6.8', 'Buildbot': '2.3.1', 'Twisted': '19.2.1'}, 'platform': {'platform': 'Linux-4.15.18-10- pve-x86_64-with-centos-7.6.1810-Core', 'system': 'Linux', 'machine': 'x86_64', 'processor': 'x86_64', 'python_implementation': 'CPython', 'version': '#1 SMP PVE 4.15.18-32', 'distro': 'centos:7'}, 'plugins': {'buildbot/worker/base/Worker': 3, 'buildbot/config/BuilderConfig': 3, 'buildbot/schedulers/basic/SingleBranchScheduler': 1, 'buildbot/reporters/mail/MailNotifier': 1, 'buildbot/changes/gitpoller/GitPoller': 1, 'buildbot/steps/worker/MakeDirectory': 1, 'buildbot/steps/source/git/Git': 3, 'buildbot/steps/shell/ShellCommand': 9, 'buildbot/steps/package/rpm/rpmbuild/RpmBuild': 1}, 'db': 'sqlite', 'mq': 'simple', 'www_plugins': ['waterfall_view', 'console_view', 'grid_view']}
2019-07-24 16:50:37+0300 [Broker,0,127.0.0.1] worker 'CentOS' attaching from IPv4Address(type='TCP', host='127.0.0.1', port=37332)
2019-07-24 16:50:37+0300 [Broker,0,127.0.0.1] Got workerinfo from 'CentOS'
2019-07-24 16:50:37+0300 [-] bot attached
2019-07-24 16:50:37+0300 [Broker,0,127.0.0.1] Worker CentOS attached to Rac-GUI-RPM-builder
2019-07-24 16:50:37+0300 [-] buildbotNetUsageData: buildbot.net said: ok
2019-07-24 16:50:39+0300 [Broker,1,192.168.55.15] worker 'Windows-10' attaching from IPv4Address(type='TCP', host='192.168.5.145', port=49831)
2019-07-24 16:50:39+0300 [Broker,1,192.168.55.15] Got workerinfo from 'Windows-10'
2019-07-24 16:50:40+0300 [-] bot attached
2019-07-24 16:50:40+0300 [Broker,1,192.168.55.15] Worker Windows-10 attached to Rac-GUI-WIN-builder
2019-07-24 16:50:41+0300 [Broker,2,192.168.55.99] worker 'Debian-10' attaching from IPv4Address(type='TCP', host='192.168.5.9', port=44430)
2019-07-24 16:50:41+0300 [Broker,2,192.168.55.99] Got workerinfo from 'Debian-10'
2019-07-24 16:50:41+0300 [-] bot attached
2019-07-24 16:50:41+0300 [Broker,2,192.168.55.99] Worker Debian-10 attached to Rac-GUI-DEB-builder
Ka whakaoti tenei i te tukanga tatūnga. Ka taea e koe te tiro i te ahuatanga o naianei ma te atanga tukutuku. Ka taea hoki e koe te kite i nga hapa hanga, whana i te tukanga tio mena kua he tetahi mea, aha atu.
I muri tonu i te whakarewatanga, ka taea te tiro i a tatou kaimahi pakeke ma te tahua "Hanga" -> "Kaimahi"
Ka oti te tukanga hanga tuatahi (arā, ko nga huringa ki te putunga Git), ka puta te mana o nga tukanga ki te wharangi tuatahi.
Mena ka paatohia e koe te raina e hiahiatia ana me te kiore, ka tuwhera he wharangi me te ahua o tenei wa o tenei wa, ka kite koe i nga mea kei te tupu, he aha nga hapa, aha atu.