简体   繁体   中英

Mapping Jenkins Multi-Configuration project to Maven profiles

  1. I want to create a Jenkins multi-configuration project, where each iteration runs against a different operating system (ie the axis consists of Jenkins slave labels).
  2. For each platform, I want Jenkins to run a different Maven profile. For example, for label "linux-slave" I want it to run Maven profile "linux-amd64-gcc-debug".
  3. The Maven profile names differ from the Jenkins slave labels. As such, I'd like to configure a mapping on the Jenkins end that will map each label to a different profile name.
  4. Finally, sometimes want a single label to run multiple Maven profiles. For example, "linux-slave" should build the following Maven profiles:

    • linux-i386-gcc-debug
    • linux-i386-gcc-release
    • linux-amd64-gcc-debug
    • linux-amd64-gcc-release

Is it possible to implement this in terms of a Jenkins multi-configuration project? If so, how?

You can try the Matrix Groovy Execution Strategy

You can have one axis as the axis labels you want and the other would probably be a user defined axis of all the possible profiles you want.

In the strategy script you can just select the combinations you want. So it behaves like a more poweful combination filter.

I think you would need parameters at runtime to decide which profiles you wanted an to choose debug options. These parameters can be used in the script to decide the combinations you want

Disclaimer: I built the matrix execution strategy

The following ended up working for me:

屏幕截图

You can then run mvn install -P${profile} from a shell build step.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM