Skip to end of banner
Go to start of banner

How to have a Bamboo build with a manual IM request

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Summary

How to run an interactive GINT test as part of a Bamboo build. User will get an instant message when the interactive test runs. The response to the IM request will determine the outcome of the build (or at least this aspect of the build).

References

Steps

  1. Make sure you have 2 IM user ids, one for automation to send IMs from and one to receive IMs
  2. You will need the appropriate IM configuration that depends on your IM server - the example below users GTALK
  3. Make sure you have the Groovy Tasks for Bamboo installed
  4. Select your build -> Configuration
  5. Add a task - select a GINT task
  6. Select INLINE for script location
  7. Copy/paste the following script
  8. Save
  9. Run build
    • a positive response (y) to the IM request will result in the test being successful
    • a negative response (n) to the IM request will result in a failed test
GINT script to send an IM
@Grapes([
    @GrabResolver(name='atlassian', root='https://maven.atlassian.com/content/groups/public/'),
    @Grab(group='org.swift.tools', module='gint', version='1.4.0'),
    @Grab(group='jivesoftware', module='smack',  version='3.1.0'),
    @Grab(group='jivesoftware', module='smackx', version='3.1.0'),
    @GrabConfig(systemClassLoader=true),
])
import org.swift.tools.*

includeTool << Gint          
//includeTool << Helper       
includeTool << ImHelper  

gint.initialize(this)

imConfig  = [
    name: 'gtalk',
    to: gmailUser, 
    host: 'talk.google.com', 
    port: 5222, 
    service: 'gmail.com', 
    userName: gmailFromUser,  // this needs to be hardcoded or specified in gint.properties
    userPassword: gmailFromPassword, // same as above
]

gint.add(
    im: [
        content: 'Do you approve?',
        timeout: -1, // wait forever
        successResponses: ['yes', 'y'], // or use the default responses
        failResponses: ['no', 'n'], // or use the default responses
    ],
    inline: {}
)

gint.finalizeTest()

Results

Bamboo build log
...
    [start] z1
 [response] y
   [ending] z1
  [success] z1
 [complete] z1 - 0.01 secs
	
     [info] Successful testcases  . . . . . . . . . . : 1    <<< TEST SUCCESSFUL
     [info] Total testcases . . . . . . . . . . . . . : 1
     [info] Elapsed run time  . . . . . . . . . . . . : 15.203 secs 
	
= = = = = =   XXX_IM_JOB1_13_GintTask_7102860042226958159 completed at Tue Mar 06 22:55:53 CST 2012 = = = = = =
	
BUILD SUCCESSFUL
Total time: 16.75 seconds
...
  • No labels