Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33156

Make android-emulator plugin Pipeline-friendly

    Details

    • Similar Issues:

      Description

      This plugin — at least the build wrapper, but preferably also the build steps — should be Pipeline-compatible.

        Attachments

          Activity

          Hide
          garethnz Gareth Shaw added a comment -

          Christopher Orr Sorry, no code pushed yet.

          Yes I wasn't sure about the DSL either, my first steps was to get it working by refactoring AndroidEmulator.java and supporting classes to separate out the logic of managing the emulator and the handling required for a BuildWrapper (Keeping AndroidEmulator.java as the BuildWrapper so as not to break plugin upgrades) - Calling the logic only class "AndroidEmulatorManager".

          Pipeline specific things:

          • I left your Dsl.groovy mostly as is (except I added a 'withAvd(String name)' to use a pre-existing AVD).
          • For specifying all AVD details, I went with what Andy Horner suggested above. (Didn't quite have that working last I worked on this, but it was close)
          • I made the WithAndroidEmulatorStepExecution similar to the build wrapper, using the AndroidEmulatorManager to manage the emulator instance for the step.

          Regarding how the DSL should work, I think something like what Job Dsl does?

          Allow users to instantiate an AndroidEmulatorManager, then provide methods (Steps) like .boot(), .bootAsync(), runWith({}), stop().
          unsure how exactly how to do this at present.
          (You'd also have to provide a way to ensure stop is called in the case of some other exception/error - if the user wants).

          What were you thinking of doing for the DSL?

          Show
          garethnz Gareth Shaw added a comment - Christopher Orr Sorry, no code pushed yet. Yes I wasn't sure about the DSL either, my first steps was to get it working by refactoring AndroidEmulator.java and supporting classes to separate out the logic of managing the emulator and the handling required for a BuildWrapper (Keeping AndroidEmulator.java as the BuildWrapper so as not to break plugin upgrades) - Calling the logic only class " AndroidEmulatorManager ". Pipeline specific things: I left your Dsl.groovy mostly as is (except I added a 'withAvd(String name)' to use a pre-existing AVD). For specifying all AVD details, I went with what Andy Horner suggested above. (Didn't quite have that working last I worked on this, but it was close) I made the WithAndroidEmulatorStepExecution similar to the build wrapper, using the AndroidEmulatorManager to manage the emulator instance for the step. Regarding how the DSL should work, I think something like what Job Dsl does? Allow users to instantiate an AndroidEmulatorManager, then provide methods (Steps) like .boot(), .bootAsync(), runWith({}), stop(). unsure how exactly how to do this at present . (You'd also have to provide a way to ensure stop is called in the case of some other exception/error - if the user wants). What were you thinking of doing for the DSL?
          Hide
          mrsasha Sasa Sekulic added a comment -

          Hi guys, any news on this? Would be really nice to have it.

          Show
          mrsasha Sasa Sekulic added a comment - Hi guys, any news on this? Would be really nice to have it.
          Hide
          bwatson Benjamin Watson added a comment -

          Any updates?  This would be such an awesome feature.

          Show
          bwatson Benjamin Watson added a comment - Any updates?  This would be such an awesome feature.
          Hide
          garethnz Gareth Shaw added a comment -

          Sorry. 
          I did manage to get a version working (that only supported loading existing AVDs, not creating new ones).

          My company may instead move to:

          https://github.com/AzimoLabs/fastlane-plugin-automated-test-emulator-run

          As our builds use fastlane anyway.

          Show
          garethnz Gareth Shaw added a comment - Sorry.  I did manage to get a version working (that only supported loading existing AVDs, not creating new ones). My company may instead move to: https://github.com/AzimoLabs/fastlane-plugin-automated-test-emulator-run As our builds use fastlane anyway.
          Hide
          tobilarscheid Tobias Larscheid added a comment -

          So I assume still nothing new here?

           

          In theory supporting Pipeline should be relatively easy for the BuildWrapper, it would just need to extend

          SimpleBuildWrapper

          instead of

          BuildWrapper

           

          I tried getting that to work, the problem is that there is a lot of custom stuff happening (e.g. manual expansion of environment variables) that were not trivial to transfer.

          Show
          tobilarscheid Tobias Larscheid added a comment - So I assume still nothing new here?   In theory supporting Pipeline should be relatively easy for the BuildWrapper, it would just need to extend SimpleBuildWrapper instead of BuildWrapper   I tried getting that to work, the problem is that there is a lot of custom stuff happening (e.g. manual expansion of environment variables) that were not trivial to transfer.

            People

            • Assignee:
              orrc Christopher Orr
              Reporter:
              orrc Christopher Orr
            • Votes:
              24 Vote for this issue
              Watchers:
              28 Start watching this issue

              Dates

              • Created:
                Updated: