CircleCI-Public / browser-tools-orb

Quickly and easily install common browsers and browser testing tools on CircleCI
https://circleci.com/developer/orbs/orb/circleci/browser-tools
MIT License
23 stars 34 forks source link

Chromedriver downloads are targeting unavailable version #90

Closed hoylemd closed 1 year ago

hoylemd commented 1 year ago

Orb version

1.4.2

What happened

When trying to run the browser-tools/install-chromedriver step, the download 404's out.

Installed version of Google Chrome is 116.0.5845.140 
116.0.5845.140 will be installed
curl: (22) The requested URL returned error: 404 

Exited with code exit status 22

That particular version is marked as the "Stable(upcoming)" version on the availability dashboard, and as of this writing it's unavailable

Screen Shot 2023-08-29 at 15 38 01

Expected behavior

Not quite sure the idea solution, but maybe somehow checking for working versions of both? before committing to a version?

75 seems kind of related

Edits: corrected orb version # & replaced error example screenshot with code fence for better discoverabity

0xadada commented 1 year ago

fix that worked for me on orb 1.4.4

- run: sudo apt-get update
- browser-tools/install-chrome:
    # TODO remove following line when fixed https://github.com/CircleCI-Public/browser-tools-orb/issues/90
    chrome-version: 116.0.5845.96
hoylemd commented 1 year ago

I was also able to workaround it with

    steps:
    - browser-tools/install-browser-tools:
        chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

that also installs firefox and geckodriver, but doesn't need the apt get update at least

hoylemd commented 1 year ago

@0xadada What version of browser-tools is that working with? I'm getting an error on 1.4.4 when I try that:

Note, selecting 'google-chrome-stable' instead of '/tmp/chrome.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 google-chrome-stable : Depends: libu2f-udev but it is not installable
E: Unable to correct problems, you have held broken packages.
/bin/bash: line 129: google-chrome-stable: command not found
Google Chrome v116.0.5845.96 (stable) failed to install.

The apt-get install step also didn't seem to do anything though

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
chefvivica commented 1 year ago

I was also able to workaround it with

    steps:
    - browser-tools/install-browser-tools:
        chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

that also installs firefox and geckodriver, but doesn't need the apt get update at least

@hoylemd does this work for 1.4.4?

hoylemd commented 1 year ago

I was also able to workaround it with

    steps:
    - browser-tools/install-browser-tools:
        chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

that also installs firefox and geckodriver, but doesn't need the apt get update at least

@hoylemd does this work for 1.4.4?

It does in my project

chefvivica commented 1 year ago

I was also able to workaround it with

    steps:
    - browser-tools/install-browser-tools:
        chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

that also installs firefox and geckodriver, but doesn't need the apt get update at least

@hoylemd does this work for 1.4.4?

It does in my project

Great. It also works for me. Thanks @hoylemd

0xadada commented 1 year ago

@0xadada What version of browser-tools is that working with? I'm getting an error on 1.4.4 when I try that:

@hoylemd version 1.4.4, i needed to add the apt-get step for it to work. @chefvivica try it.

chefvivica commented 1 year ago
  • browser-tools/install-browser-tools: chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

@0xadada it worked without adding it from my end.

ryanbourdais commented 1 year ago

Hi all, it looks like the orb is functioning as intended, but google released a new version of google chrome stable without a coinciding chromedriver, the only real fix at the moment is to do as @hoylemd suggested and specify your chrome version.

hoylemd commented 1 year ago

@ryanbourdais Would it be possible to have the plugin target the main stable version, not the upcoming one?

ryanbourdais commented 1 year ago

Hi @hoylemd the orb actually targets the coinciding chromedriver version for the downloaded chrome version, the issue arises from google changing what version is considered latest stable by google or if a version of chrome is preinstalled on the image.

snyaggarwal commented 1 year ago

I was also able to workaround it with

    steps:
    - browser-tools/install-browser-tools:
        chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

that also installs firefox and geckodriver, but doesn't need the apt get update at least

