Customer Portal

Get Involved. Join the Conversation.

Topic

    Nital Joshi
    Jenkin automation tool with CP
    Topic posted July 5, 2017 by Nital JoshiRed Ribbon: 250+ Points 
    357 Views, 19 Comments
    Title:
    Jenkin automation tool with CP
    Content:

    I am implementing Jenkin automation tool to build CP batch to be deployed automatically on Production. how we can deploy to production without going through customer portal UI? Any idea how to use Jenkin to generate build with last revision difference only ? It should not checkout whole project. It should only include those files which are changed from last build revision. Thanks in advance !

     

    Thanks,

    Nital Joshi

    Comment

    • Luuk

      Hi Nital,

      I don't think there's any other way to deploy a Customer Portal pageset other than through the ci/admin pages.
      The CI admin pages have a pretty good versioning system built in. So you'll have to use that.

      Regards,
      Luuk Schalk

    • Chris Rogers

      We use Jenkins to deploy our code to our production environments.

      It just checks out the entire codebase then rsyncs it with the production environment, thus only updating files that have changed.

      We still go through the customer portal admin pages to deploy though once the code has been uploaded.

      If you dig around you can find the admin pages source, you might be able to make something custom from them to actually deploy the files, but I feel that's the greatest idea.

      An alternative would be to write a script to go through the deployment process web pages.

    • Nital Joshi

      Chris could you please let me know how you rsyncs with production? and Production means you rsyncs with production dev mode envrioment and then deploy it to stage/production via UI . ?

    • Chris Rogers

      Yes, so we develop on tst sites. We then use rsync to upload the files to our 'live' (production) site. The files go into the normal dev mode envrionment like they would if you manually uploaded them.

      We then have to manually run though the stage / promote steps via the UI.

    • Nital Joshi

      So you configure Jenkin with tst or with repository and when Jenkin generate build(complete checkout) it dumps it on Linux server ?I am configuring this with repository present on bitbucket.  could you please provide me you rsync command with options that you using to deploy.? After code copied to production on stage/production it shows only changed files ? can we achieve this with Jenkin only ?

    • Chris Rogers

      Our git repo contains all the files for the customer portal, so off hand the script looks something like

      checkout git branch live
      mount webdav
      rsync src/customer-portal /mount/webdav/cp/customer
      unmount webdav
      

       

      There are loads of options for rsync so you will want to work out what works best for you, we spent a couple of days fine tuning it for our specific cases (eg ignore some files, etc).

      There are also lots of ways of mounting webdav on linux, again probably best you work out what works best for you.

       

      Yes, once we have setup rsync to only upload files that have changed, so in the stage/promote pages it only shows the files that have changed.

      We had to get everything in git that we wanted to upload though, and do a large deployment first to make sure git was identical to the uploaded files.

       

    • Nital Joshi

      Thanks a lot Chris for your help... I have already pushed cp (development/assets) folder to repo.. now it has exactly same codebase with production. Now I am working with Jenkin to automate build generation.. I will look into rsync command you provided to push code. I am also looking for automation of stage/production promote deployment. As we support 26 lang interface its time consuming for us to manually stage and promote. If you have any idea to achieve this please share with us.

       

      Thanks,

      Nital Joshi

    • Chris Rogers

      We've got 5 (with another 3 in the pipeline) language interfaces at the moment, so are also beginning to feeling your pain.

      We haven't had much time to look into automating staging/promote, if you have any luck please let us know!

      Cheers

      Chris

    • Nital Joshi

      Chris last question how to able to connect with oralce CP server from your local Linux machine ?As SSH will not work in this.. I am thinking to write script in Jenkin setup itself so after build creation it should run to rsync..

      Thanks,

      Nital Joshi

    • Chris Rogers

      We use WebDAV as you would normally upload files.

      There are lots of ways to connect to WebDAV from linux, from cadaver to davfs

      Again work out what is best for you, we use davfs

    • Nital Joshi

      so Chris you written a shell script to connect your Jenkin with your Linux machine ? and from ssh to Linux you mounted and unmounted WebDav ?

      Thanks,

      Nital Joshi

       

    • Chris Rogers

      Our Jenkins is running on a Linux box so it can do everything locally. No reason you couldn't write a script to connect to a different Linux box to do it though.

    • Nital Joshi

      Hi Chris,

      I am trying to mount webdav on my VM Ware Ubuntu machine. Getting errors : 301 moved permanently for test env, 404 for production. Could you please help me with the mount!

       

       

    • Danette Beal

      Hi All,

      I've moved this one to the customer portal forum.

      Regards,

      Danette, Community Manager

    • Rajan Davis

      I have never used Jenkins but have used TravisCI for continuous integration. I am not too sure if you could do this with Jenkins but I know with TravisCI that you can customize your build to run scripts after the integration test have ran on your build. I would check to see if this was possible with Jenkins.

       

      I doubt this would be recommended by Oracle, but to automate moving up the staging and production assets, I would use a browser automation tool like Mechanize or Phantom.js. You can automate logging in, selecting the files you wish to push up, and the deployment stages. This is incredibly dangerous but doable.

       

      Not sure if this would work for you as you would need a local copy of the code you are working on, but I would use Thor or commander.js and create a command line wrapper with the Cyberduck CLI and git as dependencies. You can make system calls with Ruby/Node to make use of the Cyberduck CLI and git.

      The Cyberduck CLI would be useful as a webDAV client.

      Git would be useful to find the delta of which files were changed or added; you can grab the names of the files that were changed using `git status -s`.

      You could then take the values of these file names and the use the Cyberduck CLI to copy the files and place them in the corresponding directories across all of your interfaces.

      After that, you can use Mechanize to:

      1. Log into the admin panel, select "Staging"
      2. Select the files you wish to move up (taken from the `git status -s` output)
      3. Then, stage the files. Mechanize can wait until the staging is complete and you have been redirected to the next page. I would try to account for errors on this step as it possible for a build to break when deploying and it's hard to tell when there is no UI to give you this feedback.
      4. Then go to the Production portion and automate the deployment.

      Not sure if this is the "correct" or "best" solution, but some part of this should work for what you would need. Hope this helps.