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
- Define an example environment variable in
/etc/gitlab/gitlab.rb
gitlab_rails['env'] = {
"EXAMPLE_VARAIBLE" => "blah blah"
}
-
Create a new repository
myuser/test-repoin the GitLab front-end -
Create the following
updatehook in/home/git/repositories/myuser/test-repo.git/custom_hooks/update
echo "GL-HOOK-ERR: The value is: ${EXAMPLE_VARAIBLE}"
exit 1
-
Use the Web IDE to modify a file in the repo. The
updatehook should cause the commit to fail and output an error -
This should print show
The value is: blah blahin 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