0

I'm having trouble installing google chrome that will be shareable across steps. My cloudbuild.yaml looks like so:

- name: 'ubuntu'
  args: ['bash', 'tools/download-chrome.sh']
  volumes:
  - name: 'bin'
    path: '/usr/bin'
- name: 'gcr.io/cloud-builders/npm'
  args: ['run', 'install-all-ci']
- name: 'gcr.io/cloud-builders/npm'
  args: ['test']
  volumes:
  - name: 'bin'
    path: '/usr/bin'

Where the first step downloads chrome, and calling which google-chrome returns /usr/bin/google-chrome. Doing the same in the last step returns nothing.


I also tried adding the volume to the step in between and moving that step up (because putting it in the install step broke git for some reason. I'm thinking /usr/bin is not a good dir to share since volumes get deleted?


Attempt 3 was doing something like:

apt-get download -y google-chrome-stable \
      --no-install-recommends \
    && dpkg -i --force-all --root=/workspace/chrome /workspace/google-chrome-stable*.deb \

But I get the following error: dpkg: error: unable to access dpkg status area: No such file or directory. I tried doing mkdir /workspace/chrome but that doesn't solve the issue.

knownasilya
  • 5,998
  • 4
  • 36
  • 59

1 Answers1

1

I wonder if the /usr/bin directory is used by the docker image already in which case you may not be able to overwrite it?

Another solution you could explore is having a docker image with both npm and the chrome tool, so you don't have to download/install it on each build.

Best, Philippe

Philmod
  • 171
  • 5
  • That was my next idea, although since it's docker, the tests change quite often so the step is invalidated and the download has to happen for chrome very often, slowing down the build. I think.. – knownasilya Dec 20 '18 at 18:55
  • Do you mean chrome changes often? In which case, you could rebuild the builder on every build (making sure to use docker caching correctly, so it's quick if there is no change): https://github.com/Philmod/parcel/blob/gcb/cloudbuild.yaml – Philmod Dec 22 '18 at 15:42
  • I meant my tests change often, causing docker to redownload and install chrome every time, even though that part didn't change. – knownasilya Dec 26 '18 at 15:23
  • 1
    Your tests shouldn't modify the builder image and thus shouldn't trigger the rebuild. In the example I sent, I use cache-from to avoid the builder to be rebuild every time. – Philmod Dec 27 '18 at 16:19