Skip to content

Fix make gitlab-shell-asdf-install

Michael Kozono requested to merge mk/fix-gitlab-shell-asdf-install into main

What does this merge request do and why?

Problem

#2120

make gitlab-shell-asdf-install tries to use ASDF_DEFAULT_TOOL_VERSIONS_FILENAME to install gitlab-shell's dependencies, but it doesn't work properly (at least, the following is what I experienced).

For example, if:

  • gitlab-shell/.tool-versions contains golang 1.21.6
  • and you have golang 1.21.5 installed
  • but you do not have golang 1.21.6
  • and you see these warnings during gdk update:
    Notice: Behaving like ASDF_GOLANG_MOD_VERSION_ENABLED=true
            In the future this will have to be set to continue
            reading from the go.mod and go.work files
  • then make gitlab-shell-asdf-install will not install golang 1.21.6. Instead it will say golang 1.21.5 is already installed.

Possible fixes

It turns out ASDF_DEFAULT_TOOL_VERSIONS_FILENAME must be a filename, not a file path.

The simplest code would be to remove the usage of ASDF_DEFAULT_TOOL_VERSIONS_FILENAME completely, since that would cause make gitlab-shell-asdf-install to install the versions specified in gitlab-shell/.tool-versions. But it would also install other dependencies specified in gdk-directory/.tool-versions, such as minio, nodejs, postgres, etc.

If we want make gitlab-shell-asdf-install to install only the gitlab-shell/.tool-versions tools, then that is what this MR does. I prefer the simple code, but I submit this MR because it fixes the apparent intended behavior. So please LMK if excluding ancestor .tool-versions is unnecessary.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Check out to this merge request's branch.

  2. Uninstall a tool version which is specified in <your-gdk-dir>/gitlab-shell/.tool-versions, e.g. asdf uninstall golang 1.21.6

  3. Install a prior tool version if you don't already have one, e.g. asdf install golang 1.21.5

  4. make gitlab-shell-asdf-install

  5. It should install golang 1.21.6

    Platform 'darwin' supported!
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 62.1M  100 62.1M    0     0  25.3M      0  0:00:02  0:00:02 --:--:-- 25.3M
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100    64  100    64    0     0    308      0 --:--:-- --:--:-- --:--:--   309
    verifying checksum
    /Users/mkozonogitlab/.asdf/downloads/golang/1.21.6/archive.tar.gz: OK
    checksum verified

As opposed to main branch, which for me the above steps result in golang 1.21.5 is already installed.

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Michael Kozono

Merge request reports

Loading