|
|
|
[
Permlink
| « Hide
]
Robin Shen [20/Sep/11 11:42 PM]
Currently accessing changes of other builds from context of a running build has problems. We reworked the changes in QB4 and such problem will be resolved. QB4 will be released in the end of this month.
The best test!
In root/TEST set script ${groovy: build = system.getConfiguration('root/A/B').getLatestBuild() while (build.getId() != 6111) build = build.getPrevious() build.getChanges().size().toString()} as Next Build Version. Before triggering build You will see '3' but triggered build will get build number '0'. 6111 is build-id with SCM-Changes from root/A/B Next details:
I have two configurations: root/A/B root/TEST In root/A/B i have 10 builds. Build BUILD_5 is failed but it contain 3 SCM Changes in root/TEST I wrote script similar to this build = system.getConfiguration('root/A/B').getLatestBuild() f = open('/tmp/' + filename, 'w+') while build and build.getStatus().name() not in ('SUCCESSFUL', 'RECOMMENDED'): f.write("Build: " + str(build.getVersion()) + "\n") f.write("Change count: " + str(build.getChanges().size()) + "\n") build = build.getPrevious() f.close() I'm calling this script in three in root/TEST places (in each time 'filename' is different) 1) Called in Next Build Version of TEST configuration field return 3 SCM Changes for BUILD_5 2) In post-execute action of CHECKOUT step of TEST configuration - return 0 SCM Changes for BUILD_5 3) In post-build script of TEST configuration return 0 SCM Changes for BUILD_5 I'm running jython (I'm use my own plugin to be able to use that script programming inside views) code in post-execution action of CHECKOUT step like:
f = open('/tmp/qb.changes', 'w+') while build and build.getStatus().name() not in ('SUCCESSFUL', 'RECOMMENDED'): f.write("Build: " + str(build.getChanges().size()) + "\n") f.write("Change count: " + str(build.getChanges().size()) + "\n") f.close() and the output is Build: BUILD_1.0.0 Change count: 0 Build: BUILD_1.0.1 Change count: 0 Build: BUILD_1.0.2 Change count: 0 whre BUILD_1.0.1 is failed and show me three changes in "SCM Changes (3)". I tried with a simple case, a checkout step followed by a build step, and the build step fails. I checked the "build.getChanges().size()" in post-build script (advanced setting of the configuration) and it returns changes correctly. Can you please create a simple test case so that I can try here?
|