Suppose you want to run some checks on the build outputs you are going to promote, for example to ensure they were not compiled with the debug option on. You’ve written a custom REXX script that parses the generated promotionInfo.xml file that contains the name of the build outputs to be promoted and then checks each output. Now what?
Your promotion definition can be configured to run a pre-build and/or post-build command. So, you can just call your REXX from the pre-build command, right? Wrong. The problem is that at the time the pre-build command executes, none of the intermediate files produced on the server to serve as input to the promotion have been transferred to the build machine yet. This means you can’t access promotionInfo.xml to see which outputs to check. Rats!
Rather than use a pre-build command, you will need to use a custom Ant script to perform the promotion. Perform the following steps:
- Save the generatedBuild.xml from one of your successful promotion build results to a USS directory on the host where your build agent is running.
- Edit the build script and add an additional target that executes your REXX.
- Update the “all” target in the build script to execute your target before performing the promote.
- In the Promotion definition, on the z/OS Promotion tab, choose “Use an existing build file”.
- Specify the build file you created in step 1.
Note that the dependency build offers more flexibility in this area than promotion, in that you can specify a pre or post build script to be executed right before or right after the main build script. This gives you the ability to inject additional Ant tasks while still generating the build script on each run. This capability was added in version 4.0 and can be found on the z/OS Dependency Build tab of your build definition.