Skip to content

Allow using prebuilt Docker helper images when running from out/binaries

Pedro Pombeiro requested to merge prebuilt-helper-images into master

What does this MR do?

  • It adds the ../helper-images path to the lookup paths so that the helper image is found when running from out/binaries;
  • It adds out/helper-images relative to the working directory, allowing the helper image to be found when debugging inside GoLand;
  • It removes the helper-images value since that isn't being used.

Why was this MR needed?

Was receiving an error saying that the helper image couldn't be found:

2020-05-15_at_12.07

How to test this MR?

  • Build the branch:

    make runner-bin-host && make helper-dockerarchive-host
  • Before each step, ensure that you don't have the helper image in Docker:

    docker rmi gitlab/gitlab-runner-helper:x86_64-`git rev-parse --short=8 HEAD`

Now we can test each new value we added to PrebuiltImagesPaths, and look at what is traced from executor.getLocalHelperImage():

  1. Test ../helper-images value

    This can be exercised by running from project root with out/binaries/gitlab-runner run.

    Output
    Looking for prebuilt image gitlab/gitlab-runner-helper:x86_64-a81118ed...  job=890548095 project=16892582 runner=cpwhDr7z
    Failed to load prebuilt image from: /Users/pedropombeiro/src/gitlab.com/gitlab-org/gitlab-runner/out/binaries/out/helper-images/prebuilt-x86_64.tar.xz error: open /Users/pedropombeiro/src/gitlab.com/gitlab-org/gitlab-runner/out/binaries/out/helper-images/prebuilt-x86_64.tar.xz: no such file or directory  job=890548095 project=16892582 runner=cpwhDr7z
  2. Running the runner from GoLand

    GoLand will run the executable from a temporary directory, but the 3rd path from PrebuiltImagePaths will allow it to find the helper image tar file.

    Configuration

    2020-12-04_at_10.37

    Output
    Failed to load prebuilt image from: /private/var/folders/d6/6c8ngg8s4234wvt09281ngxc0000gn/T/out/helper-images/prebuilt-x86_64.tar.xz error: open /private/var/folders/d6/6c8ngg8s4234wvt09281ngxc0000gn/T/out/helper-images/prebuilt-x86_64.tar.xz: no such file or directory  job=890511224 project=16892582 runner=cpwhDr7z
    Appending trace to coordinator... ok                code=202 job=890511224 job-log=0-397 job-status=running runner=cpwhDr7z sent-log=0-396 status=202 Accepted update-interval=3s
    Failed to load prebuilt image from: /private/var/folders/d6/6c8ngg8s4234wvt09281ngxc0000gn/helper-images/prebuilt-x86_64.tar.xz error: open /private/var/folders/d6/6c8ngg8s4234wvt09281ngxc0000gn/helper-images/prebuilt-x86_64.tar.xz: no such file or directory  job=890511224 project=16892582 runner=cpwhDr7z
    Loading prebuilt image...                           job=890511224 project=16892582 runner=cpwhDr7z
  3. Running the runner with go run

    go run will run the executable from a temporary directory, but the 3rd path from PrebuiltImagePaths will allow it to find the helper image tar file:

    go run gitlab.com/gitlab-org/gitlab-runner -debug run
    Output
    Looking for prebuilt image gitlab/gitlab-runner-helper:x86_64-latest...  job=890620007 project=16892582 runner=cpwhDr7z
    Failed to load prebuilt image from: /private/var/folders/d6/6c8ngg8s4234wvt09281ngxc0000gn/T/go-build429075731/b001/exe/out/helper-images/prebuilt-x86_64.tar.xz error: open /private/var/folders/d6/6c8ngg8s4234wvt09281ngxc0000gn/T/go-build429075731/b001/exe/out/helper-images/prebuilt-x86_64.tar.xz: no such file or directory  job=890620007 project=16892582 runner=cpwhDr7z
    Failed to load prebuilt image from: /private/var/folders/d6/6c8ngg8s4234wvt09281ngxc0000gn/T/go-build429075731/b001/helper-images/prebuilt-x86_64.tar.xz error: open /private/var/folders/d6/6c8ngg8s4234wvt09281ngxc0000gn/T/go-build429075731/b001/helper-images/prebuilt-x86_64.tar.xz: no such file or directory  job=890620007 project=16892582 runner=cpwhDr7z
    Loading prebuilt image...                           job=890620007 project=16892582 runner=cpwhDr7z

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Closes #27283 (closed)

Edited by Georgi N. Georgiev

Merge request reports