Rename the snapshot functions and add gocd config

This commit is contained in:
Stephan Kulow 2019-03-27 14:36:11 +01:00
parent 7932e11134
commit f3b3549a35
7 changed files with 262 additions and 69 deletions

View File

@ -239,18 +239,6 @@ Requires(pre): shadow
%description staging-bot %description staging-bot
Staging bot services and system user. Staging bot services and system user.
%package totest-manager
Summary: Manages product ToTest repository
Group: Development/Tools/Other
BuildArch: noarch
# TODO Update requirements.
Requires: osclib = %{version}
Requires: python2-openqa_client
Requires: python2-pika
%description totest-manager
Manages product ToTest repository workflow and openQA interaction
%package pkglistgen %package pkglistgen
Summary: Generates package lists in 000product Summary: Generates package lists in 000product
Group: Development/Tools/Other Group: Development/Tools/Other
@ -424,20 +412,6 @@ exit 0
%postun staging-bot %postun staging-bot
%systemd_postun %systemd_postun
%pre totest-manager
getent passwd osrt-totest-manager > /dev/null || \
useradd -r -m -s /sbin/nologin -c "user for openSUSE-release-tools-totest-manager" osrt-totest-manager
exit 0
%postun totest-manager
%systemd_postun
if [ -x /usr/bin/systemctl ] ; then
instances=($(systemctl list-units -t service --full | grep -oP osrt-totest-manager@[^.]+ || true))
if [ ${#instances[@]} -gt 0 ] ; then
systemctl try-restart --no-block ${instances[@]}
fi
fi
%postun pkglistgen %postun pkglistgen
%systemd_postun %systemd_postun
@ -466,6 +440,7 @@ fi
%{_bindir}/osrt-sync-rebuild %{_bindir}/osrt-sync-rebuild
%{_bindir}/osrt-unmaintained %{_bindir}/osrt-unmaintained
%{_bindir}/osrt-staging-installcheck %{_bindir}/osrt-staging-installcheck
%{_bindir}/osrt-totest-manager
%{_datadir}/%{source_dir} %{_datadir}/%{source_dir}
%exclude %{_datadir}/%{source_dir}/abichecker %exclude %{_datadir}/%{source_dir}/abichecker
%exclude %{_datadir}/%{source_dir}/%{announcer_filename} %exclude %{_datadir}/%{source_dir}/%{announcer_filename}
@ -485,7 +460,6 @@ fi
%exclude %{_datadir}/%{source_dir}/repo_checker.pl %exclude %{_datadir}/%{source_dir}/repo_checker.pl
%exclude %{_datadir}/%{source_dir}/repo_checker.py %exclude %{_datadir}/%{source_dir}/repo_checker.py
%exclude %{_datadir}/%{source_dir}/suppkg_rebuild.py %exclude %{_datadir}/%{source_dir}/suppkg_rebuild.py
%exclude %{_datadir}/%{source_dir}/totest-manager.py
%exclude %{_datadir}/%{source_dir}/osclib %exclude %{_datadir}/%{source_dir}/osclib
%exclude %{_datadir}/%{source_dir}/osc-check_dups.py %exclude %{_datadir}/%{source_dir}/osc-check_dups.py
%exclude %{_datadir}/%{source_dir}/osc-cycle.py %exclude %{_datadir}/%{source_dir}/osc-cycle.py
@ -626,13 +600,6 @@ fi
%{_unitdir}/osrt-staging-bot-support-rebuild@.service %{_unitdir}/osrt-staging-bot-support-rebuild@.service
%{_unitdir}/osrt-staging-bot-support-rebuild@.timer %{_unitdir}/osrt-staging-bot-support-rebuild@.timer
%files totest-manager
%defattr(-,root,root,-)
%{_bindir}/osrt-totest-manager
%{_datadir}/%{source_dir}/totest-manager.py
%{_unitdir}/osrt-totest-manager@.service
%{_unitdir}/osrt-totest-manager@.timer
%files pkglistgen %files pkglistgen
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_bindir}/osrt-pkglistgen %{_bindir}/osrt-pkglistgen

3
gocd/generate.sh Executable file
View File

@ -0,0 +1,3 @@
for file in *.erb; do
erb -T - $file > $(basename $file .erb)
done

View File

@ -0,0 +1,212 @@
format_version: 3
pipelines:
TTM.Factory:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Factory
TTM.Factory_ARM:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Factory:ARM
TTM.Factory_PowerPC:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Factory:PowerPC
TTM.Factory_zSystems:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Factory:zSystems
TTM.Leap_15.0_Images:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Leap:15.0:Images
TTM.Leap_15.1_Images:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Leap:15.1:Images
TTM.Leap_15.1_ARM_Images:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Leap:15.1:ARM:Images
TTM.Leap_15.1:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Leap:15.1
TTM.Leap_15.1_ARM:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Leap:15.1:ARM
TTM.Leap_15.1_PowerPC:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run openSUSE:Leap:15.1:PowerPC

View File

@ -0,0 +1,27 @@
format_version: 3
pipelines:
<% for project in %w(openSUSE:Factory openSUSE:Factory:ARM openSUSE:Factory:PowerPC
openSUSE:Factory:zSystems openSUSE:Leap:15.0:Images openSUSE:Leap:15.1:Images
openSUSE:Leap:15.1:ARM:Images openSUSE:Leap:15.1 openSUSE:Leap:15.1:ARM openSUSE:Leap:15.1:PowerPC) -%>
TTM.<%= project.gsub('openSUSE:', '').gsub(':', '_') %>:
group: openSUSE.Checkers
lock_behavior: unlockWhenFinished
environment_variables:
OSC_CONFIG: /home/go/config/oscrc-totest-manager
materials:
script:
git: https://github.com/openSUSE/openSUSE-release-tools.git
destination: scripts
timer:
spec: 0 */15 * ? * *
only_on_changes: false
stages:
- Run:
approval: manual
resources:
- staging-bot
tasks:
- script: |-
install -D /home/go/config/openqa-client.conf /home/go/.config/openqa/client.conf
scripts/totest-manager.py -A https://api.opensuse.org --osc-debug --debug run <%= project %>
<% end -%>

View File

@ -1,8 +0,0 @@
[Unit]
Description=openSUSE Release Tools: ToTest Manager for %i
[Service]
User=osrt-totest-manager
SyslogIdentifier=osrt-totest-manager
WorkingDirectory=~
ExecStart=/usr/bin/osrt-totest-manager --verbose run "%i"

View File

@ -1,9 +0,0 @@
[Unit]
Description=openSUSE Release Tools: ToTest Manager for %i
[Timer]
OnBootSec=15min
OnUnitActiveSec=5m
[Install]
WantedBy=timers.target

View File

@ -89,12 +89,12 @@ class ToTestManager(ToolBase.ToolBase):
def totest(self, project): def totest(self, project):
self.setup(project) self.setup(project)
try: try:
current_snapshot = self.get_current_snapshot() current_snapshot = self.version_from_totest_project()
except NotFoundException as e: except NotFoundException as e:
# nothing in test project (yet) # nothing in test project (yet)
self.logger.warn(e) self.logger.warn(e)
current_snapshot = None current_snapshot = None
new_snapshot = self.current_sources() new_snapshot = self.version_from_project()
self.update_pinned_descr = False self.update_pinned_descr = False
current_result = self.overall_result(current_snapshot) current_result = self.overall_result(current_snapshot)
current_qa_version = self.current_qa_version() current_qa_version = self.current_qa_version()
@ -157,7 +157,7 @@ class ToTestManager(ToolBase.ToolBase):
def release(self, project): def release(self, project):
self.setup(project) self.setup(project)
new_snapshot = self.current_sources() new_snapshot = self.version_from_project()
self.update_totest(new_snapshot) self.update_totest(new_snapshot)
def write_version_to_dashboard(self, target, version): def write_version_to_dashboard(self, target, version):
@ -194,18 +194,17 @@ class ToTestManager(ToolBase.ToolBase):
raise NotFoundException("can't find %s version" % self.project) raise NotFoundException("can't find %s version" % self.project)
def current_sources(self): def version_from_project(self):
if self.project.take_source_from_product is None: if not self.project.take_source_from_product:
raise Exception('No idea where to take the source version from')
if self.project.take_source_from_product:
if self.project.is_image_product:
return self.iso_build_version(self.project.name, self.project.image_products[0].package,
arch=self.project.image_products[0].archs[0])
return self.iso_build_version(self.project.name, self.project.main_products[0])
else:
return self.release_version() return self.release_version()
if len(self.project.main_products):
return self.iso_build_version(self.project.name, self.project.main_products[0])
#assert(self.project.is_image_product)
return self.iso_build_version(self.project.name, self.project.image_products[0].package,
arch=self.project.image_products[0].archs[0])
def binaries_of_product(self, project, product, repo=None, arch=None): def binaries_of_product(self, project, product, repo=None, arch=None):
if repo is None: if repo is None:
repo = self.project.product_repo repo = self.project.product_repo
@ -225,11 +224,13 @@ class ToTestManager(ToolBase.ToolBase):
return ret return ret
def get_current_snapshot(self): def version_from_totest_project(self):
if self.project.is_image_product: if len(self.project.main_products):
return self.iso_build_version(self.project.test_project, self.project.image_products[0].package, return self.iso_build_version(self.project.test_project, self.project.main_products[0])
arch=self.project.image_products[0].archs[0])
return self.iso_build_version(self.project.test_project, self.project.main_products[0]) return self.iso_build_version(self.project.test_project, self.project.image_products[0].package,
arch=self.project.image_products[0].archs[0])
def ftp_build_version(self, project, tree): def ftp_build_version(self, project, tree):
for binary in self.binaries_of_product(project, tree): for binary in self.binaries_of_product(project, tree):