Skip to content

Install gcloud globally

Adrien Kohlbecker requested to merge ak/gcloud into master

What does this MR do?

Each commit in this MR is individually reviewable

Fixes https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/macstadium/orka/-/jobs/1036419641#L265

This error seems to happen because we clone asdf twice. Once in the toolchain build using the markosamuli.asdf ansible-galaxy library, and a second time in the xcode build when we temporarily download gcloud to access our Xcode installation files.

In order to install gcloud once globally and skip the second clone of asdf a major change in our asdf setup was needed. Indeed, the galaxy library installs all the required packages in one go THEN activates them in one go. Since gcloud depends on python, with this method at installation time asdf does not yet have an active python, so it fails.

To fix this, I changed the installation process to loop over each package, and in each iteration install AND activate the package. This means that if gcloud comes after python in the installation list, it can find it.

Similarly to how I removed the homebrew galaxy library, I think we're able to manage our own dependencies much better if we own the simple ansible code needed to install them.

Some additional small refactoring also went in, see the commits.

Why was this MR needed?

What's the best way to test this MR?

  • Create a VM using the base image from this MR: mr-62-runner-11-12.4.img
  • SSH to it
  • sudo su gitlab-runner && cd /Users/gitlab-runner
  • cat .tool-versions should show the global active packages
  • asdf list should show the packages we installed
  • gcloud should work

What are the relevant issue numbers?

Closes #57 (closed)

Edited by Adrien Kohlbecker

Merge request reports