Lately I have been working with a customer who wants to enable their developers to deploy their own
SOA suite composites to a protected QA Server based on a checkout from Subversion.

As part of the customer's current composite promotion process, the developers check their unit tested code
into Subversion and then email a build manager to checkout, build and deploy the code to the QA environment.
This approach introduces delay and places a signification administration burden on the person in the build manager role.

This blog post provides an example of how Hudson can be used as a self service web page that allows developers
to initiate the automated checkout, build and deploy process.
It may be counter-intuitive to use Hudson as a manual build tool, but it fits the requirement nicely. 


High Level Steps

  1. Download Hudson
  2. Create a weblogic.xml file and add it to the Hudson war file
  3. Deploy Hudson to WebLogic
  4. Update Hudson with several available plugins and restart Hudson
  5. Secure Hudson so only an Admin user can edit job Hudson jobs.
  6. Create the Hudson Job to checkout / build / deploy the SOA Composite
  7. Test the job as an Anonymous Hudson user

1) Download Hudson

    Download the Hudson war  (version 3.0.1-b2) from http://hudson-ci.org/


2) Create a weblogic.xml file and add it to the Hudson war file

    Using your favorite text editor, create a new text file named weblogic.xml and
    add the following text contents to the file.

 <?xml version="1.0" encoding="UTF-8"?>
 <weblogic-web-app
  xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
  <container-descriptor>
    <prefer-application-packages>
      <package-name>org.apache.*</package-name>
      <package-name>org.dom4j.*</package-name>
    </prefer-application-packages>
  </container-descriptor>
 </weblogic-web-app>

Update the hudson war file by adding the weblogic.xml file
# jar uvf hudson.war WEB-INF/weblogic.xml

3) Deploy hudson.war to WebLogic

   Using the weblogic console, deploy the hudson.war as an application.
   The Hudson main page should then be accessible from a browser
   For example at  the url   http://localhost:7001/hudson-3.0.1/

4) Update Hudson with several required plugins

   Access the main page of Hudson at  http://localhost:7001/hudson-3.0.1/
   (Server host name and port may vary for the local environment)

   The Hudson CI Server Initial Setup page should appear

   A)  In the 'Core Compatibility Plugins' section ensure the three Plugins are selected.

  

   B)  Scroll down to the 'Featured Plugins' section
        Select the ' Hudson Subversion Plug-in'


     

  C)  Press the Finish button at the bottom of the page.
       The Hudson main page should appear.


  D)  We need to add one more plugin to hide the WebLogic passwords from the build runtime console
       Select 'Manage Hudson' from the left Navigation pane.
 

     
 

   Then select the 'Manage Plugins' icon and select the Available Tab and the Others Link


   
       


  Scroll down to the Utilities section and select the 'Mask Password Plugin'
  Then select the 'Install' button at the bottom of the page.

       
    



Finally Hudson must restarted for the last plugin to be enabled.
From the WebLogic console, locate the Hudson deployment and perform a
'Force Stop Now'
 
             

And then a Start  'Servicing all requests'

            



5) Secure Hudson

The Hudson default configuration allows all users to perform all actions.
This section will add an Admin user will full rights and restrict the rights of all other users.

Select Manage Hudson / Security from the Hudson main page.
1) Check the Enable security checkbox
2) Select Hudson's own user database
3) Select 'Anyone can do anything'
4) Save



Add an admin user

1) From the Hudson main page Select the 'sign up' link in the upper right corner
2) Add an user named admin (or other user name) and enter a desired password..
3) Press the Sign up button and the admin user should be created and logged on.

                


Switch to Matrix-based Security

1) Log on as the admin user (if required) 

2) Select Manage Hudson / Security from the Hudson main page.
3) Change the security setting from    ' anyone can do anything'
    to    ''Matrix - based Security'

4) Add a row for the newly created admin user and check as needed to enable all boxes.
5) Finally modify the Anonymous user row to enable only  Overall-Read, Job-Read and Job-Build



Now the admin user can perform all actions including creating and modifying jobs.

Anonymous (not logged in) users visiting the site can run jobs but not create or modify them.
Optionally each user can register, but the matrix must be configured for each user id.


6) Create the Hudson job

 Click the 'New Job' link,
 Enter a job name of 'DeployCompositeFromSVN' then
 Select the 'Build a free-style software job'
 Press the Ok Button
 


  Parameter Section
   Select the 'This job is parametrized' checkbox and add the following
   four String Parameters. For each parameter, enter the Name, Default value if any
   and descriptions for each field as follows:
   (Note: the Name field is case sensitive.
           : the Default Value for the CompositeSearchPoint parameter is a period.




  Next, scroll down to the Build Environment section,
  check the 'Mask passwords' checkbox then click the add button to
  add a parameter named WLS_ADMIN_PASSWORD and set the Password to the password for the user id that will
  deploy the target on the target WLS Server.  For example supply the value welcome1 for the 'weblogic' admin userid.
  The user id will be supplied later in the deploy script. This step ensures that the password is masked in the log/console
  for the deployment.

                 



  Add an 'Execute Shell' step and paste in the following script available here
  The script will locate a project folder based on the user provided CompositeName.


              
                    


Compile Step
Add an 'Invoke Ant' step as shown below. 
Substitute the correct path for the ant-sca-package.xml  file based on the local environment.
The script is located under the Oracle SOA install.
               

Package Step

Add an 'Invoke Ant' step as shown below. 
Substitute the correct path for the ant-sca-package.xml  file based on the local environment.
The script is located under the Oracle SOA install.
              

Deploy Step

Add an 'Invoke Ant' step as shown below. 
Substitute the correct path for the ant-sca-deploay.xml  file based on the local environment.
The script is located under the Oracle SOA install.
              

The complete Hudson config.xml can be downloaded here.

7) Test the job


    The job can be submitted by an Anonymous user (not logged in) as shown below.
    Click the far right Green Start icon on the  'DeploycompositeFromSVN' row.


     

      Enter the value  ' FileToFtp'  in the CompositeName field.
      Press the Build button.


     


      The following screens show the Job output including the successful deployment of the composite..