GithubHelp home page GithubHelp logo

saucelabs / ci-sauce Goto Github PK

View Code? Open in Web Editor NEW
15.0 33.0 22.0 953.14 MB

A project where shared logic between our Java based CI plugins (Jenkins, Bamboo) is kept

License: Apache License 2.0

Java 99.68% Shell 0.32%
sauce-connect

ci-sauce's People

Contributors

adrian256 avatar alexh-sauce avatar dependabot[bot] avatar diemol avatar endakelly avatar enriquegh avatar halkeye avatar krzysieksulejczak avatar maciejurbanskisaucelabs avatar moizjv avatar raptorsin6 avatar rossrowe avatar sauce-jenkins-bot avatar seanenright avatar uarlouski avatar valfirst avatar yfangsl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ci-sauce's Issues

Ability to select latest stable browser version for Chrome and Firefox

Motivation:
Some browsers like Chome and Firefox now update their versions so frequently.
As a result browser version selected few weeks ago sometimes stop being up to date.

So user has manually go and update browser version in Jenkins Job configuration.

It would be helpful to have additional explicit options like "latest stable Firefox" and "latest stable Chrome" versions for every platform supported by Sauce Labs.

Jenkins/Sauce Connect on windows yields NullPointerException

I configured the Jenkins plugin following the instructions on:

https://docs.saucelabs.com/ci-integrations/jenkins/#configuring-the-jenkins-sauce-ondemand-plugin

When I configure and run a project, I get:

Starting pre-build for Sauce Labs plugin
Starting Sauce Connect on master node using identifier: default
Launching Sauce Connect on dev-nirvana
FATAL: null
java.lang.NullPointerException
at java.io.File.(Unknown Source)
at >com.saucelabs.ci.sauceconnect.SauceConnectFourManager.getSauceConnectLogFile(SauceConnectFourManager.java:347)
at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:352)

After inspecting the source code, I found this line:

private static final String WINDOWS_TEMP_DIR = System.getProperty("java.io.tempdir");
(com/saucelabs/ci/sauceconnect/SauceConnectFourManager.java:127)

When I go to Jenkins Script Console, there's no java.io.tempdir property, only java.io.tmpdir.

To validate it, I ran jenkins setting java.io.tempdir, and it works:

java -jar -Djava.io.tempdir=C:\Temp jenkins.war

I suspect this an error in the source code, because when I search for "java.io.tmpdir" in Google I get 174,000 results, and only 956 results for "java.io.tempdir". Can you confirm whether this is a bug or not? Thanks

Initialize latest SC version constant lazily

Now the constant com.saucelabs.ci.sauceconnect.SauceConnectFourManager#LATEST_SC_VERSION is initialized whenever com.saucelabs.ci.sauceconnect.SauceConnectFourManager class is loaded. It introduces unnecessary network load especially when useLatestSauceConnect is false.

Expected: Latest SC version constant should be initialized lazily.

Lack of file permissions blocks run of SauceConnect on Unix

Actual:

Caused by: java.io.IOException: Cannot run program "/home/runner/sc-4.9.2-linux/bin/sc" (in directory "/home/runner/sc-4.9.2-linux/bin"): error=13, Permission denied
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170) ~[?:?]
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089) ~[?:?]
	at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.createProcess(AbstractSauceTunnelManager.java:284) ~[ci-sauce-1.180.jar:1.180]
	at com.saucelabs.ci.sauceconnect.SauceConnectFourManager.prepAndCreateProcess(SauceConnectFourManager.java:243) ~[ci-sauce-1.180.jar:1.180]
	at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:448) ~[ci-sauce-1.180.jar:1.180]
	...
Caused by: java.io.IOException: error=13, Permission denied
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method) ~[?:?]
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:295) ~[?:?]
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:225) ~[?:?]
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1126) ~[?:?]
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089) ~[?:?]
	at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.createProcess(AbstractSauceTunnelManager.java:284) ~[ci-sauce-1.180.jar:1.180]
	at com.saucelabs.ci.sauceconnect.SauceConnectFourManager.prepAndCreateProcess(SauceConnectFourManager.java:243) ~[ci-sauce-1.180.jar:1.180]
	at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:448) ~[ci-sauce-1.180.jar:1.180]
	...

Expected:
SauceConenct is successfully extracted and launched on Unix OS

Jenkins job fails with multiple scripts in Selenium builder suite

Hi,
I hope i have posted this in the right place, apologies if not.
We have a Jenkins system using Sauce Labs and Selenium Builder plugins.
If we run a suite with a single test script, it runs fine. As soon as we add multiple test scripts to the suite, the build fails. Console output is below. Any ideas? Is it possible to get a build with more logging?

Starting to run selenium builder command
Starting test run.
Initialising driver.
SauceOnDemandSessionID=228feeff45414838b3d26d6c30f1f2d7 job-name=null
Running step 1:Step step.
Running step 2:Step step.
Running step 3:Step step.
Running step 4:Step step.
Running step 5:Step step.
Quitting driver.
Starting test run.
Initialising driver.
Error running selenium builder command
Build step 'Invoke Selenium Builder script' marked build as failure
Finished: FAILURE