@hoylemd does this work for 1.4.4?

It does in my project

Great. It also works for me. Thanks @hoylemd

This works for everything except MacOs. Looks like it ignores chrome-version

timdiggins commented 1 year ago

@ryanbourdais

... the orb actually targets the coinciding chromedriver version for the downloaded chrome version, the issue arises from google changing what version is considered latest stable by google or if a version of chrome is preinstalled on the image.

Yes, agreed, that's what it does. After reading https://github.com/GoogleChromeLabs/chrome-for-testing, I don't think that the Google Chrome team aren't are guaranteeing that the release version (build number) of the current Chrome stable will match the current Chromedriver stable release version (build number) - instead they seem to be offering a current Chromedriver stable that will work against the current Chrome stable. (see https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json)

And it's possible this situation will repeat from time to time after each Google chrome stable patch release (the previous stable chromedriver will work with the new stable chrome, but the new upcoming chromedriver won't yet work -- because the release cycles of chrome and chromedriver are not fully in sync).

From my intention (and I suspect others):

As a orb-user I may want to install the stable channel for Chrome and chromedriver, but don't care about version numbers. In which case, it would be idea if the orb would take an optional channel parameter ("Stable", "Beta", "Dev" or "Canary") and thenfor its installs use https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json to look up the relevant chromedriver url, rather than constructing it based on the currently installed chrome version.

I recognize this is a major addition but it would then massively improve developer OOB experience (especially if the default for both install-chrome and install-chromedriver was channel: "Stable")

cusher commented 1 year ago

After reading https://github.com/GoogleChromeLabs/chrome-for-testing, I don't think that the Google Chrome team ~aren't~ are guaranteeing that the release version (build number) of the current Chrome stable will match the current Chromedriver stable release version (build number) - instead they seem to be offering a current Chromedriver stable that will work against the current Chrome stable. (see https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json)

Unless I'm misreading it, this page seems to indicate that the CfT listed versions should be used to drive the version of both Chrome and ChromeDriver, with a matching version:

Starting with M115 the ChromeDriver release process is integrated with that of Chrome. The latest Chrome + ChromeDriver releases per release channel (Stable, Beta, Dev, Canary) are available at the Chrome for Testing (CfT) availability dashboard. As a result, you might no longer have a need for version selection — you could choose any available CfT version and simply download the correspondingly-versioned ChromeDriver binary.

vietqhoang commented 1 year ago

I was also able to workaround it with

    steps:
    - browser-tools/install-browser-tools:
        chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

that also installs firefox and geckodriver, but doesn't need the apt get update at least

I was still having issues with ChromeDriver still trying to install version 116.0.5845.140, even though 116.0.5845.96 was explicitly defined.

I was able to figure out the issue with our set-up, so just an FYI for those in a similar situation.

Our set-up was using the cimg/ruby:3.2.2-browsers image. Apparently this image came packed with Chrome 116.0.5845.140. From looking at the output of the steps in the job, browser-tools sees Chrome 116.0.5845.140 exists and thus ignores the chrome-version 116.0.5845.96 set in the configuration.

When the ChromeDriver install step comes around, it'll then try to install 116.0.5845.140, which fails.

What worked was changing the image to not use the browsers variant. Some adjustments (unique for our set-up) in our configuration had to be made to accommodate this. Regardless, our root problem that was preventing the quoted solution to work was the use of the browser variant image.

BrianMitchL commented 1 year ago

For browser-tools/install-chrome, I added replace-existing: true to force it to re-install and got it working for me.

      - browser-tools/install-chrome:
          chrome-version: 116.0.5845.96
          replace-existing: true

Looking at the docs, I think you'd need to use replace-existing-chrome: true for browser-tools/install-browser-tools

      - browser-tools/install-browser-tools:
          chrome-version: 116.0.5845.96
          replace-existing-chrome: true
perkinss commented 1 year ago

I was also able to workaround it with

    steps:
     - browser-tools/install-browser-tools:
        chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

This works for everything except MacOs. Looks like it ignores chrome-version

