Bespoke Environment Variables for Custom Hooks

Summary

I have created a custom hook and installed this into my on-prem GitLab instance following the instructions here:

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/administration/custom_hooks.md

I was expecting this hook to be able to access environment variables as defined in /etc/gitlab/gitlab.rb

Steps to reproduce

  1. Define an example environment variable in /etc/gitlab/gitlab.rb
gitlab_rails['env'] = {
    "EXAMPLE_VARAIBLE" => "blah blah"
}
  1. Create a new repository myuser/test-repo in the GitLab front-end

  2. Create the following update hook in /home/git/repositories/myuser/test-repo.git/custom_hooks/update

echo "GL-HOOK-ERR: The value is: ${EXAMPLE_VARAIBLE}"
exit 1
  1. Use the Web IDE to modify a file in the repo. The update hook should cause the commit to fail and output an error

  2. This should print show The value is: blah blah in the front-end. However, the variable value is not populated and the hook outputs: The value is:

What is the current bug behavior?

The hook output currently shows:

The value is: 

What is the expected correct behavior?

The hook output should show:

The value is: blah blah

Results of GitLab environment info

GitLab 12.0

Assignee Loading
Time tracking Loading