saucelabs / bamboo_sauce

Bamboo plugin for use with Sauce OnDemand
11 stars 5 forks source link

Add clear message in all documentation regarding Sauce Connect #12

Closed jimthedev closed 10 years ago

jimthedev commented 10 years ago

As a new user of the plugin (and Sauce in general) it was not immediately clear to me that we needed to install the sc binary separately from this plugin. It seems obvious now but at the time the errors just seemed cryptic. Would be really great to have a disclaimer or note somewhere in the docs letting people know that this is a prereq.

Thanks!

ChrisWren commented 10 years ago

@jimthedev or @rossrowe do you by any chance know where in the doc would be the best place to download Sauce Connect? Here is a link to the markdown file: https://github.com/saucelabs/docs/blob/master/markdown/ci-integrations/bamboo.md

Thanks for bringing this up! Hope to update the docs soon to fix this.

jimthedev commented 10 years ago

My instinct is to put it right above the Installing section. It is a prerequisite for the plugin to work with Sauce Connect and I feel like the natural order is to have prerequisites before the actual instructions. The tricky part is phrasing it so that it is clear that this is only needed if using sauce connect so anyone connecting directly can ignore it.

On Wednesday, July 2, 2014, Chris Wren notifications@github.com wrote:

@jimthedev https://github.com/jimthedev or @rossrowe https://github.com/rossrowe do you by any chance know where in the doc would be the best place to download Sauce Connect? Here is a link to the markdown file: https://github.com/saucelabs/docs/blob/master/markdown/ci-integrations/bamboo.md

Thanks for bringing this up! Hope to update the docs soon to fix this.

— Reply to this email directly or view it on GitHub https://github.com/saucelabs/bamboo_sauce/issues/12#issuecomment-47866156 .

rossrowe commented 10 years ago

@jimthedev The Bamboo plugin includes the Sauce Connect binary (both the versions 3 and 4), so you shouldn't need to download it and install it outside of the plugin. Can you tell me what version of both Bamboo and the Sauce plugin you were using, and what behavior you were seeing (ie. were any errors being generated)?

jimthedev commented 10 years ago

@rossrowe Oh! Good to know.

We're using SC 4 (we don't have the use version 3 checkbox checked). The plugin was installed a day or two ago. Our bamboo server is at version 5.5.0 build 4304.

I don't see anything in the build log that indicates a problem happened with the plugin. Is there another place to look? The job shows up in Sauce labs, but is labeled as 'Not on Sauce Connect' in the top left. If I manually run sc on the bamboo server then it works using the plugin since obviously the tunnel is opened (albeit manually). This leads me to believe that sc just isn't able to start for some reason on our server.

The only things that looks to be related to the plugin in the build specific .log file is the following:

simple  02-Jul-2014 17:15:24    Running pre-build action: Sauce OnDemand Build Configurator

and

using extra environment variables: \nSELENIUM_STARTING_URL=http://localhost:9000\nSELENIUM_DRIVER=sauce-ondemand:?username=XXXXXX&access-key=XXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&job-name=Mobile -52&firefox-profile-url=&max-duration=300&idle-timeout=90&user-extensions-url=\nbamboo_SAUCE_ONDEMAND_BROWSERS=[{"platform":"XP","os":"Windows 2012","browser":"chrome","url":"sauce-ondemand:?os=Windows 2012&browser=chrome&browser-version=32","browser-version":"32"},{"platform":"XP","os":"Windows 2012 R2","browser":"firefox","url":"sauce-ondemand:?os=Windows 2012 R2&browser=firefox&browser-version=30","browser-version":"30"}]\nBAMBOO_BUILDNUMBER=MOB-52\nSAUCE_USER_NAME=XXXXXX\nSELENIUM_HOST=localhost\nSAUCE_API_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\nSELENIUM_IDLE_TIMEOUT=90\nSELENIUM_MAX_DURATION=300\nSELENIUM_PORT=4445\n

Would there be another log location that I could look at to see a failure to start sc?

Thanks!

Jim

jimthedev commented 10 years ago

