project compile plugin

Added by jp qu about 2 years ago

hi everybody,I need develop a plugin which create a "compile" button in redmine project menu,when you touch this button,it will call a shell script which will start to compile the project code,and return a URL,you can find the compile result in this URL.
I already finished the script,I just don't know how to create the compile in redmine,and how to call a shell script in redmine, please help me with that.

Any ideas were helpful,I use mysql and redmine run on the ubuntu14.04,I think it's same way in different redmine version,so if your method worked on any version of redmine,please tell me how to make it work.

A example of shell script was uploaded,you can try with that.

You can also send email to me.

Thanks. Magnifier (854 Bytes)

Replies (2)

RE: project compile plugin - Added by Bernhard Rohloff about 2 years ago

Why not creating a script with the existing REST API capabilities and a specific workflow status?
You can create a script to receive issues which were updated in the last couple of minutes and check their status for 'compile' or something like that. If it finds one it compiles your code and sets the status to 'finished' or 'error' and posts the result including the URL as comment to the issue. Let it invoke every let's say 10 minutes by a cron job and Bob's your uncle.

My weapon of choice would be RedminePython which is a great library and does the heavy lifting for you.

Kind regards,


RE: project compile plugin - Added by jp qu about 2 years ago

hi,I think you miss the point which I wanted.
I already modified the sample_plugin for test,I made the compile button in the project menu,and I tried to run shell script to compile the code,now my question is:How to run a shell script in redmine!!!
here is my code which I modified from the sample_plugin,in the file example_controller.rb:
function say_goodbye:

def say_goodbye
logger.error "run here 0"
logger.error "say_goodbye:@project = #{@project}"
if @project "3600e"
logger.error "ready to call sh"
logger.error "run here 3"

when I push compile button,the say_goodbye function will run,I got @project value,it is 3600e,it should equl and run into if,but it not run into if,so I removed (if @project "3600e"),just call a shell script with exec,redmine crash and no info in the production.log.

I tried same code in a test.rb which code is:

def say_goodbye
puts @project
if @project == "3600e"
puts "run here2"

def find_project
puts "run here2"

puts "run here0"

Just run this script,
It is all OK,I don't know why,so please help with that!