Skip to content

Refactor installing Xcode Command Line Tools

Adrien Kohlbecker requested to merge ak/clt into main

What does this MR do?

The current way we install Xcode CLT is painful. See for example https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/macstadium/orka/-/jobs/1655859996:

  1. The elliotweiser role installs it once:
  cmd:
  - softwareupdate
  - -i
  - Command Line Tools for Xcode-12.5
  stdout: |-
    Software Update Tool
  
    Finding available software
  
    Downloading Command Line Tools for Xcode
    Downloaded Command Line Tools for Xcode
    Installing Command Line Tools for Xcode
    Done with Command Line Tools for Xcode
    Done.
  1. Then it turns out it has an TWO updates, which we install at the same time
  cmd:
  - softwareupdate
  - --install
  - --all
  - --restart
  stdout: |-
    Software Update Tool
  
    Finding available software
  
    Downloading Command Line Tools for Xcode
    Downloading Command Line Tools for Xcode
    Downloaded Command Line Tools for Xcode
    Downloaded Command Line Tools for Xcode
    Installing Command Line Tools for Xcode, Command Line Tools for Xcode
    Done with Command Line Tools for Xcode
    Done with Command Line Tools for Xcode
    Done.
  1. And finally the tests fail because we still haven't installed the latest version...
  1) roles/os_updates softwareupdate is up to date
     On host `10.221.188.122'
     Failure/Error: expect(has_updates_cmd).not_to be_a_successful_cmd
       expected Command "grep -i recommended /tmp/softwareupdate_out" not to be a successful cmd
       /bin/zsh -c grep\ -i\ recommended\ /tmp/softwareupdate_out
       	Title: Command Line Tools for Xcode, Version: 13.0, Size: 528803K, Recommended: YES, 

So I ain't got time to deal with these failures. Let's host a simple .dmg file in our mac-runners bucket, downloaded from Apple's developer resources portal. I made those files publicly available so we can get them with get_url (we don't have gcloud installed at this stage of the build).

Then, I disable test failures related to these tools not being up-to-date. They go in pair with a version of Xcode, so we can update them when we update Xcode versions.

Finally, I remove the pieces of the elliotweiser role.

Why was this MR needed?

What's the best way to test this MR?

What are the relevant issue numbers?

Edited by Adrien Kohlbecker

Merge request reports