Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Hardcoded saucelabs/Jenkins pipeline env variables don't work with new Jenkins pipeline #272

Open
angelsk opened this issue Mar 22, 2017 · 4 comments

Comments

@angelsk
Copy link

angelsk commented Mar 22, 2017

Hi, so we've started using BlueOcean on Jenkins to configure pipelines, which is awesome. However, the SauceLabsFactory and Selenium2Factory have hardcoded values which mean that we have to creatively add configuration to get it to work properly.

Basically, SauceConnect randomly picks an open port, and generates a tunnel identifier, and sticks them in env variables. Changed in v1.142

SaucelabsFactory:L48 - could we use SELENIUM_PORT if it's set please, as the default in Jenkins is no longer 4445
Selenium2Factory:L72 - could we use TUNNEL_IDENTIFIER if it's set please (as JOB_NAME has spaces, and changes per branch)

Currently we get around this by hardcoding a double port, by it's a bit hacky (but in case anyone else experiences the same issue)

sauceconnect(options: '-P 4445 -i my_hardcoded_tunnel', useGeneratedTunnelIdentifier: false, verboseLogging: true) {
// Run tests
}

Logs: Command line arguments: /home/jenkins/sc/bin/sc -u username -k **** -P 37501 -P 4445 -i my_hardcoded_tunnel

and then specifying the tunnel-identifier in the capabilities configuration.

But I would love a proper solution.

@stof
Copy link
Member

stof commented Mar 22, 2017

if you use Symfony DependencyInjection 3.2+ in your project when running Behat (probably won't work if you use the phar, as it embeds its own version of the component and I think it is older), you may try to use the new %env(TUNNEL_IDENTIFIER)%. I'm curious to see whether it works to use your env variables in the config.

@angelsk
Copy link
Author

angelsk commented Mar 22, 2017

Yeah - the port is the main problem; and there's no way to change that. I can look into the DI component, but it may be worth updating the plugin/bundle either way, as the Jenkins plugin has been updated :)

EDIT: Plus SELENIUM_PORT should be backwards compatible with older versions of the Jenkins plugin. I'm not sure what effect it'll have on Travis though.

@SvenRtbg
Copy link

We encountered a completely different, but related problem in our usage of Behat with Jenkins Pipelines. Our branches use slashes for separation, and Jenkins escaped the slash inside the environment variables BUILD_TAG, JOB_NAME and JOB_BASE_NAME with the sequence %2f. That works with behat if only ONE slash is in the branch name, but Symfony DI will bail out with an exception if we use TWO slashes.

The Selenium2Factory fetches the first two environment variables and puts them into a DI Definition class. Symfony DI sees %variable% inside the string and tries to expand this, but fails because such a variable has not been defined.

With a branch name of test/with/slashes the error produced is

[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "2fwith".

Our software does not use any Symfony otherwise, this is only related to "behat/mink-extension" version 2.3.1.

@SvenRtbg
Copy link

SvenRtbg commented Apr 24, 2018

I found this issue: https://github.com/symfony/symfony-standard/issues/1084

It seems like behat/mink-extension is missing to properly escape the strings it is passing into Symfony di.

Now this developed into really being a different issue. I will open my own ticket.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants