Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kanku for openSUSE:Factory checked in at 2022-06-23 10:24:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kanku (Old) and /work/SRC/openSUSE:Factory/.kanku.new.1548 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kanku" Thu Jun 23 10:24:16 2022 rev:13 rq:984400 version:0.12.6 Changes: -------- --- /work/SRC/openSUSE:Factory/kanku/kanku.changes 2022-06-16 18:20:33.776109895 +0200 +++ /work/SRC/openSUSE:Factory/.kanku.new.1548/kanku.changes 2022-06-23 10:24:57.671785028 +0200 @@ -1,0 +2,14 @@ +Wed Jun 22 07:54:03 UTC 2022 - fschrei...@suse.com + +- Update to version 0.12.6: + * [dist] updated KankuFile.ubuntu to jammy + * [dist] updated KankuFile.ubuntu to focal + * [examples] new KankuFile for vmdk + * [cli] up: removed debug output + * [core] fixed kanku job sostw + * [core] updated TODO + * [cli] up: new job handling + * [handler] added K::H::CopyProfile + * added changelog to kanku-common and kanku-cli + +------------------------------------------------------------------- Old: ---- kanku-0.12.5.tar.xz New: ---- kanku-0.12.6.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kanku.spec ++++++ --- /var/tmp/diff_new_pack.WIUGHh/_old 2022-06-23 10:24:58.163785562 +0200 +++ /var/tmp/diff_new_pack.WIUGHh/_new 2022-06-23 10:24:58.167785567 +0200 @@ -22,7 +22,7 @@ Name: kanku # Version gets set by obs-service-tar_scm -Version: 0.12.5 +Version: 0.12.6 Release: 0 License: GPL-3.0-only Summary: Development and continuous integration ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.WIUGHh/_old 2022-06-23 10:24:58.215785619 +0200 +++ /var/tmp/diff_new_pack.WIUGHh/_new 2022-06-23 10:24:58.219785623 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/M0ses/kanku.git</param> - <param name="changesrevision">afca1927e9f2c742b67d5a849748b8a1deb03f48</param></service></servicedata> + <param name="changesrevision">aa10ff86f4b3b2d24c6fcaec7ae04b076d7a3140</param></service></servicedata> (No newline at EOF) ++++++ debian.changelog ++++++ --- /var/tmp/diff_new_pack.WIUGHh/_old 2022-06-23 10:24:58.235785640 +0200 +++ /var/tmp/diff_new_pack.WIUGHh/_new 2022-06-23 10:24:58.239785645 +0200 @@ -1,4 +1,4 @@ -kanku (0.12.5-0) UNRELEASED; urgency=medium +kanku (0.12.6-0) UNRELEASED; urgency=medium * updated to upstream version 0.10.1 ++++++ debian.dsc ++++++ --- /var/tmp/diff_new_pack.WIUGHh/_old 2022-06-23 10:24:58.279785688 +0200 +++ /var/tmp/diff_new_pack.WIUGHh/_new 2022-06-23 10:24:58.283785693 +0200 @@ -2,7 +2,7 @@ Source: kanku Binary: kanku Architecture: any -Version: 0.12.5 +Version: 0.12.6 Maintainer: Frank Schreiner <fschrei...@suse.de> Standards-Version: 3.8.2 Homepage: https://github.com/M0ses/kanku ++++++ kanku-0.12.5.tar.xz -> kanku-0.12.6.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/KankuFile.d/devel.yml new/kanku-0.12.6/KankuFile.d/devel.yml --- old/kanku-0.12.5/KankuFile.d/devel.yml 2022-06-03 17:02:45.000000000 +0200 +++ new/kanku-0.12.6/KankuFile.d/devel.yml 2022-06-22 10:09:52.000000000 +0200 @@ -31,6 +31,12 @@ - use_module: Kanku::Handler::PrepareSSH - + use_module: Kanku::Handler::CopyProfile + options: + users: + - root + - kanku + - use_module: Kanku::Handler::ExecuteCommandViaSSH options: commands: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/KankuFile.d/server-openSUSE-Tumbleweed.yml new/kanku-0.12.6/KankuFile.d/server-openSUSE-Tumbleweed.yml --- old/kanku-0.12.5/KankuFile.d/server-openSUSE-Tumbleweed.yml 2022-06-03 17:02:45.000000000 +0200 +++ new/kanku-0.12.6/KankuFile.d/server-openSUSE-Tumbleweed.yml 2022-06-22 10:09:52.000000000 +0200 @@ -47,6 +47,7 @@ - make -C /tmp/kanku install 2>&1 |tee /tmp/make.log - /usr/bin/kanku setup --apache --distributed --ssl 2>&1 |tee /tmp/setup-server.log - cp /tmp/kanku/etc/jobs/examples/obs-server.yml /etc/kanku/jobs/ + - systemctl enable --now kanku-iptables - systemctl enable --now kanku-web - systemctl enable --now kanku-worker - systemctl enable --now kanku-dispatcher diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/KankuFile.examples/KankuFile.vmdk new/kanku-0.12.6/KankuFile.examples/KankuFile.vmdk --- old/kanku-0.12.5/KankuFile.examples/KankuFile.vmdk 1970-01-01 01:00:00.000000000 +0100 +++ new/kanku-0.12.6/KankuFile.examples/KankuFile.vmdk 2022-06-22 10:09:52.000000000 +0200 @@ -0,0 +1,34 @@ +domain_name: kanku-leap-vmdk +default_job: kanku-job +login_user: root +login_pass: kankudai + +jobs: + kanku-job: + - + use_module: Kanku::Handler::SetJobContext + options: + host_interface: eth0 + - + use_module: Kanku::Handler::OBSCheck + options: + api_url: https://api.opensuse.org/public + project: devel:kanku:images + repository: images_leap_15_4 + package: openSUSE-Leap-15.4-JeOS + use_oscrc: 0 + - + use_module: Kanku::Handler::ImageDownload + - + use_module: Kanku::Handler::CreateDomain + options: + memory: 2097152 + vcpu: 2 + use_9p: 1 + - + use_module: Kanku::Handler::PrepareSSH + - + use_module: Kanku::Handler::ExecuteCommandViaSSH + options: + commands: + - echo "my test here" > /tmp/test.log diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/KankuFile.ubuntu new/kanku-0.12.6/KankuFile.ubuntu --- old/kanku-0.12.5/KankuFile.ubuntu 2022-06-03 17:02:45.000000000 +0200 +++ new/kanku-0.12.6/KankuFile.ubuntu 2022-06-22 10:09:52.000000000 +0200 @@ -22,7 +22,7 @@ options: project: devel:kanku:images repository: images_ubuntu - package: ubuntu-JeOS + package: ubuntu-jammy skip_all_checks: 1 use_oscrc: 0 preferred_extension: qcow2 @@ -39,7 +39,7 @@ use_module: Kanku::Handler::ExecuteCommandViaConsole options: commands: - - echo "deb http://archive.ubuntu.com/ubuntu bionic main universe" > /etc/apt/sources.list + - echo "deb http://archive.ubuntu.com/ubuntu jammy main universe" > /etc/apt/sources.list - apt-get update - apt-get install -y openssh-server - @@ -51,10 +51,10 @@ - apt-get install -y build-essential vim vim-common fakeroot dh-make less git-buildpackage devscripts locales - locale-gen de_DE.UTF-8 # BEGIN of real installation process for kanku - - echo "deb https://download.opensuse.org/repositories/devel:/kanku:/staging/xUbuntu_18.04/ ./" > /etc/apt/sources.list.d/kanku.list - - echo "deb https://download.opensuse.org/repositories/devel:/kanku:/perl:/deb/xUbuntu_18.04/ ./" >> /etc/apt/sources.list.d/kanku.list - - curl https://download.opensuse.org/repositories/devel:/kanku:/perl:/deb/xUbuntu_18.04/Release.key|apt-key add - - - curl https://download.opensuse.org/repositories/devel:/kanku:/staging/xUbuntu_18.04/Release.key|apt-key add - + - echo "deb https://download.opensuse.org/repositories/devel:/kanku:/staging/xUbuntu_22.04/ ./" > /etc/apt/sources.list.d/kanku.list + - echo "deb https://download.opensuse.org/repositories/devel:/kanku:/perl:/deb/xUbuntu_22.04/ ./" >> /etc/apt/sources.list.d/kanku.list + - curl https://download.opensuse.org/repositories/devel:/kanku:/perl:/deb/xUbuntu_22.04/Release.key|apt-key add - + - curl https://download.opensuse.org/repositories/devel:/kanku:/staging/xUbuntu_22.04/Release.key|apt-key add - - apt-get update - apt-get install -y kanku - usermod -a -G sudo kanku diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/TODO new/kanku-0.12.6/TODO --- old/kanku-0.12.5/TODO 2022-06-03 17:02:45.000000000 +0200 +++ new/kanku-0.12.6/TODO 2022-06-22 10:09:52.000000000 +0200 @@ -1,30 +1 @@ -* [DOC] Howto setup kanku more secure - * https (via apache) - * regular user priviliges - -* [UI] - * Make Logs available in web - * implement request_role - -* [DIST] - * Restore port forward on reboot - * create packages for Ubuntu/Debian - -* [CLI] commands to implement: - * devel - * snapshot - shutdown VM, remove old snapshots, take a current snapshot - * revert - revert to last snapshot - * server - * trigger - trigger job on remote instance - * history - local history - * ci - commit job definition to remote server - * co - checkout job definition from remote server - -* [CLI] implement storage per project ( $PRJDIR/.kanku ) - -* [BACKEND] - * systemd service file for kanku-scheduler - * systemd service file for kanku.psig/plackup - -* [REFACTOR] - * cli commands should have process_template method +PLEASE SEE [Kanku Issues](https://github.com/M0ses/kanku/issues) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/dist/kanku.spec new/kanku-0.12.6/dist/kanku.spec --- old/kanku-0.12.5/dist/kanku.spec 2022-06-03 17:02:45.000000000 +0200 +++ new/kanku-0.12.6/dist/kanku.spec 2022-06-22 10:09:52.000000000 +0200 @@ -580,3 +580,7 @@ /usr/share/icons/hicolor/64x64/apps/kanku.png %changelog + +%changelog cli + +%changelog common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/etc/templates/cmd/setup/kanku-config.yml.tt2 new/kanku-0.12.6/etc/templates/cmd/setup/kanku-config.yml.tt2 --- old/kanku-0.12.5/etc/templates/cmd/setup/kanku-config.yml.tt2 2022-06-03 17:02:45.000000000 +0200 +++ new/kanku-0.12.6/etc/templates/cmd/setup/kanku-config.yml.tt2 2022-06-22 10:09:52.000000000 +0200 @@ -145,4 +145,28 @@ [% ELSE %] # Kanku::Handler::CreateDomain: # pool_name: mypool + +Kanku::Handler::CopyProfile: + user: kanku + tasks: + - cmd: cp + src: ~/.gitconfig + - cmd: cp + src: ~/.vimrc + - cmd: cp + src: ~/.vim/ + recursive: 1 + #- cmd: mkdir + # path: ~/.config/ + #- cmd: cp + # src: ~/.config/osc/ + # dst: ~/.config/osc/ + # recursive: 1 + #- cmd: chown + # owner: kanku:users + # recursive: 1 + # path: ~/.config/ + #- cmd: chmod + # mode: 700 + # path: ~/.config/ [% END %] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/lib/Kanku/Cli/up.pm new/kanku-0.12.6/lib/Kanku/Cli/up.pm --- old/kanku-0.12.5/lib/Kanku/Cli/up.pm 2022-06-03 17:02:45.000000000 +0200 +++ new/kanku-0.12.6/lib/Kanku/Cli/up.pm 2022-06-22 10:09:52.000000000 +0200 @@ -45,10 +45,10 @@ ); option 'job_name' => ( - isa => 'Str', + isa => 'ArrayRef', is => 'rw', cmd_aliases => 'j', - documentation => 'job to run', + documentation => 'jobs to run', ); option 'pool' => ( @@ -98,7 +98,7 @@ $logger->debug(__PACKAGE__ . '->execute()'); - $self->job_name($cfg->config->{default_job}) if ! $self->job_name; + $self->job_name([$cfg->config->{default_job}]) if ! $self->job_name; my $dn = $self->domain_name; my $vm = Kanku::Util::VM->new( domain_name => $dn, @@ -120,54 +120,65 @@ my $job_config = $cfg->job_config($self->job_name); croak("No such job found\n") if ! $job_config; - - my $ds = $schema->resultset('JobHistory')->create({ - name => $self->job_name, - creation_time => time, - last_modified => time, - state => 'triggered', - }); - - my $job = Kanku::Job->new( - db_object => $ds, - id => $ds->id, - state => $ds->state, - name => $ds->name, - skipped => 0, - scheduled => 0, - triggered => 0, - context => { - domain_name => $dn, - login_user => $cfg->config->{login_user}, - login_pass => $cfg->config->{login_pass}, - offline => $self->offline || 0, - skip_all_checks => $self->skip_all_checks || 0, - skip_check_project => $self->skip_check_project || 0, - skip_check_package => $self->skip_check_package || 0, - log_file => $self->log_file, - log_stdout => $self->log_stdout, - }, - ); - @ARGV=(); ## no critic (Variables::RequireLocalizedPunctuationVars) - Kanku::Config->initialize(); - if ($self->pool) { - Kanku::Config->instance->cf->{'Kanku::Handler::CreateDomain'}->{pool_name} = $self->pool; - } - my $dispatch = Kanku::Dispatch::Local->new(schema=>$schema); - my $result = $dispatch->run_job($job); - my $ctx = $job->context; - if ( $result->state eq 'succeed' ) { - $logger->info('domain_name : ' . ( $ctx->{domain_name} || q{})); - $logger->info('ipaddress : ' . ( $ctx->{ipaddress} || q{})); - } elsif ( $result->state eq 'skipped' ) { - $logger->warn('Job was skipped'); - $logger->warn('Please see log to find out why'); + my $jobs = []; + if ($self->job_name eq '__ALL__' && ref($cfg->config->{jobs}->{__ALL__}) eq 'ARRAY') { + $jobs = $cfg->config->{jobs}->{__ALL__}; + } elsif (ref($self->job_name) eq 'ARRAY') { + $jobs = $self->job_name; } else { - $logger->error('Failed to create domain: ' . ( $ctx->{domain_name} || q{})); - $logger->error("ipaddress : $ctx->{ipaddress}") if $ctx->{ipaddress}; - }; + $jobs->[0] = $self->job_name; + } + for my $jname (@$jobs) { + next if ($jname == 1); + my $ds = $schema->resultset('JobHistory')->create({ + name => $jname, + creation_time => time, + last_modified => time, + state => 'triggered', + }); + + my $job = Kanku::Job->new( + db_object => $ds, + id => $ds->id, + state => $ds->state, + name => $ds->name, + skipped => 0, + scheduled => 0, + triggered => 0, + context => { + domain_name => $dn, + login_user => $cfg->config->{login_user}, + login_pass => $cfg->config->{login_pass}, + offline => $self->offline || 0, + skip_all_checks => $self->skip_all_checks || 0, + skip_check_project => $self->skip_check_project || 0, + skip_check_package => $self->skip_check_package || 0, + log_file => $self->log_file, + log_stdout => $self->log_stdout, + }, + ); + @ARGV=(); ## no critic (Variables::RequireLocalizedPunctuationVars) + Kanku::Config->initialize(); + if ($self->pool) { + Kanku::Config->instance->cf->{'Kanku::Handler::CreateDomain'}->{pool_name} = $self->pool; + } + my $dispatch = Kanku::Dispatch::Local->new(schema=>$schema); + my $result = $dispatch->run_job($job); + my $ctx = $job->context; + if ( $result->state eq 'succeed' ) { + $logger->info('domain_name : ' . ( $ctx->{domain_name} || q{})); + $logger->info('ipaddress : ' . ( $ctx->{ipaddress} || q{})); + } elsif ( $result->state eq 'skipped' ) { + $logger->warn('Job was skipped'); + $logger->warn('Please see log to find out why'); + } else { + $logger->error('Failed to create domain: ' . ( $ctx->{domain_name} || q{})); + $logger->error("ipaddress : $ctx->{ipaddress}") if $ctx->{ipaddress}; + return 1; + }; + } - return; + return 0; } __PACKAGE__->meta->make_immutable; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kanku-0.12.5/lib/Kanku/Handler/CopyProfile.pm new/kanku-0.12.6/lib/Kanku/Handler/CopyProfile.pm --- old/kanku-0.12.5/lib/Kanku/Handler/CopyProfile.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/kanku-0.12.6/lib/Kanku/Handler/CopyProfile.pm 2022-06-22 10:09:52.000000000 +0200 @@ -0,0 +1,192 @@ +# Copyright (c) 2016 SUSE LLC +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program (see the file COPYING); if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# +package Kanku::Handler::CopyProfile; + +use Moose; +use namespace::autoclean; +use Carp qw(croak); +use File::Glob qw(:globally); +use File::Find; + +use Kanku::Config; + +with 'Kanku::Roles::Handler'; +with 'Kanku::Roles::SSH'; + +has commands => (is=>'rw', isa=>'ArrayRef', default => sub {[]}); +has _results => (is=>'rw', isa=>'ArrayRef', default => sub {[]}); +has users => (is=>'rw', isa=>'ArrayRef', default => sub {[]}); +has timeout => (is=>'rw',isa=>'Int',lazy=>1,default=>60*60*4); + +has environment => (is=>'rw', isa=>'HashRef', default => sub {{}}); +has context2env => (is=>'rw', isa=>'HashRef', default => sub {{}}); + + +sub distributable { 0 } + +sub execute { + my ($self) = @_; + my $ip = $self->ipaddress; + my $ctx = $self->job->context; + my $cfg = Kanku::Config->instance(); + my $pkg = __PACKAGE__; + my $profile = $cfg->cf->{$pkg}; + my $cmds = { + cp => sub { $self->cp($_[0]) }, + chown => sub { $self->chown($_[0]) }, + chmod => sub { $self->chmod($_[0]) }, + mkdir => sub { $self->mkdir($_[0]) }, + }; + + for my $user (@{$self->users}) { + $self->username($user); + if (ref($profile->{tasks}) ne 'ARRAY') { + return { + code => 0, + message => "No proper config found. Skipping!", + subresults => [{command => 'None', exit_status => 0, message => 'Skipped!'}], + }; + } + + my $tasks = $profile->{tasks}; + for my $task (@{$tasks}) { + croak("Found unknown command '$task->{cmd}' in your '$pkg' config") unless (ref($cmds->{$task->{cmd}}) eq 'CODE'); + $cmds->{$task->{cmd}}->($task); + }; + } + return { + code => 0, + message => "All commands on $ip executed successfully", + subresults => $self->_results + }; +} + +sub cp { + my ($self, $task) = @_; + my $pkg = __PACKAGE__; + my $src = $task->{src} || croak("No src paramter given in your config"); + my $dst = $task->{dst} || $src; + my $rec = ($task->{recursive})?'-r':q{}; + my $usr = $self->username || 'root'; + my $ctx = $self->job()->context(); + my $cmd = "scp $rec -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null $src $usr\@$ctx->{ipaddress}:$dst"; + $self->logger->info("Executing command: $cmd"); + my @out = `$cmd`; + + push @{$self->_results}, { + command => $cmd, + exit_status => 0, + message => "@out", + }; +} + +sub chown { + my ($self, $task) = @_; + my $rec = ($task->{recursive}) ? '-R' : q{}; + my $cmd = "chown $rec $task->{owner} $task->{path}"; + $self->_cmd($cmd); +} + +sub chmod { + my ($self, $task) = @_; + my $rec = ($task->{recursive}) ? '-R' : q{}; + my $cmd = "chmod $rec $task->{mode} $task->{path}"; + $self->_cmd($cmd); +} + +sub mkdir { + my ($self, $task) = @_; + my $cmd = "mkdir -p $task->{path}"; + $self->_cmd($cmd); +} + +sub _cmd { + my ($self, $cmd) = @_; + my $ssh2 = $self->connect; + my $out = $self->exec_command($cmd); + + my @err = $ssh2->error(); + if ($err[0]) { + $ssh2->disconnect(); + die "Error while executing command via ssh '$cmd': $err[2]"; + } + + push @{$self->_results}, { + command => $cmd, + exit_status => 0, + message => $out + }; +} + + +__PACKAGE__->meta->make_immutable; + +1; + +__END__ + +=head1 NAME + +Kanku::Handler::ExecuteCommandViaSSH + +=head1 SYNOPSIS + +Here is an example how to configure the module in your jobs file or KankuFile + + - + use_module: Kanku::Handler::ExecuteCommandViaSSH + options: + context2env: + ipaddress: + environment: + test: value + publickey_path: /home/m0ses/.ssh/id_rsa.pub + privatekey_path: /home/m0ses/.ssh/id_rsa + passphrase: MySecret1234 + username: kanku + ipaddress: 192.168.199.17 + commands: + - rm /etc/shadow + +=head1 DESCRIPTION + +This handler will connect to the ipaddress stored in job context and excute the configured commands + + +=head1 OPTIONS + + commands : array of commands to execute + + +SEE ALSO L<Kanku::Roles::SSH> + + +=head1 CONTEXT + +=head2 getters + +SEE ALSO L<Kanku::Roles::SSH> + +=head2 setters + +NONE + +=head1 DEFAULTS + +SEE ALSO L<Kanku::Roles::SSH> + +=cut