Skip to content

Add post_clone_script hook

Dan Rice requested to merge dnrce/gitlab-runner:post-clone-script into main

What does this MR do?

This adds an additional post_clone_script hook to the build process that will run after git clone. This complements pre_clone_script and mirrors the pre_build_script/post_build_script hooks.

Why was this MR needed?

The existing hooks provide one entrypoint between the clone step and the script step: pre_build_script. For container-based executors, this existing hook runs in the build container. There is not a hook that runs after the clone in the helper container. This addition closes that gap.

What's the best way to test this MR?

Bring up a runner configured with post_clone_script = "echo post-clone-script && cat /etc/*-release". Execute a job using the CI config

build:
  image: ubuntu:20.04
  script:
    - echo build

and verify in the job output that the post-clone-script hook returns data from the Alpine helper container rather than the Ubuntu build container.

What are the relevant issue numbers?

N/A

Merge request reports