Auto deploy of code to cloud (PaaS)

145 views
Skip to first unread message

Kishorekumar Neelamegam

unread,
Jan 3, 2014, 6:29:25 AM1/3/14
to scmma...@googlegroups.com
I am building a plugin for our PaaS from scm-manager ? Basically the users code is in scm-manager. User then manually clicks a button to launch his code in cloud. Subsequent commits, would basically trigger an autobuild/deploy of war in tomcat running in any cloud. 

Are there interests in the group towards this plugin ? 

Sebastian Sdorra

unread,
Jan 6, 2014, 5:16:23 AM1/6/14
to scmma...@googlegroups.com
Hi,
I'm very interested. Would you like to publish your plugin to the scm-manager plugin center?

Sebastian 


2014/1/3 Kishorekumar Neelamegam <nkis...@megam.co.in>
I am building a plugin for our PaaS from scm-manager ? Basically the users code is in scm-manager. User then manually clicks a button to launch his code in cloud. Subsequent commits, would basically trigger an autobuild/deploy of war in tomcat running in any cloud. 

Are there interests in the group towards this plugin ? 

--
You received this message because you are subscribed to the Google Groups "scmmanager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scmmanager+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jan Boerner

unread,
Jan 6, 2014, 6:01:23 AM1/6/14
to scmma...@googlegroups.com
Hi,

we are also very interested. This is a nice feature.

Regards,
Jan

--
SCM-Manager supported by TRIOLOGY

Web: www.scm-manager.com

Stay tuned to the latest news by using the following links
google+ : http://www.scm-manager.com/+
facebook: http://www.facebook.com/scmmanager
twitter: https://twitter.com/SCM_Manager

Kishorekumar Neelamegam

unread,
Jan 9, 2014, 5:59:48 AM1/9/14
to scmma...@googlegroups.com
Dear Jan/Sebastian,

Nice to hear. Will publish it out shortly. Our team is working on it, based on the scm-webhook plugin.  Its just an extension of that.

Manuel Jesús Recena Soto

unread,
Jan 9, 2014, 7:46:34 AM1/9/14
to scmma...@googlegroups.com
Hello,

Why not to use a job in your Continuous Integration Server?

Regards,

2014/1/9 Kishorekumar Neelamegam <nkis...@megam.co.in>:
--
Manuel Jesús Recena Soto
Founder, CEO & CTO of klicap - ingeniería del puzle

mobile phone +34 664 000 629
work phone + 34 954 894 322
www.klicap.es | blog.klicap.es

gom...@megam.co.in

unread,
Jan 11, 2014, 11:16:34 AM1/11/14
to scmma...@googlegroups.com
Dear Manuel Jesus Recena,

Thank you for your comments.
Jenkins triggers builds when code changes. We could plumb jenkins and build custom jobs to do it. We wanted more than Builds, CI and wanted to get around the manual setup of jenkins.

We are building a private PaaS software, and would have customers using an SCM. The private PaaS will allow customers to launch their app on the cloud of choice (private/public). In this context, any app  that runs for a customer needs to be refreshed instantly as the code updates.  The code needs to be launched on the PaaS of our choice (Not just AWS Beanstalk or Cloudfoundry).  Do you think there may be an elegant way than we are working on ? 

Kishorekumar Neelamegam

unread,
Jan 21, 2014, 2:04:32 AM1/21/14
to scmma...@googlegroups.com
Dear All,

Further to update, 

Our  cloud platform as service cluster is running, refer the pic in the link here: https://docs.google.com/drawings/d/1myRchVCV0QcAA8W9aGVFfCRHUVfXm3HI0DuLzvyERv0/edit?usp=sharing

Currently we support Github. We are working this week to get scm-manager plugin, ntegrated. Let us know if anyone wants to try it.

Kishorekumar Neelamegam

unread,
Feb 13, 2014, 5:50:13 AM2/13/14
to scmma...@googlegroups.com
Dear Sebastian,
We have the plugin tested locally and ready to test it remotely.  Here is our source code (Apache V2) https://github.com/indykish/scm-megam-plugin.

Let me know how to publish it to the scm-manager plugin center. 
 

Kishorekumar Neelamegam

unread,
Feb 13, 2014, 9:53:21 AM2/13/14
to scmma...@googlegroups.com
Dear Sebastian,

We tried doing 

mvn scmp:package   and tried installing the resulting bundle which ends with .scmp to scm-manager remote server. On restart of tomcat it doesn't show our plugin.

Finally to test if the plugin works in a remote private server, we used the "scmp:run technique " as was tested in local dev.

Are we doing the correct thing to package a scmp plugin ? 

Sebastian Sdorra

