pzim / reaktor Goto Github PK
View Code? Open in Web Editor NEWReaktor is a modular post-receive hook designed to work with r10k
License: Other
Reaktor is a modular post-receive hook designed to work with r10k
License: Other
I might take a whack at merging the jenkins-infra/jenkins-infra
Using Zack's r10k MCollective agent would allow to contact all Puppetmasters without having to list them.
Gitlab is used anywhere there is a lock down environment. It would be nice to have gitlab support built in. There are a few ruby gems that integrate with the gitlab web api already, so this should be somewhat trial.
root@puppet:~/reaktor# rake start
rake aborted!
LoadError: cannot load such file -- resque-retry
/root/reaktor/lib/reaktor/jobs/event.rb:2:in <top (required)>' /root/reaktor/lib/reaktor/event_jobs.rb:3:in
module:EventJobs'
/root/reaktor/lib/reaktor/event_jobs.rb:2:in <module:Reaktor>' /root/reaktor/lib/reaktor/event_jobs.rb:1:in
<top (required)>'
/root/reaktor/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
.. instead of deamonize.
As per issue #7 reaktor requires a :ref for a module in the Puppetfile.
gsub!(pattern, replacement) will return nil
if it doesn't find a substitution. see http://ruby-doc.org/core-2.1.4/String.html#method-i-gsub-21
Therefore, if you don't match regex
correctly the value for new_contents
becomes nil
and that is passed as contents
to write_new_puppetfile(contents)
and you end up with an empty Puppetfile.
https://github.com/pzim/reaktor/blob/master/lib/reaktor/r10k/puppetfile.rb
# update the module ref in Puppetfile
#
# @param module_name - The module to change the ref for
# @param branchname - The ref to change for the module
def update_module_ref(module_name, branchname)
pfile = loadFile
regex = /(#{module_name}(\.git)+['"],)+(\s*):ref\s*=>\s*['"](\w+|\w+\.\d+\.\d+)['"]/m
new_contents = pfile.gsub!(regex, """\\1\\3:ref => '#{branchname}'""".strip)
end
There needs to be some defensive code in here to exit the process if the new_contents
is nil after new_contents = pfile.gsub!(regex, """\\1\\3:ref => '#{branchname}'""".strip)
I think something along the lines of:
# update the module ref in Puppetfile
#
# @param module_name - The module to change the ref for
# @param branchname - The ref to change for the module
def update_module_ref(module_name, branchname)
pfile = loadFile
regex = /(#{module_name}(\.git)+['"],)+(\s*):ref\s*=>\s*['"](\w+|\w+\.\d+\.\d+)['"]/m
new_contents = pfile.gsub!(regex, """\\1\\3:ref => '#{branchname}'""".strip)
if new_contents
contents = new_contents
else
logger.info("In #{self} could not find module :ref for #{module_name} on #{branchname}")
exit # I dont know if there needs to be any clean up code here or if `exit` is the correct method
end
contents
end
Hello,
can i make it to work with simple gitolite?
Regards,
DJ
Hey - thank you for making this!
For some reason, when I post from Gitlab I get a crazy amount of stuff in the console, probably a thousand lines of stack trace. The most important pieces are:
/var/lib/gems/2.3.0/gems/multi_json-1.13.1/lib/multi_json/adapters/oj.rb:34: [BUG] Segmentation fault at 0x00000000000000
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
-- Other runtime information -----------------------------------------------
* Loaded script: resque-1.25.2: Waiting for resque_modify
* Loaded features:
You may have encountered a bug in the Ruby interpreter or extension libraries.
Any idea what might be going on here?
i'm trying to cleanup/enhance the code a little bit and it's unclear to me if the ActionController in gitaction/action_controller.rb
is ever used... i grepped the source in didn't find any use of it.
so i my current understanding is that it could be removed but i'm not 100% sure... feedback welcome
thanks
toni
root@puppet:~/reaktor# rake start
rake aborted!
LoadError: cannot load such file -- resque-retry
/root/reaktor/lib/reaktor/jobs/event.rb:2:in `<top (required)>'
/root/reaktor/lib/reaktor/event_jobs.rb:3:in `<module:EventJobs>'
/root/reaktor/lib/reaktor/event_jobs.rb:2:in `<module:Reaktor>'
/root/reaktor/lib/reaktor/event_jobs.rb:1:in `<top (required)>'
/root/reaktor/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
root@puppet:~/reaktor# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
Currently, it is a manual process to stop the resque workers (kill -QUIT). Need to automate the shutdown using a single rake task or similar means.
The gitlab and stash code are very similar and should be consolidated into a single solution to remove the redundant code.
Create an installable gem so that users do not need to clone the repo. This will ease the ability to create a puppet module to maintain reaktor itself, plus make manual upgrades a little smoother.
If I would like to create a feature branch, e.g. 'feature/example', reaktor does only take the first part of the name, which is 'feature' in this example. It strips everything after the '/'.
Need to detail how the code operates on the Puppetfile (dynamic branch creation and file manipulation). Also need to add details around the 3 possible events recognized (create, update, delete) and what happens in each scenario.
In puppetfile.rb, PUPPETFILE_GIT_URL should be REAKTOR_PUPPETFILE_GIT_URL.
running rake start gives the following error
Errno::ENOENT: No such file or directory - /data/apps/sinatra/reaktor/reaktor.log
os details -
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
At first glance RACK_ENV is not documented. Maybe it should take current working directory if it's possible (instead of /data/apps/sinatra/reaktor).
The current version supports GitHub/GitHub Enterprise. Need to add documentation on how to add support for additional git sources.
I've been poking around a little, and I haven't quite figured out how to point the hipchat integrations at an internally hosted hipchat beta. All the API stuff is the same, just need to be able to modify the base url.
I made a Puppetfile lens so you could do that: hercules-team/augeas@e32c7d5
Using that, you could just update a module ref with:
set mod[.="#{module_name}"]/ref "#{ref}"
At first glance it's not mandatory to supply a :ref for a module in the R10K Puppetfile.
For now reaktor seems to work well only if a :ref has been specified.
It's not a big issue and the workaround is simple since we only have to add a :ref to all module in the R10K Puppetfile and the regex will work as expected.
Puma is a much more modern Ruby webserver which doesn't require EventMachine to operate, leaving the door open to Reaktor on JRuby.
Is there any objection to me switching thin out for puma?
For some setups it might be necessary to handle multiple Puppetfile repos.
Hi,
When I have tried "modify event", the log error is ERROR - VERIFY YOU PUPPETFILE SYNTAX - Repository: apache - Git url: git@r10k-master-dev:puppet/puppetfile.git
and reaktor seems to lauch r10k deploy module true
instead of r10k deploy module apache
.
Here is my test Puppetfile
mod "puppetlabs/motd"
mod "apache",
:git => "git@r10k-master-dev:puppet/apache.git",
:ref => 'production'
mod "puppet-ssh",
:git => "https://github.com/saz/puppet-ssh.git",
:ref => 'master'
Is there a problem with my Puppetfile syntax or with the function get_module_name in puppetfile.rb ? (regex = /mod "'["'],\s_$\n^(\s_):git\s_=>\s_["'].*#{repo_name}.git',$/)
It seems the regexp not match with my Puppetfile.
Regards,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.