I've been trying to run containerized build in Bamboo with Docker. The reason behind is that some other dependencies in the agent are outdated (i.e: NodeJS) and I wish to have a controlled configuration.
Since all Bamboo build agents in our company had been configured with gcloud service account credentials, I wanted to make use of those credentials within the Docker container.
After doing some research, I understood that gcloud credentials are stored at ~/.config/gcloud.
Hence, during container creation, I supplied the following volume mount:
docker run --volume /home/bamboo/.config/gcloud:/root/.config/gcloud --detach --name POC google/cloud-sdk:340.0.0-slim
with that, I'm able to see the files are appearing correctly within the Docker container.
build 03-Feb-2022 09:42:22 /root/.config/gcloud
build 03-Feb-2022 09:42:22 total 48
build 03-Feb-2022 09:42:22 drwx------ 4 1004 1004 4096 Nov 20 2020 .
build 03-Feb-2022 09:42:22 drwxr-xr-x 3 root root 4096 Feb 3 09:42 ..
build 03-Feb-2022 09:42:22 -rw------- 1 1004 1004 3072 Oct 29 2020 access_tokens.db
build 03-Feb-2022 09:42:22 -rw-rw-r-- 1 1004 1004 7 Apr 19 2017 active_config
build 03-Feb-2022 09:42:22 -rw-rw-r-- 1 1004 1004 0 May 25 2021 config_sentinel
build 03-Feb-2022 09:42:22 drwxrwxr-x 2 1004 1004 4096 Apr 19 2017 configurations
build 03-Feb-2022 09:42:22 -rw------- 1 1004 1004 3072 Nov 7 2017 credentials.db
build 03-Feb-2022 09:42:22 -rw------- 1 1004 1004 5 Feb 3 08:30 gce
build 03-Feb-2022 09:42:22 -rw-rw-r-- 1 1004 1004 37 Nov 20 2020 .last_opt_in_prompt.yaml
build 03-Feb-2022 09:42:22 -rw-r--r-- 1 1004 1004 37 May 21 2021 .last_survey_prompt.yaml
build 03-Feb-2022 09:42:22 -rw-rw-r-- 1 1004 1004 273 Sep 30 2017 .last_update_check.json
build 03-Feb-2022 09:42:22 drwxrwxr-x 27 1004 1004 4096 Feb 3 08:30 logs
build 03-Feb-2022 09:42:22 -rw-rw-r-- 1 1004 1004 32 Apr 19 2017 .metricsUUID
However, when I perform the command gcloud auth list, it gives the following error:
error 03-Feb-2022 09:50:56 No credentialed accounts.
error 03-Feb-2022 09:50:56
error 03-Feb-2022 09:50:56 To login, run:
error 03-Feb-2022 09:50:56 $ gcloud auth login `ACCOUNT`
Invoking the same command within the agent returns authenticated account list correctly.
Am I missing something here?