unread,
Feb 13, 2014, 2:14:52 PM2/13/14
to scmma...@googlegroups.com
Hi,
Yes "mvn scmp:package" is the right way to build a plugin for a remote installation of a non published plugin. You could check the loading of the plugin, if you enable trace logging of scm-manager. With enabled trace logging you should see the load of any extension point of your plugin.

At the moment the plugin can not be published to plugin center, because it would be conflict with the webhook plugin. Your plugin uses the same configuration files and properties as the webhook plugin does.

Sebastian

Kishorekumar Neelamegam

unread,
Feb 13, 2014, 9:56:30 PM2/13/14
to scmma...@googlegroups.com
Dear Sebastian,
Thanks for the speedy reply. What is it we need to change in the properties to ensure it doesn't conflict with WebHook ? Any wiki links will help too.
We wanted ability to additionally call our API server, which is the reason we couldn't use webhook.

Sebastian Sdorra

unread,
Feb 14, 2014, 10:51:34 AM2/14/14
to scmma...@googlegroups.com
Hi,
Could you please explain when you need to be call your api and which informations you need to call the api. I ask because the WebHook-Plugin seems to be overkill for your needs. Perhaps i can guide you to build an easier plugin.

You are trying to call the api of your server after each push and it does not matter what or who has changed the repository, is this correct?

Sebastian

gom...@megam.co.in

unread,
Feb 17, 2014, 1:17:11 AM2/17/14
to scmma...@googlegroups.com
Dear Sebastian, 
Thank you for your response. We call our api server when an user pushes code into their repo in scm-manager. The information we need are the user's email/api_key, and an associated cloud app name. 

eg: emailid = sam...@gmail.com api_key: xyz00111 cloud app name: greatapp1.megam.co

When the user sam...@gmail.com pushes code to repo:sample1.git, we get a trigger to our apiserver saying "cloud appname =greatapp1.megam.co" needs to get built. We do an automatic clone and start the build scripts to perform this work. 

We don't care about the Changesets changed during the push for now.  It does matter who changes the repo, as the cloud app gets associated with an user.

Would like to hear a better design though.  Here is the full use case: http://blog.megam.co/archives/1134

We are experimenting using the ssh-plugin to see if the userid/pw authentication during the clone process can be eliminated.

Sebastian Sdorra

unread,
Feb 17, 2014, 2:55:47 PM2/17/14
to scmma...@googlegroups.com
Hi,
This should be simple to implement. You need a class which receives the hook and gets the name of the current user:

@Extension // register extension
@EagerSingleton // class must be loaded eagerly to register the event on startup
public class MegamPostReceiveRepositoryHook {

  // subscribe async to hook events
  @Subscribe
  public void handleEvent(PostReceiveRepositoryHookEvent event){
    // retrieve the subject of the current user
    Subject subject = SecurityUtils.getSubject();
    // get user object from the subject
    User user = subject.getPrincipals().oneByType(User.class);
    // get mail from user
    // note the mail address is not required and can be null
    String mail = user.getMail();
    // call your api here
  }
  
}


Note the parent in the pom must be at least version 1.31. Is an api key stored for each user or one per scm-manager instance?

Sebastian

Kishorekumar Neelamegam

unread,
Feb 17, 2014, 9:07:00 PM2/17/14
to scmma...@googlegroups.com
Dear Sebastian,

Sure. Will change our code. The api key is stored for each user. Of course site wide configuration can be supported too. We currently use tomcat 7 & 8. The plugin works using (scmp:run - jetty container). 

But it doesn't install in tomcat 8. We are going to try in tomcat 7 today. Thanks for your help. 

Kishorekumar Neelamegam

unread,
Feb 19, 2014, 2:11:44 AM2/19/14
to scmma...@googlegroups.com
Dear Sebastian,

Our plugin works in Tomcat 8.0.3 (beta). We also need the scm-ssh-plugin to work. We found the root cause of the SEVERE memory bug that scm-ssh-plugin

We are looking at rewriting the sshserver using http://www.jcraft.com/jsch/ or a better approach.

Do you have a Ruby API ? If not we'll try to build one. We need to provide seamless provisioning of an user to scm-manager from our Rails app. 

Sebastian Sdorra

unread,
Feb 19, 2014, 12:33:30 PM2/19/14
to scmma...@googlegroups.com
No, there is no ruby api. You can do this with the rest api (http://docs.scm-manager.org/restdocs/current/).

Kishorekumar Neelamegam

unread,
Feb 24, 2014, 10:27:05 PM2/24/14
to scmma...@googlegroups.com
Dear Sebastian,

Thanks. We have a built a ruby gem. Hopefully we'll push our rubygem  in (rubygems.org) today and update our blog. The rubygem will on-board an user, list repository to start-with. We wanted to use the ssh key mechanism to clone repo's in cloud. But we couldn't get the scm-ssh-plugin to work as it starts a apache mina sshd server and uses ThreadLocal. The other alternate approaches to make the ssh work failed too (scm-manager.org via system default sshd or ssh over http didn't work)