Same here, not using MacOS... but it's ignoring chrome-version.

Going to try the replace-existing: true setting next

perkinss commented 1 year ago

I was also able to workaround it with

     steps:
     - browser-tools/install-browser-tools:
        chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed

Same here, not using MacOS... but it's ignoring chrome-version.

Going to try the replace-existing: true setting next

Nope, I am getting the following:

Error getting version of chromedriver 116. Retrying with chromedriver 115 (attempt 1/5)
Error getting version of chromedriver 115. Retrying with chromedriver 114 (attempt 2/5)
Running tests in the browser...
SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.96 with binary path /usr/bin/google-chrome
...
vietqhoang commented 1 year ago

@perkinss

It looks like you are using the browser-tools/install-browser-tools step?

If your step is using browser-tools/install-browser-tools, you'll need to use replace-existing-chrome instead of replace-existing for the configuration. Based on your comments, it seems you have tried using replace-existing.

The replace-existing is for the more defined install steps, like browser-tools/install-chrome

perkinss commented 1 year ago

@perkinss

It looks like you are using the browser-tools/install-browser-tools step.

If your step is using browser-tools/install-browser-tools, you'll need to use replace-existing-chrome instead of replace-existing for the configuration. Based on your comments, it seems you have tried using replace-existing.

The replace-existing is for the more defined install steps, like browser-tools/install-chrome

I had updated the configuration to use install-chrome before using replace-existing:

    steps:
      - checkout
      - browser-tools/install-chrome:
          chrome-version: 116.0.5845.96 # TODO remove this when google updates the chrome driver
          replace-existing: true

But thanks!

vietqhoang commented 1 year ago

Nope, I am getting the following:

Error getting version of chromedriver 116. Retrying with chromedriver 115 (attempt 1/5)
Error getting version of chromedriver 115. Retrying with chromedriver 114 (attempt 2/5)
Running tests in the browser...
SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.96 with binary path /usr/bin/google-chrome
...

It looks like an older version of ChromeDriver is present from reading the output. Looks like your environment now has the desired version of Chrome.

Is there an install step for ChromeDriver after the Chrome install? From my understanding after reading the documentation the ChromeDriver install will use the version of the installed Chrome. This tells me ChromeDriver install step needs to happen after Chrome.

I don't know how it'll behave with an existing ChromeDriver install.

perkinss commented 1 year ago

It looks like an older version of ChromeDriver is present from reading the output. Looks like your environment now has the desired version of Chrome.

Is there an install step for ChromeDriver after the Chrome install? From my understanding after reading the documentation the ChromeDriver install will use the version of the installed Chrome. This tells me ChromeDriver install step needs to happen after Chrome.

I don't know how it'll behave with an existing ChromeDriver install.

Oh! I thought it was attempting to install the chrome driver and not able to.

HrsUed commented 1 year ago

If you use selenium v4.11, perhaps you don't need to this Orb. Selenium v4.11 introduces a driver and browser manager which downloads browsers and drivers automatically. See https://www.selenium.dev/documentation/selenium_manager/#automated-browser-management

In my environment, it works well.

jeremybdk commented 1 year ago

@HrsUed maybe that could be a solution, can you share your config?

UsAndRufus commented 1 year ago

For browser-tools/install-chrome, I added replace-existing: true to force it to re-install and got it working for me.

      - browser-tools/install-chrome:
          chrome-version: 116.0.5845.96
          replace-existing: true

Looking at the docs, I think you'd need to use replace-existing-chrome: true for browser-tools/install-browser-tools

      - browser-tools/install-browser-tools:
          chrome-version: 116.0.5845.96
          replace-existing-chrome: true

This worked for me, with an additional caveat. I had to pin the Chrome version to the version that the last passing test run used. We already had a step that printed out all tool versions, so it was easy to find. If I used the recommended version used here, our test suite failed.

hoylemd commented 1 year ago

Nope, I am getting the following:

Error getting version of chromedriver 116. Retrying with chromedriver 115 (attempt 1/5)
Error getting version of chromedriver 115. Retrying with chromedriver 114 (attempt 2/5)
Running tests in the browser...
SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.96 with binary path /usr/bin/google-chrome
...

It looks like an older version of ChromeDriver is present from reading the output. Looks like your environment now has the desired version of Chrome.

Is there an install step for ChromeDriver after the Chrome install? From my understanding after reading the documentation the ChromeDriver install will use the version of the installed Chrome. This tells me ChromeDriver install step needs to happen after Chrome.

I don't know how it'll behave with an existing ChromeDriver install.

An earlier version of my config had separate browser-tools/install-chrome and browser-tools/install-chromedriversteps, so you might be onto something

trkoch commented 1 year ago

I'd like to reiterate this comment, which doesn't seem to get the attention it deserves.

As everybody closely following this issue probably noticed, we have a pretty clear case of responsibility diffusion, with A (CircleCI) pointing to B (Google) and B to A. In developer terms, an endless loop, or dependency conflict. There isn't going to be a solution any time soon. Considering that, please think twice if pinning a version of Chrome is a responsible thing to do. You know how this ends in two years' time when the upstream Chrome has diverged enough to make your tests fail in CI but not in development.

The tldr; is this:

Bonus: You benefit from automatic installation of chromedriver in your dev environment.

If you use selenium v4.11, perhaps you don't need to this Orb. Selenium v4.11 introduces a driver and browser manager which downloads browsers and drivers automatically. See https://www.selenium.dev/documentation/selenium_manager/#automated-browser-management

hoylemd commented 1 year ago

It's now been about a week since the google-provided chrome and chromedriver versions fell out of sync, I'm thinking this might be a less temporary situation than I'd originally hoped.

So i'd like to reiterate a call for @CircleCI to make this orb more tolerant of this situation out of the box. Perhaps it could attempt to fall-back to a previous chromedriver version (which should be available via the JSON API endpoints ) if it gets a 404 for the one that matches the chrome install. This would work much like the temporary workaround we've converged upon, but would avoid the need to manually pin a specific version.

ryanbourdais commented 1 year ago

We had hoped that the versions would be synced by now, but as @hoylemd mentioned it has now been a week since this issue arose, and shows that this issue is not something that should just be worked around as it has had far longer effects than anticipated. As a result, I opened PR #94 to resolve this issue by checking for a 404 result from the generated chromedriver link and falling back to the highest chromedriver version that matches the major version of chrome installed.

ryanbourdais commented 1 year ago

I am going to cut a new patch orb version once that PR is merged in.

ryanbourdais commented 1 year ago

Browser Tools Orb version 1.4.5 is now cut and should resolve this issue. Please let me know if this issue persists or if any new issues pop up.

hoylemd commented 1 year ago

Awesome! Thanks @ryanbourdais I'm at the end of my day right now, but I'll try it out first thing tomorrow morning

hoylemd commented 1 year ago

Looks like this fixed the problem for me! I'll leave this open for a day or so in case it doesn't work for someone else, but if not I'll close it tomorrow.

Thanks @ryanbourdais!

0xadada commented 1 year ago

thanks @ryanbourdais, fixed for my team as well.

hoylemd commented 1 year ago

This issue is happening again,

chrome:

Setting up libudev1:amd64 (245.4-4ubuntu3.22) ...
Selecting previously unselected package udev.
(Reading database ... 47832 files and directories currently installed.)
Preparing to unpack .../udev_245.4-4ubuntu3.22_amd64.deb ...
Unpacking udev (245.4-4ubuntu3.22) ...
Selecting previously unselected package libu2f-udev.
Preparing to unpack .../libu2f-udev_1.1.10-1_all.deb ...
Unpacking libu2f-udev (1.1.10-1) ...
Selecting previously unselected package google-chrome-stable.
Preparing to unpack .../google-chrome-stable_116.0.5845.187-1_amd64.deb ...
Unpacking google-chrome-stable (116.0.5845.187-1) ...
Setting up udev (245.4-4ubuntu3.22) ...
A chroot environment has been detected, udev not started.
Setting up libu2f-udev (1.1.10-1) ...
Failed to send reload request: No such file or directory
Setting up google-chrome-stable (116.0.5845.187-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
Processing triggers for systemd (245.4-4ubuntu3.17) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Google Chrome 116.0.5845.187  has been installed to /usr/bin/google-chrome-stable

chromedriver:

Chrome version major is 116
Installed version of Google Chrome is 116.0.5845.187 
404
Matching Chrome Driver Version 404'd, falling back to first matching major version.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   567  100   567    0     0  43615      0 --:--:-- --:--:-- --:--:-- 43615
New ChromeDriver version to be installed: 116
116 will be installed
curl: (22) The requested URL returned error: 404 

Exited with code exit status 22

And my config:

version: 2.1
orbs:
  browser-tools: circleci/browser-tools@1.4.5
jobs:
  build:
    docker:
    - image: cimg/node:16.16-browsers

    steps:
    - browser-tools/install-chrome
    - browser-tools/install-chromedriver
    - ...
    - 

It looks like they released a new version of chrome stable too

Screen Shot 2023-09-12 at 15 12 38

kind of weird that the chrome is installing succesfully but noy chromedriver - based on that dashboard both should be 404ing?

The previous workaround also isnt working for me:

- browser-tools/install-browser-tools:
    chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed
 Google Chrome is not currently installed; installing it
Preparing Chrome installation for Debian-based systems
2023-09-12 19:17:35 URL:https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_116.0.5845.96-1_amd64.deb [96765132/96765132] -> "/tmp/chrome.deb" [1]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'google-chrome-stable' instead of '/tmp/chrome.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 google-chrome-stable : Depends: libu2f-udev but it is not installable
E: Unable to correct problems, you have held broken packages.
/bin/bash: line 129: google-chrome-stable: command not found
Google Chrome v116.0.5845.96 (stable) failed to install.

Exited with code exit status 1

(on the 'Install Google Chrome' step)

karlentwistle commented 1 year ago

I opened a new issue here https://github.com/CircleCI-Public/browser-tools-orb/issues/95

hoylemd commented 1 year ago

:+1: see #95

ourmaninamsterdam commented 11 months ago

circleci/browser-tools@1.4.6 has resolved it for me

berniechiu commented 7 months ago

It happened again

Chrome version major is 116
Installed version of Google Chrome is 116.0.5845.140 
500
116.0.5845.140 will be installed
/bin/bash: line 165: [[: 116.0.5845.140: syntax error: invalid arithmetic operator (error token is ".0.5845.140")
curl: (22) The requested URL returned error: 404
iainbeeston commented 7 months ago

@berniechiu There's a new GitHub issue for that https://github.com/CircleCI-Public/browser-tools-orb/issues/108

jasonfb commented 2 months ago

starting in July 2023 I started getting this on my builds

Google Chrome 116.0.5845.140 is currently installed; replacing it
^@^@Preparing Chrome installation for Debian-based systems
https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_116.0.5845.96-1_amd64.deb:
2024-07-19 15:41:42 ERROR 404: Not Found.
/bin/bash: line 130: google-chrome-stable: command not found
Google Chrome v116.0.5845.96 (stable) failed to install.

Exited with code exit status 1
jasonfb commented 2 months ago

the build failure started in July 2024 when I had the old browsertools (1.4.4) locked

this seems to be fixed by upgrading the browsertools and removing the special install stanzas

orbs:
  browser-tools: circleci/browser-tools@1.4.8

and then removing the re-installing stanzas:

(remove)

      - browser-tools/install-browser-tools:
          chrome-version: 116.0.5845.96 # TODO: remove when chromedriver downloads are fixed
          replace-existing-chrome: true
      - browser-tools/install-chrome:
          # TODO remove following line when fixed https://github.com/CircleCI-Public/browser-tools-orb/issues/90
          chrome-version: 116.0.5845.96
          replace-existing: true