Our suite is as follows:

{
"type": "suite",
"seleniumVersion": "2",
"formatVersion": 1,
"scripts": [
{
"where": "github",
"path": "GoogleTestScript.json"
},
{
"where": "github",
"path": "GoogleTestScript2.json"
}
],
"shareState": true
}

Many thanks for your help,
Chris

Cant find method SauceREST.getTunnels()

I have the following in my pom:
<dependency> <groupId>com.saucelabs</groupId> <artifactId>ci-sauce</artifactId> <version>1.112</version> </dependency> <dependency> <groupId>com.saucelabs</groupId> <artifactId>saucerest</artifactId> <version>1.0.32</version> </dependency>

And Get the following code:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
FAILED CONFIGURATION: @BeforeClass setUp
java.lang.NoSuchMethodError: com.saucelabs.saucerest.SauceREST.getTunnels()Ljava/lang/String;
at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.activeTunnelIdentifier(AbstractSauceTunnelManager.java:424)
at com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager.openConnection(AbstractSauceTunnelManager.java:282)
at Selenium.OmnitureTrackingHomePageTestNg.setUp(OmnitureTrackingHomePageTestNg.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

SKIPPED CONFIGURATION: @afterclass tearDown
SKIPPED: LogInMobileTestNgTest

Default test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1

Default suite
Total tests run: 1, Failures: 0, Skips: 1

Configuration Failures: 1, Skips: 1

[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@4ec6948c: 91 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 14 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@5b065904: 9 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@11331ce6: 12 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@27d43d30: 9 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@3a15c018: 62 ms

I checked and saw that the method is there but I have no idea what am I doing wrong...

Use new SauceConnect v 4.3.5 instead of 4.3

When I run SauceConnect using SauceConnectFourManager I see a warning that newer version of Sauce Connect is now available (sc-4.3.5, build 1600). I suspect that we need to update some constant in ci-sauce code to start using recent 4.3.5 version instead of v. 4.3.

P.S. Issue above was noticed in "previous" ci-sauce release (1.81).
@rossrowe , could you please publish release 1.82 to the artifactory as well?

Unable to run tunnel via SauceConnectFourManager

OS: Win8. Maven-dependencies: ci-sauce: 1.72, sauce-connect: 3.1.32.
When I call SauceConnectFourManager.openConnection(sauceUsername, sauceAccessKey, port, null, options, httpsProtocol, null, quietMode):
'Cannot run program "bin\sc.exe" (in directory "C:\Users\Sony\sc-4.3-win32"): CreateProcess error=2, The system cannot find the file specified' error appears.
Tracking down disclosed that error occurs when AbstractSauceTunnelManager tries to start sc extracted executable as process at line 260.

Code looks for tunnel ID, but console prints "Provisioned Tunnel", this throws an exception

SystemOutGobbler#processLine is looking for "Tunnel ID: " but new versions of Sauce Connect no longer prints "Tunnel ID: ", it now prints "Provisioned tunnel:". As a result the tunnel Id is null inside tunnel information.

Till version
4..3.14 it showed up as - Tunnel ID: cbd476defebf491aadff30fc576451f1
For version 4.4.6 it shows up as - Provisioned tunnel: 2fcd2250a71942e79295e2f70e6cac72

21 Apr 10:39:08 - Sauce Connect 4.4.6, build 1496 4c7197f -dirty
21 Apr 10:39:08 - Starting up; pid 12804
21 Apr 10:39:08 - Command line arguments: bin\sc.exe -u ***** -k ****
21 Apr 10:39:08 - Log file: C:\Users\****\Desktop\sc-4.4.6-win32\sc.log
21 Apr 10:39:08 - Pid file: C:\Users\****\AppData\Roaming/sc_client.pid
21 Apr 10:39:08 - Timezone: CDT GMT offset: -5h
21 Apr 10:39:08 - Using no proxy for connecting to Sauce Labs REST API.
21 Apr 10:39:08 - Unable to serve metrics on localhost:8888, error was: listen tcp 127.0.0.1:8888:
 address/port) is normally permitted.
21 Apr 10:39:09 - Started scproxy on port 59779.
21 Apr 10:39:09 - Please wait for 'you may start your tests' to start your tests.
21 Apr 10:39:33 - Provisioned tunnel:2fcd2250a71942e79295e2f70e6cac72
21 Apr 10:39:33 - Using no proxy for connecting to tunnel VM.
21 Apr 10:39:33 - Starting Selenium listener...
21 Apr 10:39:33 - Establishing secure TLS connection to tunnel...
21 Apr 10:39:33 - Selenium listener started on port 4445.
21 Apr 10:39:34 - Sauce Connect is up, you may start your tests.

https://github.com/saucelabs/ci-sauce/blob/master/src/main/java/com/saucelabs/ci/sauceconnect/AbstractSauceTunnelManager.java#L573

Switch from `master` to `main`

Let's abandone non-inclusive terms such as master, slave, blacklist, and whitelist and therefor switch the branch name to main. This should be a fairly straight forward process, just rename the branch in the settings. All PRs will be automatically updated to target the new default branch.

Unkillable sc at Linux machine

Hello,
I use ci-sauce v. 1.74 (the latest version deployed to the cloudbees artifactory at the moment) and SauceConnectFourManager in particular to start SC at my Jenkins machine. I suffer from 2 issues:

  1. When SauceConnectFourManager can't start Sauce Connect tunnel for some reason it hangs for a long time witting for tunnel started message infinitely. It would be great if gobbler could process error cases as well and release semaphore with corresponding exceptional method call (can be default implementation with throwing a Runtime exception). I couldn't override inner SystemOutGobbler class as it has closed constructor (why?)
  2. Obsolete sc processes remain in system non-terminatable (I couldn't terminate them with 'kill' command)

Javascript alert on job miscellaneous tab: "blockUI requires jQuery v1.2.3 or later! You are using v1.10.2"

The Bamboo plugin is reporting a Javascript error on the job miscellaneous tab. It seems to be caused by a incorrect comparison of the semantic versioning by blockUI jQuery plugin.

The errors are coming from https://myhost/s/d41d8cd98f00b204e9800998ecf8427e-CDN/en_US/4410/1/1.6.48/_/download/batch/com.saucelabs.bamboo.bamboo-sauceondemand-plugin:sodJS/com.saucelabs.bamboo.bamboo-sauceondemand-plugin:sodJS.js

We see this error message on https://myhost/build/admin/edit/editMiscellaneous.action?buildKey=ABC-ABC-JOB1

The error message is: "blockUI requires jQuery v1.2.3 or later! You are using v1.10.2"

The plugin is using the jQuery BlockUI Plugin version 2.33. The latest version of this plugin does not check for jQuery version.

Bamboo Sauce OnDemand Plugin Version: 1.6.49
Workaround: Click the OK button. It seems all the UI functionality still works.

Unable to start Sauce Connect after upgrading to version 1.159

Short summary of what the user sees:
User is seeing the following error in Sauce Connect logs:
2022-08-09 15:56:42.220 [17084] [CLI] [fatal] extra info is not valid JSON.

Exact steps to reproduce the problem:
Code used for connection

if (bSauceLabsExecution) {
    final String testUser = Suite.config.getProperty("sauceLabs.username");
    final String testKey = Suite.config.getProperty("sauceLabs.key");

    tunnelOptions =
            "--tunnel-identifier=" + tunnelId + " --readyfile=connectSet.txt --no-remove-colliding-tunnels";
    /*tunnelOptions =
                "--tunnel-name=" + tunnelId + " --readyfile=connectSet.txt --no-remove-colliding-tunnels";*/

    manager = new SauceConnectFourManager();

    Suite.manager = manager;
    try {
        tunnel = manager.openConnection(testUser,
                testKey, 0, null, tunnelOptions,
                null, false, null);
    } catch (AbstractSauceTunnelManager.SauceConnectException e) {
        e.printStackTrace();
    }

Isolation: What must be true for it to happen? When does it not happen?
User has been using version 1.154.
(Unable to use version 1.158 due to tunnel_name issue.)

Links to Relevant Test Archives or Logs:
Console output:
INFO: Launching Sauce Connect 4.8.0 [C:\Users\MO001\sc-4.8.0-win32\bin\sc.exe, -u, ****, -k, ****, -P, 0, --tunnel-identifier=****, --readyfile=connectSet.txt, --no-remove-colliding-tunnels, -v, -l=mySaucelog.txt, --extra-info, {"runner": "jenkins"}]

What attempts were made to find the root cause so far?
NA

OS/Browser and Job Links never populate

I'm using Ruby with Sauce Labs and Jenkins. I see lines like this in the job output.

SauceOnDemandSessionID=1234 job-name=Reset password page loads successfully

The Job Name and Pass/Fail are populated correctly. I have reviewed the sauce-ondemand-plugin source code and only these two values are parsed. The OS/Browser and Job Link columns never populate. I'd expect this information to be retrieved from Sauce since the session id is known. Is there a way to get data in all the columns?

sauce_jenkins_plugin

NPE in SauceConnectFourManager when running with sauce connect

NPE in SauceConnectFourManager when running with sauce connect while running with true useLatestSauceConnect flag, it tries to find sc-4.4.12 but returned resource is null.

java.lang.NullPointerException
2018-03-03 14:40:13,436 [pool-2-thread-1] INFO org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2314)
2018-03-03 14:40:13,436 [pool-2-thread-1] INFO org.apache.commons.io.IOUtils.copy(IOUtils.java:2270)
2018-03-03 14:40:13,437 [pool-2-thread-1] INFO org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2291)
2018-03-03 14:40:13,437 [pool-2-thread-1] INFO org.apache.commons.io.IOUtils.copy(IOUtils.java:2246)
2018-03-03 14:40:13,437 [pool-2-thread-1] INFO com.saucelabs.ci.sauceconnect.SauceConnectFourManager.extractFile(SauceConnectFourManager.java:379)
2018-03-03 14:40:13,437 [pool-2-thread-1] INFO com.saucelabs.ci.sauceconnect.SauceConnectFourManager.extractZipFile(SauceConnectFourManager.java:302)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.