Do you have design ideas on supporting ssh ability for scm-manager ?

We are going with an use case of "A customer selects a framework (java, nodejs, scala..) from our service portal and provides an scm url and launches an app named <something>.<domain.co>  on the cloud. Any code triggers will automatically update the cloud app.

If somebody wishes to try it out, we would be happy to provide them a free trial account. Let us know folks by responding to this link or email: gom...@megam.co.in

gom...@megam.co.in

unread,
Feb 26, 2014, 10:30:28 AM2/26/14
to scmma...@googlegroups.com
Dear Sebastian,

Can we list scm-manager in our page here => http://www.gomegam.com/partners/ ? Please let us know.  We' have competed testing and will showcase scm-manager for on-premise customers integrated to our PaaS. 

Kishorekumar Neelamegam

unread,
Feb 27, 2014, 7:54:01 PM2/27/14
to scmma...@googlegroups.com
Dear Sebastian,

Here is the updated source code. Please https://github.com/indykish/scm-megam-plugin/

We couldn't get this code to work.
@EagerSingleton 
public class MegamPostReceiveRepositoryHook
 m
We extended PostReceiveHook instead. Kindly let us know your feedback. Can this plugin be posted in your main plugin repo  ?

Sebastian Sdorra

unread,
Mar 3, 2014, 1:57:46 AM3/3/14
to scmma...@googlegroups.com
I could not see any changes to the repository.

Sebastian

Kishorekumar Neelamegam

unread,
Mar 3, 2014, 10:03:03 PM3/3/14
to scmma...@googlegroups.com
Dear Sebastian,

The package(scm-megam-plugin / src / main / java / org / megam / scm_manager ) now just has 6 + 2 = 8 java files. That is the change we did. When you looked at the repository did you get to see those changes ?

Sebastian Sdorra

unread,
Mar 8, 2014, 6:51:50 AM3/8/14
to scmma...@googlegroups.com
Ok, now i can see the changes. I will look at it and make some comments on github.

Sebastian

Kishorekumar Neelamegam

unread,
Mar 8, 2014, 10:06:17 AM3/8/14
to scmma...@googlegroups.com
Dear sebastian,

Thanks. Thats wonderful. Looking forward to hear your comments.

gom...@megam.co.in

unread,
Mar 16, 2014, 10:56:28 PM3/16/14
to scmma...@googlegroups.com
Dear Sebastian,

Any luck with the review of our code ? Eager to hear your thoughts.

Sebastian Sdorra

unread,
Mar 24, 2014, 4:34:01 AM3/24/14
to scmma...@googlegroups.com
Hi,
Sorry i was really busy in the last days. So here some comments:

- RepositoryMegamHook:80 You inject a "Provider<HttpClient> httpClientProvider", but you never use it.
- The constructor of MegamHookExecutor requires HttpClient and Repository but you never use them. 
- The MegamHookExecutor defines a unused method called "createBaseEnvironment".
- The package "org.megam.scm_manager.data" can be removed, because the classes of this package are only used in a unused method.
- The class MegamHookResource uses the WebSecurityContext which is deprecated since version 1.22 of SCM-Manager. You should use "SecurityUtils.getSubject().checkRole(Role.Admin)" instead.
- Please do not use System.out in your code, please use the slf4j loggers.
- The pom includes a dependency to org.apache.commons:commons-jexl, but this dependency is never used.
- The pom defines SCM-Manager 1.35 as parent. This means that only instances of SCM-Manager 1.35 and above could use your plugin. I think you can safely use version 1.24 as parent, because your code does not use apis from version above 1.24.
- The plugin.xml shows my name as author and displays the url of the webhook-plugin.

If i have more time i will have a look at the frontend.

Sebastian




For more options, visit https://groups.google.com/d/optout.

gom...@megam.co.in

unread,
Mar 31, 2014, 6:23:01 AM3/31/14
to scmma...@googlegroups.com
Dear Sebastian,

Thank you for the comments. I post a new version with the changes.

Kishorekumar Neelamegam

unread,
Apr 1, 2014, 9:34:55 AM4/1/14
to scmma...@googlegroups.com
Dear Sebastian, 

I reviewed the changes in https://github.com/megamsys/scm-megam-plugin.git. The unused classes have been cleaned up, and our 0.3 version is available.
Reply all
Reply to author
Forward
0 new messages