I am getting command not found error when I run apt-get commands in Bamboo build. I’ve tried using all interpreters: Shell, Windows Powershell and /bin/sh or cmd.exe but to no avail.
Here are the codes I would like to run:
apt-get update && apt-get install apt-transport-https -y
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
apt-get update && apt-get install google-chrome-stable -y
How can I run them?
I don’t think the problem is in the interpreter, but in the permissions of the Bamboo agent. As a user, apt-get typically requires
sudo. I think you will need to find a way to safely elevate the permissions of the Bamboo agent so that is effectively root. Be careful here; giving bots (not just Bamboo) root access can be a big security hole. Is it not possible to install Chrome on the agent host once, not for every build?
Hi @ibuchanan, thanks for your response. I’m trying to run Google Lighthouse on Bamboo CI, hence, would require installation of Chrome. Are there any other ways to install chrome?
Can you install Chrome on the host without Bamboo? For example, as root, just
sudo apt-get .... Then Chrome will be available when the Bamboo build plan runs, without having to install Chrome in every build.
Hi @ibuchanan , sorry for the delayed response. Unfortunately, I am unable to install Chrome directly on the host as the server is owned by a separate organisation. Are there any other available solutions?
If you can’t do it on the host, Bamboo can’t do it either. It’s a permissions thing.
I did try adding
sudo to the commands but it yielded this error:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
Yes, that’s expected. For Bamboo, the only way to run
sudo commands is by elevating the Bamboo agent itself, which requires access to the host machine. You can’t do what you are trying to do without access to the host machine. And, if you had that, you could just install Chrome on the host.
I see. Thanks for your help!