Skip to content

Make setting the hook environment unconditional

Nick Thomas requested to merge make-set-hook-env-unconditional into master

What does this MR do?

This one-line change deserves a little explanation. Prior to b9424627, the hook env was set unconditionally. In that commit, the environment was transformed to switch from relative to absolute paths for object directories, etc. This depended on a project being present, so a conditional was added to the transformation line.

In 52bfd064 we stopped doing that transformation, but the if project line was moved from the transform to the (previously unconditional) hook env set line. It didn't cause problems, because every repository had a project.

In time, we introduced repositories for personal snippets, where this is no longer true - and they broke. So we transformed the check to read if container in 36ea5135, because we weren't sure if it was necessary or not, and we were in a hurry.

Now that I've dug into the history of this change, I'm confident we can make this call unconditional, so this MR does that. There are no project-dependent lines within parse_env or set. There are no tests that depend on the removed behaviour, because every possible instance where if container returns nil would be a bug.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Nick Thomas

Merge request reports