post build LabelAxis value in MatrixRun

4 views
Skip to first unread message

Adi

unread,
Jul 27, 2015, 11:36:27 AM7/27/15
to Jenkins Developers
Hi,

I've a question. I'm working on plugin which will match different multi configuration builds, using different git branches and push artifacts to remote repo.
So I've multiple label/slaves to run on different platforms, like axis=PLATFORM, node-4 with label RHEL5_64 and RHEL5_64_DEC.

In matrix configuration i've only RHEL5_64_DEC enabled, and when i start the build I see that's it's picked correctly (it's also validated in makefile, and i put echo after build):

Building remotely on node-4 (RHEL5_64 RHEL5_64_DEC) in workspace /home/jenkins/.../PLATFORM/AS5_64_DEC
...
+ echo 'After build PLATFORM=AS5_64_DEC'
After build PLATFORM=AS5_64_DEC


When build finish and I try to push binaries to repo. I would expect that env varaible PLATFORM=RHEL5_64_DEC, but for some occasionally it's RHEL5_64:

publisher code:
public class MyArtifactsPublisher  extends Recorder
{

    @Override
    public boolean perform(AbstractBuild build, Launcher launcher,BuildListener listener) throws InterruptedException, IOException
    {
        if(build instanceof MatrixRun)
        {
            MatrixRun mr= (MatrixRun)build;

            String branch = GetBranchNameFromGlobalCfg(mr);

            // append platform to the branch name
            EnvVars envs = build.getEnvironment(listener);
            if(envs.containsKey("PLATFORM"))
                branch = branch + "_" + envs.get("PLATFORM");

          final FilePath tempWorkspace = GetTempWorkspace(mr);

          listener.getLogger().println(MessageFormat.format("Trying to check out branch {0} into local temp directory {1}", branch, tempWorkspace.getName()));
           .....


and in the logs:
Trying to check out branch DevBranch_RHEL5_64 into local temp directory gitpushtempdir


Can anyone tell me why the value have changed? in post build actions i just have "archieve the artifacts" and 'build other builds".
Is there other way to get correct axis value other than parsing JOB_NAME?

Regards,
Adam
Reply all
Reply to author
Forward
0 new messages