I have set up a matrix job with the same configuration as a working non-matrix job. I have a single build step that invokes a simple ant target. On the Sauce axis, I have chosen two browser configs and on the Slaves axis, I have chosen a single slave. This yields two jobs.

      When the two jobs run, there is an ant error which seems to be failing because of the way that the SELENIUM_DRIVER argument is passed to ant.

      [rh2vagrant] $ ant -DSELENIUM_DRIVER=sauce-ondemand:?os=Linux&browser=googlechrome&browser-version= -Darguments="-DSELENIUM_DRIVER=sauce-ondemand:?os=Linux&browser=googlechrome&browser-version=" -Dlabel=rh2vagrant -Dbehat.profile=local-js ci
      /usr/bin/ant: line 326: browser-version=: command not found
      Buildfile: build.xml
      
      [rh2vagrant] $ ant "-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2008&browser=iexploreproxy&browser-version=9" '-Darguments="-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2008&browser=iexploreproxy&browser-version=9"' -Dlabel=rh2vagrant -Dbehat.profile=local-js ci
      /usr/bin/ant: line 326: browser-version=9: command not found
      Buildfile: build.xml
      
      BUILD FAILED
      Target "2008" does not exist in the project "behat". 
      

      In the first output, the SELENIUM_DRIVER argument is completely unquoted, while in the second output, the entire thing, including the -D is in quotes.

      Could I be doing something wrong? Any help is greatly appreciated.

      I am running Jenkins ver. 1.476 with Sauce OnDemand plugin ver. 1.21.

          [JENKINS-15326] Error running ant with matrix build

          Roger Lopez added a comment -

          Upon further inspection, it looks like this may actually be a problem with the -Darguments argument. Line 326 of /usr/bin/ant is

          eval $ant_exec_command
          

          Adding an echo of $ant_exec_command before the eval gives me this:

          exec "/usr/lib/jvm/java/bin/java" -classpath "/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/lib/jvm/java/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp "" "-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2008&browser=iexploreproxy&browser-version=9" "-Darguments="-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2008&browser=iexploreproxy&browser-version=9"" "-Dlabel=rh2vagrant" "-Dbehat.profile=local-js" "ci"
          

          So it looks like the quotes in -Darguments are to blame.

          Roger Lopez added a comment - Upon further inspection, it looks like this may actually be a problem with the -Darguments argument. Line 326 of /usr/bin/ant is eval $ant_exec_command Adding an echo of $ant_exec_command before the eval gives me this: exec "/usr/lib/jvm/java/bin/java" -classpath "/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/lib/jvm/java/lib/tools.jar" -Dant.home= "/usr/share/ant" -Dant.library.dir= "/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp "" " -DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2008&browser=iexploreproxy&browser-version=9 " " -Darguments= "-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2008&browser=iexploreproxy&browser-version=9" " " -Dlabel=rh2vagrant " " -Dbehat.profile=local-js " " ci" So it looks like the quotes in -Darguments are to blame.

          Ross Rowe added a comment -

          Hi Roger, could you tell me if this is still an issue for you?

          Cheers,

          Ross

          Ross Rowe added a comment - Hi Roger, could you tell me if this is still an issue for you? Cheers, Ross

          Roger Lopez added a comment -

          Yes this is still an issue. To make it simple to replicate the issue, I created a gist (https://gist.github.com/3793861) with a simple ant build file. With that repo I can replicate the issue like so:

          1. Create a new job, selecting the "Build multi-configuration project" option. Name the job whatever you want.
          2. Choose git for your SCM and use git://gist.github.com/3793861.git as the repo URL.
          3. Add a "Sauce OnDemand Cross-browser tests" axis. Select any combination of browsers.
          4. Add an "Invoke ant" build step and using the "test" target (without quotes).
          5. Save and build.

          The console output varies based on the browser selected. Here are some samples:

          Windows 2003 IE6
          Started by upstream project "JENKINS-15326" build number 3
          Building on master in workspace /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Windows 2003iexploreproxy6
          Checkout:Windows 2003iexploreproxy6 / /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Windows 2003iexploreproxy6 - hudson.remoting.LocalChannel@9cd1d3c
          Using strategy: Default
          Cloning the remote Git repository
          Cloning repository origin
          Fetching upstream changes from git://gist.github.com/3793861.git
          Commencing build of Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master)
          Checking out Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master)
          No change to record in branch origin/HEAD
          No change to record in branch origin/master
          [Windows 2003iexploreproxy6] $ ant "-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2003&browser=iexploreproxy&browser-version=6" '-Darguments="-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2003&browser=iexploreproxy&browser-version=6"' test
          /usr/bin/ant: line 335: browser-version=6: command not found
          Buildfile: /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Windows 2003iexploreproxy6/build.xml
          
          BUILD FAILED
          Target "2003" does not exist in the project "JENKINS-15326". 
          
          Total time: 0 seconds
          Build step 'Invoke Ant' marked build as failure
          Finished: FAILURE
          
          Linux Google Chrome
          Started by upstream project "JENKINS-15326" build number 4
          Building on master in workspace /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Linuxgooglechrome
          Checkout:Linuxgooglechrome / /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Linuxgooglechrome - hudson.remoting.LocalChannel@9cd1d3c
          Using strategy: Default
          Last Built Revision: Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master)
          Fetching changes from 1 remote Git repository
          Fetching upstream changes from git://gist.github.com/3793861.git
          Commencing build of Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master)
          Checking out Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master)
          Warning : There are multiple branch changesets here
          [Linuxgooglechrome] $ ant -DSELENIUM_DRIVER=sauce-ondemand:?os=Linux&browser=googlechrome&browser-version= -Darguments="-DSELENIUM_DRIVER=sauce-ondemand:?os=Linux&browser=googlechrome&browser-version=" test
          /usr/bin/ant: line 335: browser-version=: command not found
          Buildfile: /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Linuxgooglechrome/build.xml
          
          test:
               [echo] Hello world
          
          BUILD SUCCESSFUL
          Total time: 0 seconds
          Build step 'Invoke Ant' marked build as failure
          Finished: FAILURE
          

          Hope this helps.

          Roger Lopez added a comment - Yes this is still an issue. To make it simple to replicate the issue, I created a gist ( https://gist.github.com/3793861 ) with a simple ant build file. With that repo I can replicate the issue like so: Create a new job, selecting the "Build multi-configuration project" option. Name the job whatever you want. Choose git for your SCM and use git://gist.github.com/3793861.git as the repo URL. Add a "Sauce OnDemand Cross-browser tests" axis. Select any combination of browsers. Add an "Invoke ant" build step and using the "test" target (without quotes). Save and build. The console output varies based on the browser selected. Here are some samples: Windows 2003 IE6 Started by upstream project "JENKINS-15326" build number 3 Building on master in workspace /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Windows 2003iexploreproxy6 Checkout:Windows 2003iexploreproxy6 / /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Windows 2003iexploreproxy6 - hudson.remoting.LocalChannel@9cd1d3c Using strategy: Default Cloning the remote Git repository Cloning repository origin Fetching upstream changes from git: //gist.github.com/3793861.git Commencing build of Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master) Checking out Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master) No change to record in branch origin/HEAD No change to record in branch origin/master [Windows 2003iexploreproxy6] $ ant "-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2003&browser=iexploreproxy&browser-version=6" '-Darguments= "-DSELENIUM_DRIVER=sauce-ondemand:?os=Windows 2003&browser=iexploreproxy&browser-version=6" ' test /usr/bin/ant: line 335: browser-version=6: command not found Buildfile: /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Windows 2003iexploreproxy6/build.xml BUILD FAILED Target "2003" does not exist in the project "JENKINS-15326" . Total time: 0 seconds Build step 'Invoke Ant' marked build as failure Finished: FAILURE Linux Google Chrome Started by upstream project "JENKINS-15326" build number 4 Building on master in workspace /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Linuxgooglechrome Checkout:Linuxgooglechrome / /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Linuxgooglechrome - hudson.remoting.LocalChannel@9cd1d3c Using strategy: Default Last Built Revision: Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master) Fetching changes from 1 remote Git repository Fetching upstream changes from git: //gist.github.com/3793861.git Commencing build of Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master) Checking out Revision 30967741d6003357a91d27c04a030e33af1a73f4 (origin/HEAD, origin/master) Warning : There are multiple branch changesets here [Linuxgooglechrome] $ ant -DSELENIUM_DRIVER=sauce-ondemand:?os=Linux&browser=googlechrome&browser-version= -Darguments= "-DSELENIUM_DRIVER=sauce-ondemand:?os=Linux&browser=googlechrome&browser-version=" test /usr/bin/ant: line 335: browser-version=: command not found Buildfile: /Users/zroger/.jenkins/jobs/JENKINS-15326/workspace/SELENIUM_DRIVER/Linuxgooglechrome/build.xml test: [echo] Hello world BUILD SUCCESSFUL Total time: 0 seconds Build step 'Invoke Ant' marked build as failure Finished: FAILURE Hope this helps.

          Roger Lopez added a comment -

          This patch seems to work for me, but I'm not familiar enough with the project to know why the quotes were there in the first place.

          https://gist.github.com/3795164

          Roger Lopez added a comment - This patch seems to work for me, but I'm not familiar enough with the project to know why the quotes were there in the first place. https://gist.github.com/3795164

          Ross Rowe added a comment -

          Hi Roger, thanks for the patch, from memory I included the quotes around the arguments for Maven support. The arguments flag is really on needed for Maven builds anyway, so I'll see if I can update the code so that it only adds the build variable if it's building a Maven project.

          Cheers,

          Ross

          Ross Rowe added a comment - Hi Roger, thanks for the patch, from memory I included the quotes around the arguments for Maven support. The arguments flag is really on needed for Maven builds anyway, so I'll see if I can update the code so that it only adds the build variable if it's building a Maven project. Cheers, Ross

          Code changed in jenkins
          User: Ross Rowe
          Path:
          pom.xml
          src/main/java/hudson/plugins/sauce_ondemand/BrowserAxis.java
          src/main/java/hudson/plugins/sauce_ondemand/SauceOnDemandBuildWrapper.java
          http://jenkins-ci.org/commit/sauce-ondemand-plugin/f8ac508817d4eb4982db07f0c1171c3cda1a6b56
          Log:
          JENKINS-15326 Removed quotes from BrowserAxis arguments

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ross Rowe Path: pom.xml src/main/java/hudson/plugins/sauce_ondemand/BrowserAxis.java src/main/java/hudson/plugins/sauce_ondemand/SauceOnDemandBuildWrapper.java http://jenkins-ci.org/commit/sauce-ondemand-plugin/f8ac508817d4eb4982db07f0c1171c3cda1a6b56 Log: JENKINS-15326 Removed quotes from BrowserAxis arguments

          Ross Rowe added a comment -

          I've included your patch in version 1.23, please let me know if there are any further issues.

          Ross Rowe added a comment - I've included your patch in version 1.23, please let me know if there are any further issues.

            rossrowe Ross Rowe
            zroger Roger Lopez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: