Schlumberger / vsts-chromium-task

MIT License
0 stars 1 forks source link

Installation on Hosted VSTS Agent too slow #3

Open vicioussn opened 6 years ago

vicioussn commented 6 years ago

Hello,

Installation of Chromium on Hosted VSTS Agent too slow - about 15 minutes. Is there's something we can do?

Thanks in advance.

helgejfo commented 6 years ago

Hi, we actually moved away from using this extension to run the tests in a docker image with Chromium installed instead. You can use a docker file similar to this:

FROM node:10.1.0-alpine
RUN apk add --no-cache make gcc g++ python xvfb udev ttf-freefont chromium

COPY . /app
WORKDIR /app

RUN npm install

ENV DISPLAY=:99
ENV CHROME_BIN=/usr/bin/chromium-browser
RUN Xvfb :99 -ac -screen 0 1280x720x16 -nolisten tcp &
RUN npm run test

If you are using Karma for running the tests, the browser should be set up like this:

    customLaunchers: {
      ChromeNoSandbox: {
        base: 'ChromiumHeadless',
        flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-translate', '--disable-extensions']
      }
    }

This runs in about 3-4 minutes depending on the speed of npm install and your tests. You can also use this docker image as the first stage to produce a second one which runs your application, or extract the produced result to avoid building/installing twice.

sandorfr commented 6 years ago

It's due to Invoke-Request progress bar (see this thread for more info).

I submitted a PR for this issue. On my own fork I'm down to ~30seconds to get it installed. I can share my forked extension if someone needs it until it's merged,

helgejfo commented 6 years ago

Thanks for the PR @sandorfr, much appreciated.

sandorfr commented 6 years ago

Will you have a chance to publish soon ?

helgejfo commented 6 years ago

The PAT in our release to publish to our marketplace has expired, waiting for it to be renewed by someone with the right permissions.

sandorfr commented 6 years ago

Haha classic :) On Sun 1 Jul 2018 at 16:41, Helge Fosse notifications@github.com wrote:

The PAT in our release to publish to our marketplace has expired, waiting for it to be renewed by someone with the right permissions.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Schlumberger/vsts-chromium-task/issues/3#issuecomment-401586724, or mute the thread https://github.com/notifications/unsubscribe-auth/ACiXpi5PHysUXK0NKuLGa9JvbvSfQyVqks5uCG8kgaJpZM4UzXPk .

helgejfo commented 6 years ago

I got a new PAT, but the marketplace wont allow me to update the extension. I am on vacation for the next three weeks with limited internet access and wont have a chance to fix this until I get back. Hope that is OK.

jessehouwing commented 5 years ago

Also note that Chrome is pre-installed on the VSTS Hosted Agent. Just setting an environment variable will make things even faster:

image

If Chromium isn't detected automatically, add the chromium.bin variable and point it to chrome.exe.

helgejfo commented 5 years ago

Indeed it is, thanks for letting us know @jessehouwing. I guess we can close this issue then @sandorfr? As it makes this extension more or less obsolete.

sandorfr commented 5 years ago

Yes I don't need it for my personal use case anymore. However, It would be gould to fix it for people still using it. Also, for users using on premises agent who might not have chrome preinstalled it is still valuable.