We want to run a before-commit trigger on a UVCS server hosted in Unity DevOps, no idea how

I’ve figured out how to use a before-clientcheckin trigger with a file in our repo to prevent people accidentally checking in temporary local changes to important project files (i.e. **/ProjectSettings/. and some specific assets under **/Assets/ ), but sadly it’s not a good solution.

The problem we have is that some of our team are on Mac and some are on Windows so we can’t use the same client trigger script for all users - we’re a completely distributed team, so getting everyone to install a cross platform scripting solution is a far less than ideal solution.

What I would like to do instead is to run a server side trigger on before-checkin, but our UVCS server is in Unity DevOps so we have no access to put actual files onto the server to accomplish this…

Whilst there is a bunch of documentation on the trigger it doesn’t really explain how to get server side trigger scripts onto the server, and it definitely doesn’t anything about a triggers with Unity DevOps (i.e. how do you get a trigger script onto a server if you don’t have access to the server’s filesystem?!)

I assume it is possible to set up an trigger for before-checkin on a DevOps UVCS server, so I would really really reall appreciate it if someone from Unity could post a detailed how-to for this.

I don’t mind what scripting language the trigger needs to be is as long as I can easily test it (and debug it - e.g. ideally need some way of being able to access debug logging from the script when it runs).

Specifically what we need to do is:

  • compare the files being checked in vs. a set of protected paths (i.e. **/ProjectSettings/. and a few assets in the Assets folder)

  • if no files match:

    • allow the check in to happen
  • if a file matches a protected path:

    • check the commit comment for a specific string e.g. “ForceProtectedCheckin”:
      • if it’s present:
        • allow the check in to happen
      • if it’s not present:
        • log an error message telling the user why their checkin has failed
        • don’t allow the check in

Thanks for your help.

Alex

You can create server-side triggers using the commands explained here. Since this trigger runs on the server side, it does not matter that you are not using the Enterprise edition—the trigger will still be created and will behave the same way.

For the specifics of the script, we can help you craft a solution based on your needs. Could you provide more details on what you want the trigger to check before allowing the commit? That way, we can guide you with an appropriate script example.

You can always reach us and mention this blog post to get urgent support from us devops-vcs-support@unity3d.com.

Let us know how we can assist!

1 Like

Thanks for getting back to me!

Will send you an email about this, thanks. (note: the email will come from my regular employment email address, not the one associated with this account)

Alex

FWIW what we are trying to do is listed in the question above!

Essentially we want to use a server side before-checkin trigger to disallow accidental check ins of important files by default - but to allow check ins IFF there is a key phrase in the change list comment.

Important things

  • this has to work on a UVCS server in Unity DevOps
    • so the trigger script needs to be in some scripting language supported by whatever OS the UVCS DevOps cloud servers run on
  • the script used for the trigger should be in our project repository so we can modify it easily