Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alternate_cdn is ignored (discussion) #325

Closed
CSchulz opened this issue Oct 4, 2018 · 10 comments
Closed

alternate_cdn is ignored (discussion) #325

CSchulz opened this issue Oct 4, 2018 · 10 comments

Comments

@CSchulz
Copy link

CSchulz commented Oct 4, 2018

V. 12.1.0

Running the command with alternate_cdn tries to download the file via the URL defined in config.json:

./node_modules/.bin/webdriver-manager update --gecko=false --standalone=false --alternate_cdn=https://mychromemirror --verbose
https://mychromemirror
ChromeDriver {
  ostype: 'Darwin',
  osarch: 'x64',
  cdn: 'https://mychromemirror',
  configSource:
   ChromeXml {
     ostype: 'Darwin',
     osarch: 'x64',
     out_dir:
      '.../node_modules/protractor/node_modules/webdriver-manager/selenium',
     name: 'chrome',
     xmlUrl: 'https://chromedriver.storage.googleapis.com/' },
  name: 'chromedriver',
  versionDefault: '2.27',
  versionCustom: '2.27' }
[15:40:05] I/downloader - curl -o.../node_modules/webdriver-manager/selenium/chromedriver_2.42.zip https://chromedriver.storage.googleapis.com/2.42/chromedriver_mac64.zip
[15:40:05] I/update - chromedriver: unzipping chromedriver_2.42.zip
[15:40:05] I/update - chromedriver: setting permissions to 0755 for .../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.42

I think the reason is the missing pass through of the alternate cdn to the config file f.e.

constructor() {
super('chrome', Config.cdnUrls()['chrome']);
}

@cnishina
Copy link
Member

cnishina commented Oct 11, 2018

Yes it shouldn't work. I do not have plans to support this... I thought about closing this issue but we should have a discussion about this.

Do you want to download a file and pass the url directly to webdriver-manager? Do you want something like this?

webdriver-manager update --alternative_cdn.chrome=http://someurl/chromedriver

Are you using Protractor to use these binaries? How are you starting your selenium server or are you using direct connect? Potentially the flag "alternative_cdn" is the wrong name for this flag.

@cnishina cnishina reopened this Oct 11, 2018
@vort3xxx
Copy link

vort3xxx commented Oct 16, 2018

I'm able to point to this guy's alternate cdn and it works for me: https://github.com/JohannesHoppe/webdriver-manager-alternate-cdn

I think the problem is that your cdn is only the chrome stuff & not all the things that need downloaded in the right structure. Note that his cdn has more than just the chrome stuff hosted.

@cnishina
Copy link
Member

Okay. So I have more questions:

  • Is this a good idea from a security standpoint to download binaries that someone says is the binary?
  • Is there no way to get the regular update to work? Is using a proxy an option? If you can use a proxy, can you try https://github.com/cnishina/webdriver-manager-replacement? I have tested the whole thing to work against a proxy (probably needs documentation). I also want to eventually update this project with this. It still works the same where alternative_cdn does not exist.

Finally is the goal to download files like:

webdriver-manager update --url.chrome=http://someurl.to.download.chromedriver.directly -- url.standalone=http://someurl.to.download.seleniumserver.directly

I definitely think the flag name should be renamed since it runs a different workflow. Alternative cdn implies that there's an endpoint that has the exact same setup to download a cache of versions and parses the file to find a downloadable version.

Downloading a file by URL might be helpful because of the way webdriver-manager downloads files. This might be important so it can create the file (in the current project this is update-config.json) required to run directConnect or starting Protractor with a local driverProvider.

@cnishina cnishina changed the title alternate_cdn is ignored alternate_cdn is ignored (discussion) Oct 16, 2018
@CSchulz
Copy link
Author

CSchulz commented Oct 17, 2018

I think in a corporate environment you can trust the alternative source for binaries.

Our workaround is downloading the binary manually:

 mkdir -p node_modules/protractor/node_modules/webdriver-manager/selenium
 curl -o node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_${chromeDriverVersion}.zip ${cdnUrl}/${chromeDriverVersion}/chromedriver_linux64.zip
 cd node_modules/protractor/node_modules/webdriver-manager/
 unzip chromedriver_${chromeDriverVersion}.zip
 chmod 755 chromedriver

And setting the chromeDriver binary in the protractor.conf.js.

@hdeadman
Copy link

The organization I am working at (government) is currently blocking storage.googleapis.com so we are trying to figure out how to work around that. Could these files be packaged into their own NPMs like the selenium-server-standalone-jar NPM? Or could they be downloaded from a site with better content curation (i.e. less likely to be blocked)?

@stieler-it
Copy link

We are hitting GitHub's rate limit after some time which makes our CD pipeline fail. We would really like to place our binaries in our binary repository and download from there. Maybe also a remote (proxy) repository would work so we could at least use a cache.

@cnishina
Copy link
Member

cnishina commented Apr 10, 2019

  • GitHub rate has been fixed. @stieler-it (huzzah!)
  • @hdeadman So if you cannot download to storage.googleapis.com, could you get access via proxy? Packaging binaries in npm would be not ideal. I don't think this is probably good practice.

So I guess if you had a box externally to your network that did a proxy forward to storage.googleapis.com, you could download from whatever host name you created?

So instead doing something like:

curl -o /path/to/downloads/chromedriver.xml https://chromedriver.storage.googleapis.com/

You could call:

curl -o /path/to/downloads/chromedriver.xml https://myrandomurl.com/

I guess if this is the specific use case, I could maybe create the basic nginx config for this and provide it when you use an an "alternative_cdn". And all the calls would go to (in this example), myrandomurl.com. When calling GitHub, I'm not sure how this will handle the redirects.

Alternatively, if you did have an externally running job, I would think about running webdriver-manager update and rysnc-ing or copying these files to a local machine.

@cnishina
Copy link
Member

Should also look at #300

@cnishina
Copy link
Member

Okay after discussion with the team offline, this is not something we will support.

@hmil
Copy link

hmil commented Jul 16, 2020

May I ask why would you provide the option --alternate_cdn if it doesn't work?

Isn't it the basic principle of binary repositories to be organized as a star network where each company is supposed to maintain its own private cache of the upstream CDN?

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

No branches or pull requests

6 participants