Did some digging. Looks like in the atlassian-bamboo.log we are getting the following right after the VCS checkout step of our build. Seems like either the gz doesn't exist or isn't able to be untar'd for some reason:

2014-07-02 12:49:27,819 INFO [9-BAM::Local Agent::Agent:pool-26-thread-1] [PrepareBuildTask] MOB-JOB1-47: Running pre-build action: Sauce OnDemand Build Configurator
2014-07-02 12:49:27,837 ERROR [9-BAM::Local Agent::Agent:pool-26-thread-1] [BuildConfigurator] Error running Sauce OnDemand BuildConfigurator, attempting to continue
java.lang.IllegalArgumentException: Negative time
    at java.io.File.setLastModified(File.java:1421)
    at org.codehaus.plexus.archiver.zip.AbstractZipUnArchiver.extractFile(AbstractZipUnArchiver.java:234)
    at org.codehaus.plexus.archiver.tar.TarUnArchiver.execute(TarUnArchiver.java:93)
    at org.codehaus.plexus.archiver.AbstractUnArchiver.extract(AbstractUnArchiver.java:120)
    at com.saucelabs.ci.sauceconnect.SauceConnectFourManager.untarGzFile(SauceConnectFourManager.java:198)
    at com.saucelabs.ci.sauceconnect.SauceConnectFourManager.extractZipFile(SauceConnectFourManager.java:183)
    at com.saucelabs.ci.sauceconnect.SauceConnectFourManager.createProcessBuilder(SauceConnectFourManager.java:135)
    at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:250)
    at com.saucelabs.bamboo.sod.action.BuildConfigurator.startTunnel(BuildConfigurator.java:152)
    at com.saucelabs.bamboo.sod.action.BuildConfigurator.call(BuildConfigurator.java:116)
    at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.runPreBuildActions(PrepareBuildTask.java:129)
    at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.call(PrepareBuildTask.java:100)
    at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:186)
    at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:102)
    at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:108)
    at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)
    at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
    at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
    at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
    at java.lang.Thread.run(Thread.java:744)
2014-07-02 12:49:27,840 INFO [9-BAM::Local Agent::Agent:pool-26-thread-1] [PrepareBuildTask] MOB-JOB1-47: Running pre-build action: Clover Grails PreBuild Action
2014-07-02 12:49:27,840 INFO [9-BAM::Local Agent::Agent:pool-26-thread-1] [PrepareBuildTask] MOB-JOB1-47: Running pre-build action: VCS Version Collector
2014-07-02 12:49:27,841 INFO [9-BAM::Local Agent::
jimthedev commented 10 years ago

Different but potentially related issues from Jenkins and Java: https://issues.jenkins-ci.org/browse/JENKINS-23078 http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6791812

rossrowe commented 10 years ago

Thanks for letting us know, would you be able to tell me what version of the Sauce Bamboo plugin you have running? I thought I had fixed that in the latest version of the Bamboo plugin (version 1.6.45), but I'll check it now.

jimthedev commented 10 years ago

Unfortunately we are on 1.6.45, too.

rossrowe commented 10 years ago

Okay, thanks for letting me know, and apologies for the inconvenience...I'll release a new version of the Bamboo plugin over the next day or so which includes a fix for this.

jimthedev commented 10 years ago

Sweet! I'm out Mon and Tues but @bgetsug can probably test it if needed.

On Thursday, July 3, 2014, Ross Rowe notifications@github.com wrote:

Okay, thanks for letting me know, and apologies for the inconvenience...I'll release a new version of the Bamboo plugin over the next day or so which includes a fix for this.

— Reply to this email directly or view it on GitHub https://github.com/saucelabs/bamboo_sauce/issues/12#issuecomment-47996420 .

rossrowe commented 10 years ago

Hi @jimthedev and @bgetsug, I've just released version 1.6.46 of the Bamboo plugin which should resolve the Sauce Connect error, would you be able to try out this version and let me know how it goes?

jimthedev commented 10 years ago

Hi @rossrowe, thanks for being patient.

We updated to the latest version of the plugin and see the bamboo-sauceondemand-plugin-1.6.46.jar file in /opt/bamboo-home/plugins

Ran a job this morning and got further than before. It now appears that the sc-4.3-linux.tar.gz and the corresponding extracted directory in /opt/bamboo-home directory. We're now getting the following error in the log.

The /opt/bamboo-home/sc-4.3-linux/bin/sc binary runs properly when I manually run it with ./sc so it appears to be uncorrupted and properly extracted.

2014-07-09 10:05:39,820 INFO [10-BAM::Local Agent 2::Agent:pool-27-thread-1] [PrepareBuildTask] FIS-MOB-JOB1-64: Running pre-build action: Sauce OnDemand Build Configurator
2014-07-09 10:07:02,780 INFO [QuartzScheduler_Worker-5] [ExpiryTickerImpl] Live expiry handlers: 0
2014-07-09 10:07:40,056 ERROR [10-BAM::Local Agent 2::Agent:pool-27-thread-1] [BuildConfigurator] Error running Sauce OnDemand BuildConfigurator, attempting to continue
com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$SauceConnectException: com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$SauceConnectDidNotStartException: Time out while waiting for Sauce Connect to start, please check the Sauce Connect log
    at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:284)
    at com.saucelabs.bamboo.sod.action.BuildConfigurator.startTunnel(BuildConfigurator.java:152)
    at com.saucelabs.bamboo.sod.action.BuildConfigurator.call(BuildConfigurator.java:116)
    at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.runPreBuildActions(PrepareBuildTask.java:129)
    at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.call(PrepareBuildTask.java:100)
    at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:186)
    at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:102)
    at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:108)
    at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)
    at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
    at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
    at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
    at java.lang.Thread.run(Thread.java:744)
Caused by: com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager$SauceConnectDidNotStartException: Time out while waiting for Sauce Connect to start, please check the Sauce Connect log
    at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:272)
    ... 12 more
2014-07-09 10:07:40,059 INFO [10-BAM::Local Agent 2::Agent:pool-27-thread-1] [PrepareBuildTask] FIS-MOB-JOB1-64: Running pre-build action: Clover Grails PreBuild Action
2014-07-09 10:07:40,059 INFO [10-BAM::Local Agent 2::Agent:pool-27-thread-1] [PrepareBuildTask] FIS-MOB-JOB1-64: Running pre-build action: VCS Version Collector

The error indicates we should look at the sc log file, but I've been unable to locate it.

Thoughts? Thanks again.

Jim

rossrowe commented 10 years ago

Hi Jim, by default, the Sauce Connect log is written to /tmp/sc.log, would you be able to check to see if this file exists? You can also change the location of the Sauce Connect log by setting the '-l' command line option (eg. -l /path/to/your_log_file)

dellis23 commented 10 years ago

The lack of documentation re: the logging in Sauce Connect should be fixed soon.

jimthedev commented 10 years ago

@rossrowe Great. Thanks. This was exactly what I needed. Using the log in /tmp I was able to find out that I was not actually explicitly setting selenium port in the Protractor config to be set to the SELENIUM_PORT environment variable.

I used the following settings in my protractor.conf.js to get it to work:

var browsersFromEnvironment = JSON.parse(process.env.bamboo_SAUCE_ONDEMAND_BROWSERS);

/* Transform the bambo sauce environment variable into a protractor variable */
var browsersTransformed = [];
browsersFromEnvironment.forEach(function(browser){
  browsersTransformed.push({'browserName':browser.browser});
});
exports.config = {
  seleniumPort: process.env.SELENIUM_PORT,
  baseUrl: 'http://localhost:9000',
  multiCapabilities: browsersTransformed,
  sauceUser: process.env.SAUCE_USER_NAME,
  sauceKey: process.env.SAUCE_API_KEY,

  specs: ['test/spec/e2e/**/*.js'],
   // Test
  jasmineNodeOpts: {
    showColors: false
  }
};

I also had to be explicit in the General Settings tab to set localhost and port 4445. Somehow they were cleared (probably just from all of my messing around).

Thanks so much for working with me on this. Much appreciated.

Jim